Repository navigation
test: avoid same-size mtime race in step_commit_dry_run_stage_tracked - #2586
Merged
Merged
Conversation
Both "original" and "modified" are 8 bytes, so `git add -u` against the dry-run temp index has only mtime to detect the change. On Linux/ext4 the recorded entry mtime and the post-modification mtime can be indistinguishable at the kernel's resolution, leaving the temp index pointing at the old blob hash and producing an empty `git diff --staged`. The test then fails because neither "tracked.txt" nor "modified" reach the rendered prompt — see PR \#2581's advisory job for an example failure. Use "modified content" so the file's size differs from the committed blob. That trips git's DATA_CHANGED check unconditionally, removing the timing dependency. Mirrors the adjacent `test_step_commit_with_stage_tracked_flag` which uses "initial" -> "modified" (different sizes) for the same reason. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
worktrunk-bot
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The test wrote
tracked.txtas"original"then"modified"— both 8 bytes.wt step commit --dry-run --stage=trackedrunsgit add -uagainst a copy of the index, so the only signal git has for the modification is mtime. On Linux/ext4 the recorded entry mtime and the post-modification mtime can be indistinguishable at the kernel's resolution; git treats the file as unchanged, the temp index keeps the old blob hash, andgit diff --stagedreturns nothing. The rendered prompt then has empty<diffstat>/<diff>blocks and the assertion on"tracked.txt"/"modified"fires.Reproduces 0/200 locally on macOS APFS and passes on
test (linux), but flaked on theaffected (linux, advisory)job for PR #2581 (logs) — that PR only touched PowerShell shell config and has no plausible effect on this code path.Switching the modification to
"modified content"makes the new size differ from the committed blob, so git's DATA_CHANGED check fires unconditionally and the test no longer depends on mtime resolution. This mirrors the adjacenttest_step_commit_with_stage_tracked_flag(merge.rs:2113) which uses"initial"→"modified"(different sizes) for the same reason. PR #2433 fixed an analogous mtime-tick collision in the picker/summary tests.The
stdout.contains("modified")assertion still passes since"modified"is a prefix of the new content.