Skip to content

docs(ci): say what the B3 guard actually covers, which is the interior (#4040) - #4330

Merged
zackees merged 1 commit into
masterfrom
docs/4040-b3-guard-scope
Sep 10, 2026
Merged

zackees merged 1 commit into
masterfrom
docs/4040-b3-guard-scope

Conversation

@zackees

@zackees zackees commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

The over-claim

ci/tests/test_no_rgb8_intermediate.py opens:

B3: the streaming path must not round-trip through RGB8.

and P6's (#4040) closure case cites a green run of it as evidence for:

Normative path: no intermediate RGB8 buffer, single final quantization (per B3 restatement)

It scans eight stage files under src/fl/gfx. It sees the pipeline's interior and stops at its edge.

What is past that edge

The handoff from the pipeline to a chipset encoder — and that is where the remaining round trip lives:

encoder fed by width
writeWS2816 makeScaledPixelRangeRGB16 16-bit
writeHD108 makeScaledPixelRangeRGB 8-bit, widened again by gamma
UCS7604 16-bit makeScaledPixelRangeRGB 8-bit, widened again by a Gamma8 LUT

ScaledPixelIteratorRGB yields array<u8, 3>. On those two parts the wide output is quantized to 8 bits and then widened — an intermediate quantization followed by an expansion, which is what B3's "single final quantization" forbids. Tracked as #4326.

Why the check is not extended here

For an 8-bit part an 8-bit handoff is the single final quantization, so the property is chipset-dependent. The rule that would catch this is "a 16-bit encoder is fed the 16-bit adapter" — not a property of the stage files at all.

Adding it would fail today on two of the three, and a red test is not a merge. It belongs with the fix, in #4326.

What changes

The docstring, and nothing else. 6 passed, 20 subtests — identical to before.

The point is narrow and worth having on its own: a green run of this file was quotable as evidence for B3 in full, and it evidences the interior. P6's closure rests partly on that line, so the record should say what was actually checked.

bash lint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

Summary by CodeRabbit

  • Documentation
    • Clarified the scope of the graphics pipeline validation.
    • Documented which pipeline stages are covered and which chipset encoder handoffs are excluded.
    • Added details about intermediate 8-bit quantization in applicable encoding paths.
    • Clarified that a successful validation run confirms only the inspected pipeline stages, not the complete encoding flow.

Its docstring opens "B3: the streaming path must not round-trip through
RGB8", and P6's (#4040) closure case cites a green run of it as evidence for
"Normative path: no intermediate RGB8 buffer, single final quantization".

It scans eight stage files under src/fl/gfx. The handoff from the pipeline to
a chipset encoder is outside that scope, and that is where the remaining
round trip is: ScaledPixelIteratorRGB yields array<u8,3>, and writeHD108 and
UCS7604's 16-bit modes are both fed by it, so the wide output is quantized to
8 bits and then widened again by a gamma LUT. writeWS2816 is the only one
taking makeScaledPixelRangeRGB16 (#4326).

For an 8-bit part an 8-bit handoff is the single final quantization, so the
rule that would catch this is "a 16-bit encoder is fed the 16-bit adapter",
which is not a property of the stage files at all. Not added here because it
fails today on two of the three; it belongs with the fix rather than as a
red test.

No check changes -- 6 passed, 20 subtests. Only the claim is narrowed, so a
green run stops being quotable as evidence for more than it looked at.

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

coderabbitai Bot commented Sep 10, 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: d815044e-ae8e-44b1-b4ce-a586425ae7d4

📥 Commits

Reviewing files that changed from the base of the PR and between a34dba9 and 435a8ed.

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

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


📝 Walkthrough

Walkthrough

The module docstring now defines the test boundary. It explains that the test covers eight pipeline-stage files but not chipset encoder handoff or the related RGB16 adapter rule.

Changes

RGB8 intermediate test scope

Layer / File(s) Summary
Document pipeline test boundaries
ci/tests/test_no_rgb8_intermediate.py
The docstring identifies the pipeline's own stages as the test scope. It documents the excluded chipset encoder handoff, intermediate 8-bit quantization, and the RGB16 adapter rule.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 435a8

This documentation-only change accurately narrows what the existing test verifies and introduces no merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the documentation change: it clarifies that the B3 guard covers the pipeline interior. It is specific and related to the main change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/4040-b3-guard-scope

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

The self-containment guard listed six of the eight per-pixel stage headers.
flux_scalar.h and source_xyz.h were covered by accident -- pipeline.h is
listed and includes both, so a break failed, blamed on pipeline.h.
transfer.h and chromatic_adaptation.h are included by no listed header and
had no coverage at all.

Measured: dropping `#include "fl/gfx/color_profile.h"` from transfer.h left
this file at 15 passed. With the four added it names the header --
FAILED ... [fl/gfx/transfer.h] -- and transfer.h is the decode stage, the
"one semantic conversion" B3 is written around.

All four are self-contained today, so this stays green at 19 rather than 15
and closes the gap instead of reporting one.

Third guard over this path with its own hand-maintained list, after #4330
(over-claimed scope) and #4335 (missed the gamut mapper). None of the three
agreed. Comment added to each pointing at the others; whether the stage set
should be declared once and imported is raised on #4337 rather than decided
here.


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

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
zackees added a commit that referenced this pull request Sep 11, 2026
#4339) (#4340)

The corpus carried srgb_bt709, display_p3 and bt2020. It did not carry
linearSrgb -- the source a channel gets when nothing else is declared, and
what #4034 s2 means by "ordinary buffers default linear". So P6's budget
evidence, "0.3951 dE2000 over all 57 corpus vectors", was measured on three
non-default sources and not on the default one.

Generated from the float64 reference, not from the implementation: added to
_source_profiles(), golden regenerated via serialize_color_reference_corpus
(285 -> 380 vectors), header regenerated via ci/color_reference_export.py
(57 -> 76 exported for the rgb device).

Nothing moved. Worst dE2000 above the floor is still 0.395096 at
display_p3-rgb-05, worst luminance error still 3.66438e-04, and the
below-floor count still 8 -- so the bounds pinned in pipeline.cpp are the
same numbers, now covering the default source. The linear transfer is the
identity decode and so was the likeliest of the four to be fine; it is.

Four other places name the source set, and all of them said so:
ValueError from the exporter, an assertion in test_color_reference_corpus,
and -Werror,-Wswitch on the C++ switch. Unlike the guard lists in #4330,
#4335 and #4337, these cannot drift undetected.

bash test --cpp: 303/303 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 added a commit that referenced this pull request Sep 11, 2026
)

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.


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

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
zackees added a commit that referenced this pull request Sep 11, 2026
…4352)

* test(ci): pin the named source spaces against the standards (#4351)

src/fl/gfx/color_profile.h hard-codes the chromaticities for sRGB/BT.709,
Display P3 and BT.2020. ci/color_reference.py and
ci/color_reference_corpus.py hard-code them again, and the golden corpus --
what P6's dE budget is measured against -- is generated from those copies.
Nothing checked the two agree.

Worse than the guard drift in #4330, #4335 and #4337, where the failure was a
check that stopped covering something. A divergence here would not fail at
all: both sides stay internally consistent, the corpus is generated for one
set of primaries, the pipeline renders with another, and pipeline.cpp goes on
reporting 0.395096 dE2000 inside A1's 0.5. A wrong reference that passes its
own budget is harder to notice than a guard that never fires.

They agree today, so this guards against drift rather than fixing a defect.

Pinned against the standards rather than against each other -- IEC 61966-2-1
/ BT.709-6, SMPTE RP 431-2 with a D65 white, BT.2020-2 -- because #4034 calls
these names a registry owned by the canonical ledmapper spec. Checking the
two copies match would pass if both were "fixed" in the same wrong direction;
checking both against the published values does not.

Verified by perturbing each copy independently: the C++ Display P3 green
fails SUBFAILED(space='displayP3()'), the Python BT.2020 blue fails
SUBFAILED(space='bt2020').

The header parser anchors on each `constexpr` declaration and reads forward,
because the values sit on the return line below it and every one of those
lines also mentions d65() -- matching on the name alone finds whichever
definition comes first in the file.

bash lint clean.

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

* test(ci): check the reference's white point, and follow the house style

Three review points, all backed by rules I should have checked first.

The white-point one was a real hole: the corpus writes its white as the bare
name `d65`, which the chromaticity regex never sees, so the test compared
three primaries and silently skipped the fourth. Widening the slice would
have captured the next profile's red primary rather than a white. It now
checks `_D65`'s value directly and requires each profile's fourth
RgbPrimaries argument to be that alias.

Also: explicit loop over a list comprehension (.cursorrules:777) and `self`
annotated (.cursorrules:825, "ALL function parameters ... NO EXCEPTIONS",
and the house style in test_no_rgb8_intermediate.py).

Verified by mutation, which took three attempts to do honestly:

  - my first edit used str.replace with no `assert count == 1` and silently
    did nothing, so the new assertions were never added and both mutations
    "passed";
  - the second anchor missed because `bash lint` had reformatted the slice to
    `[... ) :]`;
  - the third run reported a stale value because __pycache__ still held the
    mutated module.

With the cache cleared, perturbing `_D65` fails the alias check and replacing
the corpus white with a literal fails SUBFAILED(space='display_p3').

bash lint clean; 3 passed, 5 subtests.

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

* test(ci): match the whole fourth argument, not a substring of it

assertIn("d65", white_arg) accepts wrong_d65, not_d65 and anything else
containing those three characters. A substring test is the wrong tool in a
check whose entire job is catching a wrong value, and this file reads the
corpus as text, so there is nothing else standing between it and a renamed
alias.

The slice now stops before the constructor's closing paren and the argument
is matched whole against `^\s*,\s*d65\s*,?\s*$`.

Verified with the mutation the old form could not see: replacing the
display_p3 white with `wrong_d65` now fails SUBFAILED(space='display_p3').

Caught by CodeRabbit on #4352.

bash lint clean; 3 passed, 5 subtests.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@zackees
zackees deleted the docs/4040-b3-guard-scope branch November 5, 2026 05:52
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