Skip to content

fix(test): report the unit/example split so a partial run cannot read as a full pass (#3779) - #3782

Merged
zackees merged 1 commit into
masterfrom
fix/3779-test-count-breakdown
Jul 31, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/3779-test-count-breakdown

Conversation

@zackees

@zackees zackees commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Fixes #3779.

The ambiguity

bash test --cpp covers two populations — unit tests and example compile targets — and both fed one anonymous denominator:

All tests passed (357/357 in 48.00s)   <- unit + examples
All tests passed (274/274 in 30.49s)   <- unit only, examples cached

Byte-identical wording, so a reader could not tell "274 unit tests, examples already cached" from "274 of the 357 things I expected". #3778 fixed the labelling half of #3763; this is the denominator half.

After

All tests passed (274/274 unit, 83/83 examples in 87.21s)
All tests passed (274/274 unit in 14.69s; examples cached, not re-run)
All tests passed (274/274 unit in 33.81s; examples not requested)

274 + 83 = 357 — the same arithmetic the issue computed independently.

The replayed cache line and the summary-table row carry the split too:

Fingerprint cache valid - skipping C++ unit tests [274/274 unit, 83/83 examples passed in 95.91s]
cpp_unit_tests (274/274 unit, 83/83 examples passed in 95.91s) | skipped

Approach

One rule: coverage must be recorded, never inferred, and no surface may claim more than was recorded.

  • StreamingResult tallies example artifacts separately. The split rides through MesonTestResult into the fingerprint JSON and back out.
  • describe_test_counts() is the single renderer for every surface — headline, failure headline, summary row, replayed cache line. It models three levels of knowledge: full split; populations-only (the driver reports one suite-wide number); nothing recorded. Previously each surface repeated its own guard and fallback wording, which is how one run came to be described two different ways in a single terminal output.
  • A population that ran nothing under a filter is reported as not matched by filter, never cached — the latter asserts it was verified up to date. Replayed lines derive this from the scope fix(test): record scope provenance so a partial run cannot read as a full pass (#3763) #3778 already records, so no new field.
  • examples_are_included() reads the exclusion list rather than guessing, and accepts both the bare and project-qualified suite spellings the driver allows.
  • The ultra-early-exit fast path reports .full_run_cache.json totals as split-unrecorded: that file stores no attribution, and the reader's own flags describe the reader, not the run that wrote the entry.
  • is_example_artifact() is now the single discriminator for both counting and runner selection, phrased so an unclassifiable artifact cannot inflate the unit denominator.

ci/early_exit_cache.py keeps a stdlib-only mirror of the renderer — that module must not import ci.* (~62ms on a ~2ms path). A parity test pins the two across the full attribution state space including the filtered axis; it caught two real drifts while this branch was being written.

Verification

End-to-end on all reporting surfaces: clean --cpp, replayed cache hit, --unit, filtered run, and the all-cached early exit. 41 tests in ci/tests/test_run_breakdown.py + updated test_fingerprint_scope.py; bash lint clean; bash test --cpp green (274 unit + 83 examples).

Not in scope — pre-existing, confirmed on clean master

Three issues found while validating, all reproduced on an unmodified tree. None are touched here:

  1. _watermarks is unbound in the mixed --cpp branch (ci/util/test_runner.py) — assigned only inside the unit_only block, but read in the mixed branch, so save_full_run_result raises NameError into a bare except Exception: pass. .build/meson-quick/.full_run_cache.json is consequently never created by a fresh run, and the CASE 2 ultra-early exit that file exists for can never fire. Worth its own issue — I can file it.
  2. test_fbuild_qemu.py::test_fbuild_test_emu_esp32dev fails (FastLED.h: No such file), ~6 min runtime, and leaves untracked temp files in tests/fbuild_qemu_smoke/.compile-tmp/ that are not gitignored.
  3. test_meson_include_paths reports backslash include paths for stale meson-debug / meson-wasm-quick build dirs.

Also left alone deliberately: the single-named-test path still prints 1/1 — the user named the test, so it cannot masquerade as full-suite coverage, and scope="partial" already guards its replayed line.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Test results now clearly separate unit-test and example-test counts.
    • Reports indicate whether examples were included, excluded, filtered, cached, or not recorded.
    • Cached results preserve example-test counts and coverage details across runs.
  • Bug Fixes

    • Corrected result summaries that could incorrectly present partial or incomplete coverage as a full pass.
    • Improved consistency between live, cached, early-exit, and failure reports.
  • Tests

    • Added comprehensive coverage for test-count attribution, caching, filtering, suite exclusions, and legacy results.

… as a full pass (#3779)

`bash test --cpp` runs two populations -- unit tests and example compile
targets -- and both fed one anonymous denominator:

    All tests passed (357/357 in 48.00s)   <- unit + examples
    All tests passed (274/274 in 30.49s)   <- unit only, examples cached

The wording was byte-identical, so a reader could not tell "274 unit tests,
examples already cached" from "274 of the 357 things I expected". #3778 fixed
the labelling half of #3763; this is the denominator half.

Now:

    All tests passed (274/274 unit, 83/83 examples in 87.21s)
    All tests passed (274/274 unit in 14.69s; examples cached, not re-run)
    All tests passed (274/274 unit in 33.81s; examples not requested)

274 + 83 = 357, matching the arithmetic in the issue.

The rule throughout is that coverage must be *recorded*, never inferred, and
no surface may claim more than was recorded:

- `StreamingResult` tallies example artifacts separately; the split rides
  through `MesonTestResult` into the fingerprint JSON and back out, so the
  replayed cache line and the summary-table row carry it too.
- `describe_test_counts()` is the single renderer for every surface --
  headline, failure headline, summary row, replayed cache line -- so one run
  can no longer be described two different ways in one terminal output. It
  models three levels of knowledge: full split, populations-only (the test
  driver reports one suite-wide number), and nothing recorded.
- A population that ran nothing under a name/file filter is reported as "not
  matched by filter", never "cached" -- the latter asserts it was verified up
  to date. Replayed lines derive this from the scope #3778 already records.
- `examples_are_included()` reads the exclusion list rather than guessing, and
  accepts both the bare and project-qualified suite spellings the test driver
  allows; matching only one would claim examples ran when they were excluded.
- The ultra-early-exit fast path reports `.full_run_cache.json` totals as
  split-unrecorded: that file stores no attribution, and the reader's own
  flags describe the reader, not the run that wrote the entry.
- `is_example_artifact()` is now the single discriminator for both counting
  and runner selection, so the two cannot disagree, and is phrased so an
  unclassifiable artifact cannot inflate the unit denominator.

`ci/early_exit_cache.py` keeps a stdlib-only mirror of the renderer (it must
not import ci.*; that costs ~62ms on a ~2ms path). A parity test pins the two
across the full attribution state space, including the filtered axis.

Verified end-to-end: clean `--cpp`, replayed cache hit, `--unit`, and the
all-cached early exit all report consistently. 41 tests, `bash lint` clean.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 64d5a04a-2419-46a2-8554-19343f60caff

📥 Commits

Reviewing files that changed from the base of the PR and between 8f43bd1 and 38ac81a.

📒 Files selected for processing (9)
  • ci/early_exit_cache.py
  • ci/meson/streaming.py
  • ci/meson/streaming_runner.py
  • ci/meson/test_execution.py
  • ci/tests/test_fingerprint_scope.py
  • ci/tests/test_run_breakdown.py
  • ci/util/fingerprint.py
  • ci/util/test_runner.py
  • ci/util/test_types.py

📝 Walkthrough

Walkthrough

The PR adds separate unit and example test counts to Meson results, fingerprints, cache summaries, timing labels, and early-exit output. It also handles cached, filtered, excluded, partial, and legacy results with explicit scope wording.

Changes

Test count attribution

Layer / File(s) Summary
Central count breakdown
ci/util/test_types.py
Adds centralized formatting for unit/example counts, cached populations, filtered runs, and unrecorded splits. FingerprintResult stores optional example metadata.
Meson example attribution
ci/meson/test_execution.py, ci/meson/streaming.py, ci/meson/streaming_runner.py
Classifies example artifacts, determines example inclusion, aggregates example pass/failure counts, and includes separate metrics in Meson results and messages.
Metadata persistence and reporting
ci/util/fingerprint.py, ci/util/test_runner.py, ci/early_exit_cache.py
Persists example metadata and uses split-aware descriptions in timing labels, cache summaries, and early-exit output.
Attribution and compatibility tests
ci/tests/test_run_breakdown.py, ci/tests/test_fingerprint_scope.py
Tests count formatting, cache persistence, suite exclusions, partial attribution, legacy metadata, streaming results, and early-exit consistency.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

  • #3779 — Adds explicit unit/example denominators and cache wording for the ambiguity described in this issue.
  • #3763 — Distinguishes full, partial, cached, and unrecorded test populations in summaries and cache output.

Possibly related PRs

  • FastLED/FastLED#3778 — Extends the same fingerprint scope and cache-summary handling with unit/example count attribution.
  • FastLED/FastLED#3739 — Shares changes to test-cache metadata and persistence paths, including test_runner.py, fingerprint.py, and test_types.py.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.10% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: reporting the unit/example split to prevent partial runs from appearing as full passes.
Linked Issues check ✅ Passed The changes satisfy #3779 by recording and reporting separate unit and example counts across runs, failures, summaries, and cache replays.
Out of Scope Changes check ✅ Passed The implementation and tests remain within the linked issue scope of clarifying unit and example test-count attribution.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/3779-test-count-breakdown

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.

@zackees
zackees merged commit a49da1c into master Jul 31, 2026
10 of 13 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 31, 2026
@zackees
zackees deleted the fix/3779-test-count-breakdown branch July 31, 2026 18:31
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: 'All tests passed (N/N)' counts unit-only or unit+examples depending on cache state, with identical wording

1 participant