Skip to content

test(ci): rgbww two-white premise is false on master, and the test checks the wrong proxy #4357

Closed

Description

@zackees

ci/tests/test_color_rgbw_study.py::TestTwoWhitesNeedMoreThanOne::test_the_corpus_never_lights_both_whites fails on master:

both = 0
for vector in corpus_vectors("rgbww"):
    light = vector.emitter_light
    if light[3] > 1e-12 and light[4] > 1e-12:
        both += 1
self.assertEqual(both, 0)
E   AssertionError: 1 != 0

Bisected to 999304d (#4340, "put the default source profile in the P5 reference corpus") — mine, merged earlier today. It passes at 999304d25c^. That commit added a source-profile pass over the corpus inputs, growing each device from 57 vectors to 76, and one of the new plain-rgbww vectors lights both whites.

It is not just a stale count

The obvious patch — relax the assertion — would paper over a premise that has actually become false. The test's stated reason for existing is:

Every rgbww vector the reference solves uses at most one of the two white emitters. Agreement with a one-white-at-a-time reduction over this corpus therefore says nothing at all, which is the trap the test below exists to keep open.

Measured against the checked-in corpus, the new vector does not merely light both whites — it needs both. The reference's drives total 0.879408 across the two whites, and the best single white reaches only 0.850005. So the premise is genuinely broken, not just the proxy.

And "lights both" was the wrong proxy from the start: the reference may split a total across two usable whites without needing either, so the old assertion could have gone false without the premise changing at all — and, as it happens, could have stayed true while the premise broke.

The same stale claim also appears in TestTwoWhiteCorpusVectors's class docstring ("Every rgbww vector is reachable with one white or none").

What is worth keeping

The trap itself is still real and still worth recording: with every emitter at unit luminance the rgbww device is roughly five times brighter than the white it renders, so 1 of its 34 white-using vectors discriminates. That is nowhere near enough to measure an allocation against — one vector cannot separate a correct two-white allocation from one that simply fills the first white first, which is exactly why rgbww_two_white (19 of 76 needing both) was added in #4237.

Proposed

Restate the test as what it means — needs both, via best_single_white, rather than lights both — and make it two-sided: at least one such vector (so the measurement cannot go vacuous behind a best_single_white that always succeeds) and fewer than a tenth of the white-using vectors (so the device cannot quietly become the two-white test by accident). Fix the matching docstring.

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