Repository navigation
test(color): pin C5's dither exclusion where it can actually be measured (#4042) - #4394
Merged
Merged
Conversation
…red (#4042) C5 says pipeline dithering and BINARY_DITHER are mutually exclusive per channel. `setColorProfile` enforces half of it by setting DISABLE_DITHER, but `mDitherMode` is a public field rather than a setter -- unlike `setLegacyCorrection`, which clears the profile and warns -- so a caller can re-enable it after binding and reach the forbidden combination through the type system. What makes that harmless is structural, and this file's own header already says why: the managed source reads `mController.mData` rather than `loadAndScale0/1/2`, because those fold in `mColorAdjustment` whose `premixed` carries brightness the pipeline also carries. Legacy dithering lives inside those same calls, so bypassing them for the brightness reason excludes the dither as a consequence. Getting a test that can fail took three attempts, and the two that did not are worth recording because each looked convincing. Through `Channel::showLeds`, counting distinct emitted bytes over a cycle: the managed channel held one value and the unbound one varied, which reads as the exclusion working. Routing the managed source through the dithering path did not change it, at two source values and two brightnesses -- so the measurement could not tell "the managed path ignores dither" from "dither was never armed here". At this level with the 8-bit entry point: same problem for a different reason. A dither-scale change in the pipeline's input is smaller than the output's quantum, so the byte is identical whether the read is right or wrong. The 16-bit entry point has 256x the resolution and does move. Mutating `loadAndScaleRGB16` to read the dithered value now fails this case, which is the first version of it that could. The legacy controller beside it varies across the cycle, so the assertion is about the managed path rather than about a harness that never dithers. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a test for ChangesDithering behavior validation
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Other ✨ Finishing Touches📝 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.
Part of #4034 P8 (#4042). Pins C5: "Pipeline dithering and
BINARY_DITHERare mutually exclusive per channel."The gap this covers
ChannelOptions::setColorProfileenforces half of C5 by settingDISABLE_DITHER. ButmDitherModeis a public field, not a setter — unlikesetLegacyCorrection, which clears the profile and warns — so nothing stops:What makes that harmless is structural, and this file's own header already explains it: the managed source reads
mController.mDatarather thanloadAndScale0/1/2, because those fold inmColorAdjustmentwhosepremixedcarries brightness the pipeline also carries. Legacy dithering lives inside those same calls, so bypassing them for the brightness reason excludes the dither as a consequence.That is worth a test precisely because it is incidental — nothing declares it, so nothing would notice it changing.
Three attempts, and why two failed
Both failures passed cleanly and looked convincing, which is the point of recording them.
Channel::showLeds, counting distinct emitted bytes over a cycle: managed held one value, unbound varied. Routing the managed source through the dithering path did not change it — at two source values and two brightnesses. So it could not distinguish "the managed path ignores dither" from "dither was never armed in this harness". I reverted that one and reported it on this issue rather than banking it.loadAndScaleRGB16to read the dithered value now fails this case — the first version that could.Vacuity guard
A legacy
PixelControllerwith identical settings runs beside it and does vary across the cycle, so the assertion is about the managed path rather than about a harness that never dithers anything.bash lintclean; 305/305 unit, 84/84 examples.Test-only; no
src/change.🤖 Generated with Claude Code
https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
Summary by CodeRabbit