Skip to content

fix(test-runner): refuse stale/missing DLLs in streaming path (closes #3011) - #3018

Merged
zackees merged 1 commit into
masterfrom
feat/3011-test-runner-stale-dll-detection
Jun 14, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/3011-test-runner-stale-dll-detection

Conversation

@zackees

@zackees zackees commented Jun 14, 2026 •

Copy link
Copy Markdown
Member

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 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 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:

  1. New helper validate_test_artifact(test_path, build_start_time) -> Optional[TestResult].
  2. test_callback calls it before launching the runner. Two checks:
    • The DLL exists at test_path.
    • The DLL's mtime is ≥ the build's start time (ctx.start_time, already plumbed for the duration measurement). Stale artifacts have mtime < start.
  3. If either gate fails, returns a 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:

  • Fresh DLL (mtime > build_start) → None (proceed to run).
  • Missing DLL → TestResult(success=False) with message mentioning Test artifact missing, the path, and #3011.
  • Stale DLL (mtime < build_start) → TestResult(success=False) with message mentioning Stale test artifact, the path, and #3011.
  • DLL with mtime exactly == build_start → accepted (uses < not <= to match coarse-mtime filesystems — Windows FAT32 is 2 s; ext3 was 1 s).
  • Failure messages include actionable remediation (re-run, zccache stop).
$ python -m pytest ci/tests/test_streaming_runner_artifact_validation.py -v
collected 5 items
test_streaming_runner_artifact_validation.py::TestValidateTestArtifact::test_exactly_at_build_start_is_accepted PASSED [ 20%]
test_streaming_runner_artifact_validation.py::TestValidateTestArtifact::test_failure_messages_are_actionable     PASSED [ 40%]
test_streaming_runner_artifact_validation.py::TestValidateTestArtifact::test_fresh_dll_returns_none              PASSED [ 60%]
test_streaming_runner_artifact_validation.py::TestValidateTestArtifact::test_missing_dll_returns_failure         PASSED [ 80%]
test_streaming_runner_artifact_validation.py::TestValidateTestArtifact::test_stale_dll_returns_failure           PASSED [100%]
5 passed in 0.38s

ruff check clean on both modified files.

Closes #3011.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved CI test validation to detect missing or stale test binaries before execution, preventing false pass/fail results from outdated builds and properly surfacing link-time failures.
  • Tests

    • Added comprehensive test coverage for artifact validation logic, including scenarios for fresh binaries, missing artifacts, stale binaries, and actionable error messaging.

…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]>
@coderabbitai

coderabbitai Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b8e4063a-bc56-4278-9754-7a572516f7ae

📥 Commits

Reviewing files that changed from the base of the PR and between 8c2a8f5 and fcadcc3.

📒 Files selected for processing (2)
  • ci/meson/streaming_runner.py
  • ci/tests/test_streaming_runner_artifact_validation.py

📝 Walkthrough

Walkthrough

Adds a validate_test_artifact helper to ci/meson/streaming_runner.py that returns a failed TestResult when a test binary is missing or has an mtime earlier than the build start time. The per-test streaming callback now calls this guard first and short-circuits execution. A new unittest module covers five artifact-timing scenarios.

Changes

Stale Artifact Guard for Streaming Test Runner

Layer / File(s) Summary
validate_test_artifact function and callback integration
ci/meson/streaming_runner.py
Adds validate_test_artifact(test_path, build_start_time) -> Optional[TestResult] which returns None for fresh artifacts and a failed TestResult for missing or stale ones. The per-test streaming callback is updated to call this guard before spawning a subprocess, returning early on failure.
Unit tests for validate_test_artifact
ci/tests/test_streaming_runner_artifact_validation.py
Adds TestValidateTestArtifact with five tests: fresh DLL returns None, missing DLL returns failure, stale DLL returns failure, mtime == build_start boundary is accepted, and failure messages include the artifact path, #3011, and remediation hints (re-run, zccache stop).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 A binary stale from a build long gone,
No longer shall fool me — I've added a check!
If mtime predates when the fresh build was born,
I'll fail it with grace and a message on deck.
False passes? No more! The timestamp holds sway.
Hop hop, every test earns its pass the right way! 🌟

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/3011-test-runner-stale-dll-detection

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit ed7f5e2 into master Jun 14, 2026
6 of 8 checks passed
@zackees
zackees deleted the feat/3011-test-runner-stale-dll-detection branch June 14, 2026 10:54
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

test runner produces false-pass when link fails (zccache daemon crash under all-with-examples) Interrupt short circuit support TLS3001

1 participant