Skip to content

Two per-pixel stage headers have no self-containment coverage: transfer.h and chromatic_adaptation.h #4337

Closed

Description

@zackees

ci/tests/test_fixed_point_headers_are_self_contained.py compiles each listed header as a translation unit's only include. Its list names six of the eight per-pixel stage headers, omitting transfer.h, source_xyz.h, chromatic_adaptation.h and flux_scalar.h.

Two of those four had coverage anyway, by accident: pipeline.h is on the list and includes flux_scalar.h and source_xyz.h, so breaking either fails — attributed to pipeline.h rather than to the header at fault, but it fails.

transfer.h and chromatic_adaptation.h are included by no listed header. They had no coverage at all.

Measured

Removing #include "fl/gfx/color_profile.h" from transfer.h, leaving it dependent on an include it does not make:

$ uv run pytest ci/tests/test_fixed_point_headers_are_self_contained.py -q
15 passed

Silent. With the four added:

FAILED test_header_compiles_as_the_only_include[fl/gfx/transfer.h]
1 failed, 18 passed

All four are self-contained today, so adding them keeps the suite green — 19 tests instead of 15 — and closes the gap rather than reporting one.

transfer.h matters more than its size suggests: it is the decode stage, the "one semantic conversion" B3 is written around, and the only stage whose correctness the reference corpus checks numerically.

Third of a kind

Three structural guards over the same per-pixel path, each with a different list, none agreeing. The lists are maintained by hand and drift independently; a guard's list is itself the thing nothing checks.

Worth considering whether the stage set should be declared once and imported by all three, so adding a stage cannot silently skip a guard. That is a larger change than any of the three fixes and is offered as a question, not a plan.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

Activity

  1. moved this from Triage to Done in FastLED Trackeron Sep 11, 2026
  2. zackees commented on Sep 11, 2026

    @zackees
    MemberAuthor

    Doing the cheap half, and leaving the structural question open (#4341)

    I raised "declare the stage set once and import it" here as a question rather than a plan, and it still is. But there is a smaller move that gets most of the protection without imposing a structure, and #4339 is the argument for it.

    That issue added a source profile to the P5 corpus. Five places name the source set there — generator, exporter, a set literal in a test, a generated enum, a C++ switch — and every one that could object, did:

    ValueError: linear_srgb-rgb-00 names an unknown source linear_srgb
    AssertionError  (allowed-set assertion)
    error: enumeration value 'LinearSrgb' not handled in switch [-Werror,-Wswitch]
    

    Same shape of duplication as the three guard lists here. Opposite outcome, and the reason is not that there are fewer copies — it is that each copy fails loudly when the set changes. The guard lists had no such property, which is why #4330, #4335 and #4337 each sat undetected.

    So #4341 gives the guard lists that property and nothing more: a test asserting the two PER_PIXEL_STAGES tuples are identical, that every scanned stage file exists, and that each stage's header is on the self-containment list. No shared module, no restructuring of the three files.

    Verified by replaying both historical regressions:

    replayed caught by
    drop gamut_map.cpp.hpp from the solver guard (#4335) test_the_two_stage_scanners_cover_the_same_files
    drop fl/gfx/transfer.h from self-containment (#4337) SUBFAILED(stage='transfer.cpp.hpp', header='fl/gfx/transfer.h')

    Both would now fail at the point of drift rather than waiting to be read side by side.

    The structural question is still yours. A shared stage module is strictly better than three lists that check each other, and this does not block it — it just means the next divergence is not free. I would rather not restructure three guards on my own reading of a question I asked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions