Repository navigation
fix(fled): reject chromaticities that are not chromaticities (#4156 R6) - #4260
Conversation
R6's remaining half: `readXy` checked that a `video.color` primary was a two-element array of numbers and nothing else. Two properties are now required, and neither is a matter of taste. **Ordinary numbers.** A JSON literal past float range does not fail to parse here -- `as_float()` hands back an out-of-range value, and an infinite coordinate is not a chromaticity. Worth recording how that was confirmed, because the obvious probe lies: `FL_WARN` printed the value as `-21474836.48` for every over-range input, which looks like a finite number and is not. That is its own float formatter overflowing an int32; comparing against a magnitude bound in the test shows the value really is beyond 1e30. Reading the printed number would have led to the wrong conclusion. **Positive `y`.** xyY -> XYZ divides by it. At zero the primary becomes a zero column, and the profile is refused later as a singular matrix -- correct, but reported far from the field that caused it. A negative `y` is not a dimmer colour, it is not a chromaticity at all. **Deliberately not decided: the xy simplex.** Primaries outside it are imaginary, wide-gamut encodings legitimately use them, and R6 asks for that to be an explicit decision rather than the side effect of a range check. No decision exists, so a test asserts such primaries still resolve -- adding the simplex rejection fails it, which is how the open question stays open instead of being closed by accident. Mutation-tested, each against its own case. Two of those mutations initially read as survivors: removing the finite check tripped `-Werror,-Wunused-function`, the build failed, and the runner scored a stale `.so` at 37/37. Rewritten so they compile, both die correctly. Refs #4156 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 (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe custom-primary coordinate parser now rejects non-finite values and non-positive ChangesCustom primaries validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Custom color primaries with invalid numeric coordinates are now rejected safely, while supported out-of-simplex primaries remain accepted. The validation behavior is covered by tests and is ready to merge. 🚥 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 |
R6's remaining half.
readXychecked that avideo.colorprimary was a two-element array of numbers — nothing about whether the pair is a chromaticity.Two properties are now required, and neither is a matter of taste.
Ordinary numbers
A JSON literal past float range does not fail to parse here —
as_float()hands back an out-of-range value, and an infinite coordinate is not a chromaticity.Worth recording how that was confirmed, because the obvious probe lies.
FL_WARNprinted the value as-21474836.48for every over-range input:That looks like a finite number and is not — it is
FL_WARN's own float formatter overflowing an int32 (-2147483648/100). Thehugecolumn, comparing against a magnitude bound, shows the value really is beyond 1e30. Reading the printed number would have led me to conclude the check was dead code and delete it.Positive
yxyY → XYZ divides by it. At zero the primary becomes a zero column and the profile is refused later as a singular matrix — correct, but reported far from the field that caused it. A negative
yis not a dimmer colour; it is not a chromaticity at all.Deliberately not decided: the xy simplex
Primaries outside it are imaginary, wide-gamut encodings legitimately use them, and R6 says so explicitly:
No such decision exists, so a test asserts those primaries still resolve. Adding the simplex rejection fails that test — which is how the open question stays open instead of being closed as a side effect of a range check.
Mutation testing
y > 0check becomes a no-opTwo of these initially read as survivors: removing the finite check tripped
-Werror,-Wunused-function, the build failed, and the runner scored a stale.soat 37/37. Rewritten so they compile, both die correctly. Same trap as earlier in this program — a mutation that does not build is not a mutation that survived.Verification
bash test --cpp— 299/299 unit, 84/84 examplesbash lint— clean, exit 0Refs #4156
🤖 Generated with Claude Code
https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
Summary by CodeRabbit
Bug Fixes
Tests