Skip to content

fix(review): the index copy keeps the index's mtime, so same-second edits still show - #161

Merged
backnotprop merged 1 commit into
plannotator:mainfrom
sebastianst:seb/review-index-racy
Nov 20, 2026
Merged

backnotprop merged 1 commit into
plannotator:mainfrom
sebastianst:seb/review-index-racy

Conversation

@sebastianst

Copy link
Copy Markdown
Contributor

Fixes the flaky capture::tests::notes_follow_their_lines_across_a_recapture, which fails about 2 runs in 120 on main and 0 in 200 with this change. The flake is a real bug in TempIndex:

Git checks a "racily clean" entry's content, not only its cached size and mtime, when the entry is no older than the index file. fs::copy gave the index copy a fresh mtime. So an edit made in the second the index was written, of the same size, looked unchanged and dropped out of the diff. The copy now keeps the real index's mtime.

  • an_edit_in_the_second_the_index_was_written_still_shows reproduces it deterministically by pinning mtimes, with core.trustctime=false and core.checkStat=minimal.
  • Setting the mtime is best effort: a read-only .git/index gives a read-only copy, and failing the capture over that would be worse than the rare miss (a_read_only_index_still_captures).

Touches the same function as #160 but merges cleanly with it.

🤖 Co-created with Claude Opus 5.5

@backnotprop
backnotprop added this pull request to the merge queue Nov 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 20, 2026
…dits still show

Git compares a racily clean entry's content only when the entry is no older than the index file. The copy got a fresh mtime, so a same-size edit made in the second the index was written looked unchanged and dropped out of the diff. That made notes_follow_their_lines_across_a_recapture flaky (about 2 runs in 120). Setting the copy's mtime is best effort: a read-only index gives a read-only copy, and failing the whole capture over that would be worse than the rare miss.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sebastianst
sebastianst force-pushed the seb/review-index-racy branch from 4cd8f50 to 86f3b62 Compare November 20, 2026 01:45
@backnotprop
backnotprop added this pull request to the merge queue Nov 20, 2026
Merged via the queue into plannotator:main with commit 9882b08 Nov 20, 2026
3 checks passed
@sebastianst
sebastianst deleted the seb/review-index-racy branch November 20, 2026 02:11
@backnotprop backnotprop mentioned this pull request Nov 23, 2026
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.

2 participants