Skip to content

TR-1348: sync rebuild docs, log, and checkout-ref test - #9

Merged
ashish-bagri merged 1 commit into
mainfrom
factory/TR-1348
Nov 15, 2026
Merged

ashish-bagri merged 1 commit into
mainfrom
factory/TR-1348

Conversation

@ashish-bagri

Copy link
Copy Markdown
Member

Ticket: TR-1348 (follow-ups F5 and F6 from the lore#6 round-2 review).

What changed

  • F5: docs/usage.md said a rebuild of a stale checkout reports adopted: true; it reports adopted: false (the server already held the repo). Docs fixed. sync now logs one line when it rebuilds a stale checkout (source id, commit). a_sync_rebuilds_a_checkout_that_a_job_left_behind asserts adopted == false.
  • F6: new test a_failed_rebuild_drops_the_checkout_ref_so_the_next_sync_retries. A corrupt mirror.git/index makes read-tree fail after a good checkout; it asserts the sync fails, refs/lore/checkout is gone, and the next sync rebuilds to the right commit.

Checks (arm64 Docker, -j 2)

  • fmt: OK. clippy --all-targets -D warnings: clean.
  • Full suite: 35 binaries, 695 passed, 2 failed, 4 ignored. The 2 failures are tests/cli_search.rs (no_hits_is_a_note_on_stderr_and_still_success, plain_output_is_path_lines_score_symbols_and_three_snippet_lines): an onnxruntime cpuid warning on stderr in this arm64 VM, not related to this change.
  • Mutations: adopted: true in the rebuild branch fails the rebuild test; removing update-ref -d refs/lore/checkout fails the new test. Unmutated, the three tests pass.

@ashish-bagri

Copy link
Copy Markdown
Member Author

factory/review: pass (TR-1348, head 48de627)

Verified (Docker, rust:1.95-trixie + pgvector pg17, isolated target dir)

  • cargo fmt --all -- --check: OK
  • cargo clippy --all-targets -- -D warnings: clean
  • cargo test --all-targets --no-fail-fast: 695 passed / 2 failed / 4 ignored. The 2 failures are the arm64-only cli_search ones, the same as on main. cli_index is 15/15.
  • Mutation M1, the report says adopted: true: a_sync_rebuilds_a_checkout_that_a_job_left_behind and 2 others fail.
  • Mutation M2, the update-ref -d CHECKOUT_REF in refresh_checkout replaced with a no-op git call: only a_failed_rebuild_drops_the_checkout_ref_so_the_next_sync_retries fails (cli_index.rs:1070, the ref still names A).
  • docs/usage.md now matches sync.rs:547 (adopted: unheld). The new info log fires only when a held checkout is rebuilt.
  • A second-model challenge was run. Its P1 on tests/sync.rs:187-203 was rejected: those cases are unheld=true, consistent with the code and usage.md:124.

Testing the ref drop through a real failed read-tree is the right test for F6.

Findings (none blocking)

  • F1 P3 src/repo/mod.rs:630: refresh_checkout removes the mirror index only when the checkout dir is missing. While the checkout exists, a corrupt index is never cleared, so every later sync fails the same way. This was there before the PR. The new test hides it: it removes the index by hand (tests/cli_index.rs:1077) under the comment "a stale one is removed", which reads as if the code does it. Suggestion: always remove the index before read-tree --reset, since it is rebuilt from the commit anyway, then drop the manual removal from the test. At the least, fix the comment.
  • F2 P3 tests/cli_index.rs:1069: assert_ne!(status, 200) accepts any non-200. A 404 or 401 from a broken setup would pass. Assert the specific status a failed rebuild returns.

Not verified

  • No Codex layer-1 review is recorded.
  • Not run on amd64.
  • Only the test's injected index corruption was exercised.

— ashish-crew-reviewer

@ashish-bagri
ashish-bagri merged commit 6b8be1d into main Nov 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant