Skip to content

test(ci): make the per-pixel stage lists check each other (#4337) - #4341

Merged
zackees merged 1 commit into
masterfrom
test/4337-stage-lists-agree
Sep 11, 2026
Merged

zackees merged 1 commit into
masterfrom
test/4337-stage-lists-agree

Conversation

@zackees

@zackees zackees commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Addresses the cheap half of #4337. The structural question there stays open.

Why

Three guards scan the same eight-stage per-pixel path, each with its own hand-maintained list, and all three drifted independently:

failure
#4330 claimed to cover "the streaming path"; covered the pipeline's interior
#4335 scanned five of eight — missing gamut_map.cpp.hpp, the one stage A3 is about and the only place anyone would put an iterative solver
#4337 listed six of eight headers; transfer.h and chromatic_adaptation.h compiled nowhere on their own

Each list was defensible read alone. The gaps only appeared reading them side by side, which nothing did — a guard's list was itself a thing nothing checked.

What this adds

Three assertions, no restructuring:

  • the two PER_PIXEL_STAGES tuples are identical
  • every scanned stage file exists
  • each stage's header is on the self-containment list

Verified by replaying both regressions

replayed caught by
drop gamut_map.cpp.hpp from the solver guard (#4335) test_the_two_stage_scanners_cover_the_same_files
drop fl/gfx/transfer.h from self-containment (#4337) SUBFAILED(stage='transfer.cpp.hpp', header='fl/gfx/transfer.h')

Both would now fail at the point of drift.

Why this shape and not the shared module

#4339 is the argument. The P5 corpus names its source set in five places, and when I added one, every copy that could object did — a ValueError from the exporter, an assertion in the corpus test, and -Werror,-Wswitch on the C++ switch. Same duplication as here; opposite outcome. The difference is not the number of copies, it is that each one fails loudly.

So this gives the guard lists that property and stops there. Declaring the stage set once and importing it is strictly better, is still an open question on #4337, and is not blocked by this — the next divergence just isn't free any more. I'd rather not restructure three guards on my own reading of a question I asked.

One implementation note

The loader registers each module in sys.modules before exec_module. The self-containment guard decorates with typeguard's @typechecked, which reads its own module source out of sys.modules while the decorator runs — registering afterwards gives KeyError.

bash lint clean. The four guards together: 30 passed, 68 subtests. New file only; no changes to the guards themselves.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

Summary by CodeRabbit

  • Tests
    • Added automated coverage to verify consistency among per-pixel stage validation checks.
    • Confirmed that all scanned stage files exist and that their headers are included in self-containment validation.

Three guards scan the same eight-stage path, each with its own
hand-maintained list, and all three drifted independently: #4330 claimed a
scope it did not cover, #4335 scanned five of eight and missed the gamut
mapper -- the one stage A3 is about -- and #4337 listed six of eight headers,
two of which compiled nowhere on their own. Each was defensible read alone.
The gaps only showed up reading them side by side, which nothing did.

This asserts they agree: the two PER_PIXEL_STAGES tuples are identical, every
scanned stage file exists, and each stage's header is on the
self-containment list.

Deliberately not the structural fix. Declaring the stage set once and
importing it is better and is still an open question on #4337; this does not
block it, it just stops the next divergence being free. #4339 is the argument
for the shape: the reference corpus names its source set in five places and
every copy fails loudly when the set changes, which is why that duplication
never rotted while these did.

Verified by replaying both regressions -- dropping gamut_map.cpp.hpp from the
solver guard fails the equality case, and dropping fl/gfx/transfer.h fails
with SUBFAILED(stage='transfer.cpp.hpp', header='fl/gfx/transfer.h').

The loader registers each module in sys.modules before exec_module, because
the self-containment guard decorates with typeguard's @TypeChecked, which
reads its own module source from sys.modules while the decorator runs.

bash lint clean; the four guards together: 30 passed, 68 subtests.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Review Change StackReview 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: Advanced

Run ID: af6729a5-97c9-4dda-91f8-be7fed8c34e0

📥 Commits

Reviewing files that changed from the base of the PR and between 2a3b20f and f3e9dab.

📒 Files selected for processing (1)
  • ci/tests/test_per_pixel_stage_lists_agree.py

Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The pull request adds a unittest module that loads three guard modules and checks that their per-pixel stage lists agree, scanned files exist, and all stage headers appear in the self-containment list.

Changes

Per-pixel stage consistency

Layer / File(s) Summary
Guard module loading
ci/tests/test_per_pixel_stage_lists_agree.py
Adds a helper that loads sibling guard modules by file path and registers them in sys.modules before execution.
Stage list assertions
ci/tests/test_per_pixel_stage_lists_agree.py
Checks stage-list equality, stage-file existence, and self-containment header registration. Adds a guarded unittest.main() entry point.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~15 minutes

Merge Risk: ⚪ Minimal · up to f3e9d

The new CI checks validate the intended guard-list consistency without leaving a concrete unresolved merge risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. 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 and concisely describes the main change: adding CI checks that compare the per-pixel stage lists.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ 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 test/4337-stage-lists-agree

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 4e3f93f into master Sep 11, 2026
27 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Sep 11, 2026
zackees added a commit that referenced this pull request Sep 11, 2026
…#4349)

D1 asks callers to use "checked, explicit mapping rather than casting between
enums" for fl::fled::PixelFormat -> fl::PixelFormat. toPixelStorage() did
that, and then swept four of the six wire formats into `default: return
false`. The mapping was checked; nothing checked the mapping was complete.

Gray8, Rgba8, Rgbw8 and Rgb565Le are now listed explicitly, so they read as
known-and-unmapped rather than possibly-forgotten, and a seventh wire format
is a compile error naming this function instead of a silent false found at
playback.

Verified: adding a probe enumerator gives
  error: enumeration value 'MutProbe' not handled in switch [-Werror,-Wswitch]
against src/fl/fled/detail/pixel_format.cpp.hpp:24. Before, it compiled.

bytesPerLed() keeps its default deliberately -- it takes a raw wire byte, not
the enum, so it must answer for values that are not enumerators at all.

Same lesson as #4340, where a SourceKind switch with no default caught an
added source at compile time, and #4341, where three guard lists that could
drift silently were made to check each other.

bash test --cpp --clean: 304/304 unit, 84/84 examples. bash lint clean.


Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@zackees
zackees deleted the test/4337-stage-lists-agree branch November 5, 2026 05:53
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.

1 participant