Repository navigation
fix(test): report the unit/example split so a partial run cannot read as a full pass (#3779) - #3782
Merged
Merged
Conversation
… 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]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThe 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. ChangesTest count attribution
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3779.
The ambiguity
bash test --cppcovers two populations — unit tests and example compile targets — and both fed one anonymous denominator: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
274 + 83 = 357 — the same arithmetic the issue computed independently.
The replayed cache line and the summary-table row carry the split too:
Approach
One rule: coverage must be recorded, never inferred, and no surface may claim more than was recorded.
StreamingResulttallies example artifacts separately. The split rides throughMesonTestResultinto 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.not matched by filter, nevercached— the latter asserts it was verified up to date. Replayed lines derive this from thescopefix(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..full_run_cache.jsontotals 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.pykeeps a stdlib-only mirror of the renderer — that module must not importci.*(~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 inci/tests/test_run_breakdown.py+ updatedtest_fingerprint_scope.py;bash lintclean;bash test --cppgreen (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:
_watermarksis unbound in the mixed--cppbranch (ci/util/test_runner.py) — assigned only inside theunit_onlyblock, but read in the mixed branch, sosave_full_run_resultraisesNameErrorinto a bareexcept Exception: pass..build/meson-quick/.full_run_cache.jsonis 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.test_fbuild_qemu.py::test_fbuild_test_emu_esp32devfails (FastLED.h: No such file), ~6 min runtime, and leaves untracked temp files intests/fbuild_qemu_smoke/.compile-tmp/that are not gitignored.test_meson_include_pathsreports backslash include paths for stalemeson-debug/meson-wasm-quickbuild 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, andscope="partial"already guards its replayed line.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests