test(formats): invert the primitives tripwire to pin the fix (#38, option A)
All checks were successful
CI / Native — linux (pull_request) Successful in 2h0m48s
CI / WASM — Web (pull_request) Successful in 30m51s
CI / Formatting (pull_request) Successful in 1m16s

`the_derived_order_puts_primitives_last_and_that_wipes_screens` asserted that
switching primitives on still flattened at least one screen (`wiped_on > 0`),
and said to turn `include_primitives` on by default the day it stopped.
`53f8345` made that day arrive — a keyless primitive that would hide the screen
is now forced to paint first — and the wire had been red since 2026-08-29,
invisible to CI because the runner has no corpus and the suite self-skips.

#38 chose option A: keep the default off, and pin the fix instead. The flatness
proxy stood in for "paint order is solved", and the fix's own record says that
is only partly true — "This does **not** make `include_primitives` safe by
default" (docs/re/structures/ui-prm-primitives.md). So:

  * renamed to `no_build_is_wiped_with_primitives_on` — the old name asserted
    the bug; it survives in the doc comment for anyone searching from #38;
  * `wiped_on > 0`  ->  `assert_eq!(wiped_on, 0)`, with a message saying what a
    failure now means (`forced_backdrop` regressed) and that it must not be
    "fixed" by turning primitives off in the test;
  * `include_primitives` stays `false`; no library code changes.

It is the only end-to-end check of the rule: the four tests in
`ui_forced_backdrop_disc.rs` pin its mechanics, and none composes with
primitives on.

Verified with the corpus present, including that it can fail:

  fix                        3 passed   125 builds draw a primitive, 0 wiped
  forced_backdrop disabled   FAILED     36 of 125 wiped — the new message fired
  restored                   3 passed   125 builds, 0 wiped

The control's 36 is exactly the "36 builds ... wiped by our own sort" that
`53f8345` and `ui-forced-backdrop.md` report — the guard independently
reproduces the fix's own number, so it measures precisely what was repaired.
The control was a one-line `return false;` in a scratch copy; the working tree
was restored and `git diff` showed only this test file before committing.

Closes #38

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
sim
2026-09-16 19:01:13 +02:00
parent e0187d6fd9
commit 42936e4e18

View File

@@ -172,8 +172,29 @@ fn the_title_fade_quad_rests_transparent() {
///
/// This test measures the damage rather than asserting the feature works, so the
/// number stays honest and moves when the ordering is solved.
/// With primitives drawn, no build comes out wiped.
///
/// 🔴 THIS USED TO ASSERT THE OPPOSITE. Until issue #38 it was a tripwire named
/// `the_derived_order_puts_primitives_last_and_that_wipes_screens`, asserting
/// `wiped_on > 0` — that switching primitives on still flattened at least one
/// screen — with the instruction to turn `include_primitives` on by default the
/// day it stopped. `53f8345` made that day arrive: a keyless primitive that
/// would hide the screen is now forced to paint first (`forced_backdrop`,
/// `docs/re/structures/ui-forced-backdrop.md`), and the 36 one-colour builds
/// were "wiped by our own sort". The wire tripped on 2026-08-29 and sat red for
/// 15 days, because CI has no corpus and the suite self-skips there.
///
/// #38 chose to keep the default **off** and pin the fix instead. The flatness
/// proxy stood in for "paint order is solved", and the fix's own record says
/// it is only partly solved: *"This does **not** make `include_primitives` safe
/// by default"* (`docs/re/structures/ui-prm-primitives.md`). An unlisted
/// primitive that does not hide the screen still sorts last.
///
/// So this is now the one end-to-end check of the rule: the four tests in
/// `ui_forced_backdrop_disc.rs` pin its mechanics, and none composes with
/// primitives on.
#[test]
fn the_derived_order_puts_primitives_last_and_that_wipes_screens() {
fn no_build_is_wiped_with_primitives_on() {
let Some(root) = disc_root() else {
eprintln!("SKIP: extracted disc not found (set SYLPHEED_DISC to enable)");
return;
@@ -221,13 +242,17 @@ fn the_derived_order_puts_primitives_last_and_that_wipes_screens() {
"the DEFAULT composite wipes {wiped_off} builds — primitives are supposed \
to be off unless asked for"
);
assert!(
wiped_on > 0,
"no build is wiped with primitives on — the ordering problem this flag \
exists for may be solved, in which case turn it on by default"
assert_eq!(
wiped_on, 0,
"{wiped_on} of {with_prm} builds come out >99% one colour with primitives on — \
a primitive that hides the screen is painting on top again. That is \
`forced_backdrop` failing to force it first; see \
docs/re/structures/ui-forced-backdrop.md and issue #38. Do NOT resolve \
this by turning `include_primitives` off in the test: the default is \
already off, and this test is the only end-to-end check of the rule."
);
eprintln!(
"{with_prm} builds draw a visible primitive; with the derived order \
{wiped_on} of them come out >99% one colour, {wiped_off} by default"
"{with_prm} builds draw a visible primitive; with primitives on \
{wiped_on} come out >99% one colour, {wiped_off} by default"
);
}