Repository navigation
test(ci): make the per-pixel stage lists check each other (#4337) - #4341
Conversation
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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe 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. ChangesPer-pixel stage consistency
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Merge Risk: ⚪ Minimal · up to 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)
✅ 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 |
…#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]>
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:
gamut_map.cpp.hpp, the one stage A3 is about and the only place anyone would put an iterative solvertransfer.handchromatic_adaptation.hcompiled nowhere on their ownEach 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:
PER_PIXEL_STAGEStuples are identicalVerified by replaying both regressions
gamut_map.cpp.hppfrom the solver guard (#4335)test_the_two_stage_scanners_cover_the_same_filesfl/gfx/transfer.hfrom 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
ValueErrorfrom the exporter, an assertion in the corpus test, and-Werror,-Wswitchon 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.modulesbeforeexec_module. The self-containment guard decorates with typeguard's@typechecked, which reads its own module source out ofsys.moduleswhile the decorator runs — registering afterwards givesKeyError.bash lintclean. 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