Repository navigation
fix(color): refuse a declared source space that cannot be built (#4156 R6) - #4258
Conversation
…R6)
`build_rgb_colorimetric_cache` computed
has_source_space = (input_xy_w[1] > 1e-6f) && build_source_matrix(...)
which folds two different answers into one. "No source space declared" and "a
source space was declared and is unusable" both left `has_source_space` false,
and false means #2705's legacy mode: the caller's RGB triple *is* the device
drive triple.
So a profile with degenerate custom primaries -- collinear, or a zero `y` --
did not fail. It silently switched interpretation, and the sketch rendered a
different colour from primaries it believed were in effect, with nothing said.
#4156 R6 names this: a near-singular transform needs deterministic
rejection, not an arbitrary fallback that destroys the accuracy promise.
The two states are now distinct, and the builder returns false for the second.
Three tests pin all three outcomes, because collapsing this in either
direction is a silent behaviour change:
* declared and unusable -> refused;
* not declared at all -> still fine, since that is a supported mode rather
than a degenerate profile, and the check must not swallow it;
* declared and usable -> still builds, so the rejection cannot degrade into
"refuse every declared source space".
Safe to tighten the contract: no caller in `src/` uses this yet -- the Q16
path goes through `buildRgbSolveMatrixQ16` -- and the existing tests assert
true for profiles that stay true.
Mutation-tested both ways: restoring the fold fails the rejection case, and
rejecting every declared space fails the usable case.
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; 3 remain after this review. 📝 WalkthroughWalkthrough
ChangesRGB source-space validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Declared but unusable RGB source spaces now fail cache construction instead of falling back to drive coordinates, while profiles with no declared source space and valid declared spaces retain their intended behavior. No current merge-blocking risk remains. 🚥 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 |
build_rgb_colorimetric_cachecomputed:which folds two different answers into one. "No source space declared" and "a source space was declared and is unusable" both left
has_source_spacefalse — and false means #2705's legacy mode: the caller's RGB triple is the device drive triple.So a profile with degenerate custom primaries — collinear, or a zero
y— did not fail. It silently switched interpretation, and the sketch rendered a different colour from primaries it believed were in effect, with nothing said.#4156 R6 names exactly this:
The fix
The two states are now distinct and the builder returns false for the second.
Three tests pin all three outcomes, because collapsing this in either direction is a silent behaviour change:
input_xy_w[1] == 0)Safe to tighten the contract
No caller in
src/uses this yet — the Q16 path goes throughbuildRgbSolveMatrixQ16— and the existing tests assert true for profiles that stay true.Mutation testing
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