Skip to content

Fix status-cache invalidation test race - #2187

Merged
Tyrie Vella (tyrielv) merged 1 commit into
masterfrom
tyrielv/status-cache-invalidation-flake
Nov 13, 2026
Merged

Tyrie Vella (tyrielv) merged 1 commit into
masterfrom
tyrielv/status-cache-invalidation-flake

Conversation

@tyrielv

Copy link
Copy Markdown
Contributor

Problem and Context

The status-cache tests require the cache file to remain absent after a command invalidates it. The background thread can delete and regenerate the cache before that command returns. This correct behavior causes an intermittent failure in ModifyingHeadRefInvalidatesCache and other tests that use the same helper.

Changes

  • Observe cache deletion with a file-system watcher that starts before the command. Keep the assertions for cache regeneration and status output.
  • Use the same observation for HEAD, branch, and exclude-file changes.
  • Require file creation to invalidate the cache in the ignore-file setup, instead of an explicit cache deletion.
  • Add a functional test that waits for cache regeneration before the command callback returns. The test verifies that fast regeneration does not hide deletion.

Observe cache deletion before the command starts so that fast regeneration cannot hide invalidation. Retain cache regeneration and status output assertions. Add a functional test that waits for regeneration before the callback returns.

Assisted-by: GPT-6.1 Sol
Signed-off-by: Tyrie Vella <[email protected]>
@KeithIsSleeping

Copy link
Copy Markdown

[KeithBot]: ✅ No issues found · iteration 1 (c4e8248)

Approach: Right layer: fixes the timing assumption in the shared test helper for all four callers; a watcher armed before the command proves deletion even when the background rebuild wins the race.

Validation

  • ✅ PR CI: 34/34 jobs, x64 + arm64
  • ✅ 10/10 status-cache FT cases in CI
  • ✅ FT build, GitStatusCacheTests 17/17
  • ✅ Race A/B on real GitStatusCache
  • ✅ Compiled helper + FSW probes, src+base
  • ✅ Flake root cause in failing CI run logs
  • ⏭️ Mounted FTs run locally — not run

Approving.

🤖 KeithBot · claude-opus-5.5, gpt-6.1-sol, gemini-4-argon + approach review · reply on a thread to dispute

@tyrielv
Tyrie Vella (tyrielv) merged commit aefc46b into master Nov 13, 2026
39 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.

2 participants