Skip to content

fix(test): do not mark unexecuted fingerprint scopes successful #4550

Closed

Description

@zackees

Problem

FastLED's test entry point checks fingerprints for every scope up front, then calls FingerprintManager.save_all(status) once at the end. That stamps every checked scope with the invocation's final status, including scopes that the selected command never executed.

For example:

  1. Change inputs covered by the C++ and Python fingerprints.
  2. Run bash test --py.
  3. test.py checks all, cpp, examples, python, and wasm fingerprints while planning the run.
  4. Only Python tests execute.
  5. The final save_all("success") writes success for every fingerprint collected during planning.
  6. A subsequent bash test --cpp can report that there is nothing to run even though no C++ build/test validated the changed inputs.

This caused a false-green incremental result while validating #4528; a forced clean combined rebuild then compiled all affected targets.

Relevant code:

  • test.py:448-494: constructs the manager and checks all scopes during planning.
  • test.py:745: applies one final status through save_all(status).
  • ci/util/fingerprint.py:141-180: check() records calculated scopes and save_all() marks every recorded scope with the same status.

Ownership

FastLED should fix its call pattern so only operations that actually ran can receive a new success stamp. The zccache API could also be hardened against this class of misuse; that upstream discussion is tracked in forge-ci/zccache#1650.

This issue is intentionally local/actionable even if upstream changes: callers must not certify work they did not execute.

Suggested direction

Track scope execution separately from scope checking/planning, then persist status only for executed scopes. Cache hits may preserve prior successful metadata, but must not advance or replace a scope's validation record because an unrelated scope passed.

Avoid treating a global process exit code as evidence for every planned fingerprint.

Acceptance criteria

  • Add a regression that changes both Python- and C++-covered inputs, runs the Python-only path, then proves the C++ path still requires execution.
  • Add the inverse/mixed-scope coverage needed to prevent one selected test mode from certifying another.
  • A failed selected scope must not overwrite unrelated scopes' last-known-good records.
  • Existing legitimate cache hits keep their prior metadata and remain skippable.
  • bash test --py, bash test --cpp, and the fingerprint-focused CI tests pass.
  • Documentation distinguishes "checked/planned," "executed," and "persisted successful" scopes.

Reproduction evidence

The behavior was reproduced directly through the manager lifecycle and in the real command sequence during #4528 validation. The clean native gate subsequently passed 311/311 unit suites and 95/95 host examples, confirming the initial "nothing to run" result was a bookkeeping false green rather than proof those targets had run.

Activity

  1. zackees commented on Sep 24, 2026

    @zackees
    MemberAuthor

    Investigation: this is a selective-persistence bug, not a missing database dimension.

    The test entry point already stores separate JSON records in .cache/fingerprint/: cpp_test_<build_mode>.json, examples_<build_mode>.json, python_test.json, wasm.json, and all.json (ci/util/fingerprint.py::_get_fingerprint_file). C++ and example records also separate quick/debug/release modes. Lint has separate cpp_lint.json and python_lint.json through TwoLayerFingerprintCache; each lint stage checks and marks its own record. There is no shared test/lint success bit that requires a consolidated DB.

    The failure is that test.py checks all five test records during planning, while FingerprintManager.check() (and the mtime fast path) put every checked value in _fingerprints. The final save_all(status) then rewrites every one with the invocation status. Thus bash test --py can certify changed C++/examples/WASM inputs; a failed Python run can also mark unrelated good scopes failed. The separate files already contain the right granularity, but the write path discards it.

    Recommended local fix:

    1. Replace save_all(status) at the test entry point with explicit per-scope completion/commit. Checking a fingerprint means only "planned"; a successful record should be written only after its corresponding full scope actually completed successfully. On a cache hit, leave the previous successful file untouched (including metadata and the start-of-run mtime watermark). If the invocation fails, do not rewrite unrelated scopes. A failed executed scope may be recorded as failed, or its prior record may be left intact if the changed hash still forces a retry.
    2. Attribute C++/example coverage from the actual runner path. --unit validates C++ unit tests, --examples validates examples, and --cpp can validate both through Meson; do not infer example success merely because the C++ process was selected. The --full process-group path also needs explicit completion reporting. Keep the existing guard against persisting filtered test/example runs as full coverage.
    3. Treat all.json as a derived/default-run summary or remove it from the no-argument early-exit prerequisite. There is no all operation in the active normal runner to commit independently. The no-argument early exit in ci/early_exit_cache.py currently checks all, C++, examples, and Python but reports WASM skipped without checking wasm.json; include a validated WASM record in that gate. Avoid refreshing any record on a skipped run.
    4. Invalidate/version the existing test fingerprint success records when shipping the fix, because records written by the old save_all may already claim work that never ran. Add cross-mode regressions: changed Python + C++ inputs followed by --py must still require --cpp; test the inverse and WASM/examples; failures and cache hits must leave unrelated records intact.

    No new combined fingerprint database or sophisticated change-measurement scheme is needed for #4550. Shared src/ hashing is already memoized per process in ci/util/test_types.py::_hash_directory; measuring only selected scopes could be a separate performance cleanup. The minimal correctness change is to stop using blanket save_all and commit only the scopes proven by completed work.

  2. added a commit that references this issue on Sep 24, 2026
    6e9a0ef
  3. moved this from Triage to Done in FastLED Trackeron Sep 24, 2026
  4. added a commit that references this issue on Sep 24, 2026
    26c6046
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