Repository navigation
fix(test-runner): refuse stale/missing DLLs in streaming path (closes #3011) - #3018
Conversation
…3011) The streaming test runner submits a test to the executor as soon as Ninja prints "[N/M] Linking <X>" — but that's Ninja's PRE-link announcement, not a success signal. When the link then FAILS (the classic example being zccache daemon crashes under the `all-with- examples` parallel-link storm of 245 test DLLs + 96 example DLLs racing against one daemon), the runner ends up loading either: * Nothing — on a clean build, the link failure leaves no DLL. * Yesterday's DLL — on an incremental build, the link failure leaves a previous build's artifact at the target path. Either way the test executes garbage: * **False fail direction** — stale DLL hits an assertion the in-progress diff was meant to fix, wastes investigation time chasing the previous bug. * **False pass direction** — stale DLL doesn't yet contain the new assertion the diff *would* have failed, green-lights a broken change. Both are user-visible symptoms of the issue: `[MESON] ❌ Some tests failed (0/0 tests in 92.31s)` followed by 9-test-worth of stale assertion output, with no indication that the link itself failed. This commit adds `validate_test_artifact(test_path, build_start_time)` in `ci/meson/streaming_runner.py` and calls it from `test_callback` before launching the runner. The check is: 1. The DLL exists at `test_path`. 2. The DLL's mtime is ≥ the build's start time (`ctx.start_time`, already recorded for the duration measurement). Stale artifacts from previous builds have mtime < start. If either gate fails, the test is reported as a hard failure with an actionable message naming the path, the FastLED #3011 root cause, and the remediation (`zccache stop` + retry for the daemon-crash variant). The summary line then surfaces it where it belongs — zero false passes / false fails. Why this approach rather than parsing Ninja's `FAILED:` lines: * The mtime check is robust against Ninja output not arriving in a parseable form, against zccache crashing late in the link, and against any other "link reported success but the artifact is bad" failure mode. The pre-link announcement / post-link result race is structurally unobservable from Ninja's stdout alone, but the on-disk state is authoritative. * `ctx.start_time` is already plumbed through `StreamingContext` and represents the exact moment the build began — no new timestamp threading required. This addresses suggested fix #1 in the issue body ("Make the test runner fail hard when its DLL is missing or stale"). Suggested fixes #2 (link-parallelism cap) and #3 (auto-restart zccache on `lost connection to daemon`) remain as independent follow-ups — both attack the same false-pass/false-fail mode from different angles, but this gate alone is sufficient to keep the runner honest while those are designed. Test plan: * New `ci/tests/test_streaming_runner_artifact_validation.py` — 5 unit tests covering: - Fresh DLL (mtime > build_start) → None (proceed to run). - Missing DLL → TestResult(success=False, output mentions "Test artifact missing", path, and #3011). - Stale DLL (mtime < build_start) → TestResult(success=False, output mentions "Stale test artifact", path, and #3011). - DLL with mtime exactly == build_start → accepted (uses `<` not `<=` to match coarse-mtime filesystems). - Failure messages include actionable remediation ("re-run", "zccache stop"). All 5 pass: `python -m pytest ci/tests/test_streaming_runner_artifact_validation.py -v` → `5 passed in 0.38s`. * `ruff check ci/meson/streaming_runner.py ci/tests/test_streaming_runner_artifact_validation.py` → `All checks passed!`. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a ChangesStale Artifact Guard for Streaming Test Runner
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The streaming test runner submits a test to the executor as soon as Ninja prints
[N/M] Linking <X>— but that's Ninja's PRE-link announcement, not a success signal. When the link then fails (canonical example: zccache daemon crashes under theall-with-examplesparallel-link storm of 245 test DLLs + 96 example DLLs racing against one daemon), the runner ends up loading either:Either way the test executes garbage:
Both surface as
[MESON] ❌ Some tests failed (0/0 tests in 92.31s)followed by 9-test-worth of stale assertion output, with no indication that the link itself failed.The fix
ci/meson/streaming_runner.py:validate_test_artifact(test_path, build_start_time) -> Optional[TestResult].test_callbackcalls it before launching the runner. Two checks:test_path.ctx.start_time, already plumbed for the duration measurement). Stale artifacts have mtime < start.TestResult(success=False)with an actionable message naming the path, the FastLED test runner produces false-pass when link fails (zccache daemon crash under all-with-examples) #3011 root cause, and the remediation (zccache stop+ retry for the daemon-crash variant).The mtime check is robust against Ninja output not arriving in a parseable form, against zccache crashing late in the link, and against any other "link reported success but the artifact is bad" failure mode. The pre-link announcement / post-link result race is structurally unobservable from Ninja's stdout alone, but the on-disk state is authoritative.
This addresses suggested fix #1 in the issue ("Make the test runner fail hard when its DLL is missing or stale"). Suggested fixes #2 (link-parallelism cap) and #3 (auto-restart zccache on
lost connection to daemon) remain as independent follow-ups — both attack the same mode from different angles, but this gate alone is sufficient to keep the runner honest while those are designed.Test plan
New
ci/tests/test_streaming_runner_artifact_validation.py— 5 unit tests:None(proceed to run).TestResult(success=False)with message mentioningTest artifact missing, the path, and#3011.TestResult(success=False)with message mentioningStale test artifact, the path, and#3011.<not<=to match coarse-mtime filesystems — Windows FAT32 is 2 s; ext3 was 1 s).re-run,zccache stop).ruff checkclean on both modified files.Closes #3011.
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests