Repository navigation
test(host-git-repo-exec): pin mtime before hook liveness check - #25469
Conversation
…ess check The fixture liveness check proved post-index-change fires by running git -c core.fsmonitor= status --porcelain but this only triggers the hook when git must refresh a cached stat entry. After a fresh commit every tracked file's cached mtime matches its on-disk mtime exactly, so git skips the re-check on fast runners with nanosecond timestamps and post-index-change never fires. Fix: call os.utime(repo / 'a.txt', (1, 1)) before the liveness check. This makes the file's mtime mismatch the index-cached stat, forcing git to re-read the file, find it unchanged, write the refreshed entry back, and fire post-index-change -- deterministically on every runner speed. The same utime pattern is already used in _with_nested_filter_repo.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Test-only change that makes the hook fixture's liveness probe deterministic; nothing blocks. Notes
[DESIGN-REVIEWED] 5b2a554 Description read[DESCRIPTION-READ] ba79ca45bf196307d45ce1e33df5f4595d63dcd3e7fc57085c7652807fc5362f That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
iamwhatever
left a comment
There was a problem hiding this comment.
Approve. Reviewed head 5b2a554.
The fix is sound and minimal: os.utime(repo / "a.txt", (1, 1)) makes a tracked file's stat disagree with the freshly committed index, so the unpinned git status probe must refresh the index and fire post-index-change on every runner (test L583-L594). The same pattern is already used elsewhere in this file. Test-only; no production code changes. All checks on this head are green and the AI lanes report no blocking findings.
AI findings judged non-blocking
- Design Review (PASS note): after the probe refreshes the index, the handler's own
git statushas nothing to rewrite, so the hook half ofassert _ran(marker) == ""cannot fail. This is correct, but it is not introduced here: on main the same vacuity existed whenever the old racy probe fired. The fsmonitor/pager half of the assertion stays live (_plant L79-L88). Re-stalinga.txtafter the probe would be a worthwhile small follow-up but does not block this flake fix.
— crew-pr-reviewer (r134)
Problem / Motivation
Goal: Make the
post-index-changehook liveness check inTestDashboardFileDiff::test_fixed_key_programs_and_hooks_do_not_rundeterministic on fast runners.After a fresh
git commitevery tracked file's cached mtime in the index exactly matches its on-disk mtime. When the self-check runsgit -c core.fsmonitor= status --porcelain(fsmonitor explicitly disabled), git compares each file's stat against the index, finds them identical, skips the re-check, never writes the refreshed entry back, andpost-index-changenever fires. The marker stays empty and the liveness assertion fails.Seen on two unrelated PRs (#19831, #23094) that do not touch this code; example run: https://github.com/kirodotdev/KiroCrew/actions/runs/40754675759 job 123058092936.
Why it matters
The test is new (landed in #24822 today) and already flaky on every CI run that follows a fast commit. It will block unrelated PRs on the same xdist shard until fixed.
Not a goal
What changed (motivation → approach → change)
After a fresh
git commit, the index caches the exact mtime of each tracked file.git statuscompares stat data and finds no mismatch, so it takes the fast path: no file re-read, no index write, nopost-index-changehook. On Linux with nanosecond-resolution ext4, this is the common case because the file write and the commit happen at different nanoseconds.Fix: call
os.utime(repo / "a.txt", (1, 1))before the liveness check. This sets the file's mtime to epoch+1s, which mismatches the index's cached value, forces git to re-read the file, find it unchanged, write the refreshed stat entry, and firepost-index-change-- deterministically regardless of runner speed or timestamp resolution.The same
os.utime(f, (1, 1))pattern is already used in_with_nested_filter_repofor the same reason.Backwards compatibility
Compatible: test-only change; no production code altered.
Removes nothing: no capability removed.
Tests
TestDashboardFileDiff::test_fixed_key_programs_and_hooks_do_not_run-- the liveness check now firespost-index-changedeterministically; the real assertion (dashboard diff runs no hook) is unchanged.Proof: not provable -- test-only change
Manual verification
N/A -- unit coverage sufficient. Determinism confirmed by analysis:
os.utime(f, (1, 1))guarantees a stat mismatch on every filesystem with any timestamp resolution.Screenshots / video
N/A