Skip to content

test: 'All tests passed (N/N)' can report a partial run as a full pass (N != 357) #3763

Closed

Description

@zackees

What was observed

Twice during one long session, bash test --cpp reported a confident full-suite pass with a denominator that was not the full suite, where a clean run gives 357.

Verbatim, both from bash test --cpp (not a filtered invocation):

✓ Fingerprint cache valid - skipping C++ unit tests (no changes detected) [1/1 passed in 16.98s]
cpp_unit_tests (1/1 passed in 16.98s) | skipped
✅ All tests passed (274/274 in 36.87s)
cpp_unit_tests (274/274 passed) | 36.87s

Immediately after the second one, bash test --cpp --clean gave:

✅ All tests passed (357/357 in 94.51s)

The concern is not that fewer tests ran — incremental/selected runs are a legitimate optimization. It is that the output is indistinguishable from a full pass: ✅ All tests passed (274/274) reads as "everything is green" with no indication that 83 test binaries were not part of that number. A reader (or an agent deciding whether to merge) cannot tell a full run from a partial one.

I acted on that once during the session — treated a 1/1 passed as evidence of suite health — and only caught it because the number looked wrong.

Not reproducible on demand

I tried to reproduce deliberately and could not. Recording what I ruled out so nobody repeats it:

  1. mtime-only change — touch src/fl/gfx/rgbw.cpp.hpp (content identical, git status clean):
    → correctly stayed cached, no rebuild. Source fingerprinting is content-based, which is right.

  2. Real content change — appended a comment line to src/fl/gfx/rgbw.cpp.hpp:
    → ✅ All tests passed (357/357 in 26.48s). Full suite, not a subset.

  3. Narrow run poisoning the full-run cache entry — my main hypothesis, since the 1/1 case looks exactly like a single-test result being replayed:

    bash test fltest --cpp     ->  ✅ All tests passed (1/1 in 0.02s)
    bash test --cpp            ->  ✓ Fingerprint cache valid ... [357/357 passed in 35.95s]
    

    → the full-mode entry correctly held 357/357. The filtered and full results appear to be keyed separately, so this hypothesis is disproved.

So whatever produced [1/1 passed in 16.98s] under a plain bash test --cpp depends on state I have not identified — plausibly an ordering involving --clean, a failed/interrupted run, or a build-dir reconfigure between invocations.

Why file it anyway

The cached-result string is replayed verbatim on later runs (skipping C++ unit tests ... [N/N passed in Xs]), so if a wrong N ever lands in that slot it is reported as an authoritative pass until something invalidates the fingerprint. That is a silent-wrong-answer failure mode in the gate the project relies on, which seems worth a look even without a reliable repro.

Cheap mitigation, independent of the root cause

Have the summary state the denominator's provenance, so a partial run cannot be mistaken for a full one:

  • ✅ All tests passed (274 of 357 selected) for a filtered/incremental run
  • ✅ All tests passed (357/357) only when the run genuinely covered everything
  • for the cache-replay line, echo what kind of run produced the cached number

That makes the anomaly self-evident the next time it happens, and is useful on its own merits.

Environment

Windows, bash test --cpp, during a session with heavy branch switching and git worktree use (which is also relevant to #3761 — the mtime-hashed example cache). Clean-tree baseline throughout the session was consistently 357/357.

Activity

  1. zackees commented on Jul 31, 2026

    @zackees
    MemberAuthor

    Root-caused. The 274 in your report is not a truncated suite — it is a different set being counted under identical wording, and the arithmetic confirms it.

    The two denominators

    measure count
    test source files discovered by discover_test_files() (authoritative) 274
    test .dll binaries in .build/meson-quick/tests/ 274
    entries in test_list_cache.txt 274
    your clean-run baseline 357

    357 - 274 = 83 — which is exactly the "83 test binaries were not part of that number" you computed. Those 83 are the example targets. --cpp mode runs "unit tests and examples", and both feed the same ✅ All tests passed (N/N) line.

    So the headline means unit tests + examples on a run where examples executed, and unit tests only on a run where the examples fingerprint was already valid — with no wording change whatsoever. Reproduced on demand:

    $ rm .cache/fingerprint/cpp_test_quick.json     # force unit tests to actually run
    $ bash test --cpp
    ✅ All tests passed (275/275 in 48.04s)         # unit only
    $ bash test --cpp                                # replayed verbatim
    ✓ Fingerprint cache valid - skipping C++ unit tests [275/275 passed in 48.04s]
    

    versus a run where the examples also execute, which yields 357 under the same sentence.

    Your instinct was right and your hypothesis #3 was closer than the test showed. You checked .full_run_cache.json and correctly found it keyed separately — but the number in the replay line does not come from there. It comes from the fingerprint metadata for the cpp_test key (FingerprintResult.get_cache_summary(), ci/util/test_types.py), written by update_test_metadata("cpp_test", ...) at two sites in ci/util/test_runner.py. That is the slot a wrong N lands in and is then replayed as authoritative, which is the silent-wrong-answer mechanism you described.

    On the 1/1 case

    I could not reproduce that one either. bash test fltest --cpp followed by bash test --cpp did not poison the entry for me. But note the write is unguarded: neither call site checks whether a filter was active before recording the counts, so today's safety is incidental rather than structural — which is consistent with it having happened to you once under state neither of us has reconstructed.

    What I am putting up

    The mitigation you asked for, plus the structural half:

    1. FingerprintResult gains a scope field recorded alongside the counts, and both update_test_metadata call sites now declare it — "partial" whenever a filter/selection was active.
    2. get_cache_summary() renders provenance, so a narrowed result cannot render as a clean pass:
      • full: 274/274 passed in 30.47s
      • filtered: 1/1 passed in 16.98s, filtered run - NOT the full suite
      • written before this field existed: 357/357 passed in 55.20s, scope unrecorded — deliberately not silently promoted to "full"
    3. save_all() carries scope forward together with the counts it labels. Splitting them would relabel a filtered result as a full one on the very next cache hit — which would have been a fresh instance of this same bug.

    Deliberately not claiming to fix the unit-vs-examples denominator ambiguity above; that is the larger half and I would rather land the honest-labelling part first than bundle a riskier change into it. Filing that separately.

  2. zackees commented on Aug 20, 2026

    @zackees
    MemberAuthor

    Resolved by the merged provenance and breakdown work:

    The original scope/provenance bug and the later unit-vs-example denominator ambiguity are therefore both addressed.

  3. moved this from Triage to Done in FastLED Trackeron Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions