test: make $SYLPHEED_DISC an actual control, not a decoration (#16 remedy 3) #22

Merged
fabi merged 1 commits from fix/corpus-control into main 2026-09-12 14:30:23 +00:00
Owner

Implements remedy (3) of #16: make the corpus env vars an actual control.

The defect, restated precisely

unset SYLPHEED_DISC did not disable the disc-backed suites on the machine
that has the disc — every disc_root() fell back to a hardcoded absolute path
that exists there. The variable looked like a control and was not one. Same
for $SYLPHEED_RES3D and $SYLPHEED_ISO.

What the refactor actually found

The 17 disc_root() copies were not 17 copies of one function. They had drifted
into five variants, and one differed semantically: movie_manifest_disc,
movie_subtitle_disc and slb_disc already honoured $SYLPHEED_DISC and
nothing else
, while the other 14 fell back to the hardcoded path.

So the same function name already meant two different things inside one
directory — a third instance of the exact shape #16 is about. That also settled
the design question: the shared helper adopts the env-only behaviour those
three already had
, rather than inventing a sixth variant.

Changes

before after
disc_root() definitions 17 1
skip-macro copies 7 1
executable hardcoded absolute paths 16 0
resolvers corpus_report.rs reports on its own 2nd copy the same one the suites use

Three of the 16 were inline in mesh_disc.rs, in no resolver at all, and two
were in examples/ — a remedy scoped only to tests/*_disc.rs would have
missed them.

Two module docs still described the fallback after it was deleted (the same
defect in prose): texture_disc claimed "or the default dev path exists" and
pak_idxd_disc said "or drop it at the default dev path below". Both now say
what the code does.

Verification — both directions, on the machine that has the corpus

This is the only machine where the refactor can be falsified, because it is
the only one where the old fallback used to resolve.

corpus block suites passed failed ignored slowest
A env unset ABSENT — $SYLPHEED_DISC unset 31 209 0 14 0.12 s
B env set PRESENT via $SYLPHEED_DISC 31 209 0 14 1235.53 s

Identical tallies, opposite corpus states, ~10 000× apart in wall clock.

  • (A) is new behaviour — it was literally unreachable on this box before.
  • (B) proves nothing broke: mesh_consistency_disc still decodes for ~20 min.

That the two runs are indistinguishable by tally is not a flaw in the test —
it is #16, and it is why PR #19 added the corpus block. Read the block.

cargo fmt --all -- --check clean; no new compiler warnings.

Scope note: remedy (1) is deliberately not here

#[ignore] + --ignored was considered and rejected. Remedy (3) already moves
the mode from the machine's filesystem into the environment, which is the
property #16 asks for. And #[ignore] already carries three meanings in
this directory (corpus-absent ×10, known-failing ×1, bare ×3 — the 14 ignored).
Overloading it a fourth time would re-create the very defect being fixed.

Happy to do (1) as a follow-up if you'd rather have --ignored as the gate, but
it should then come with disambiguating the three existing meanings first.

Note for review

CI here runs with the corpus ABSENT, so its green means "parser-only
coverage" — exactly as the corpus block will state in the job log. The
disc-backed evidence is (B) above and cannot be reproduced by the runner.

Refs #16


Re-verified on the final tree

The table in the description was measured before the last cleanup commit
content (unused imports, doc-comment reattachment, the two stale module docs).
Those edits are non-semantic, but that is an inference, and this repo has a
standing lesson about inferring instead of counting — so I re-ran the disc
suites against the exact tree at 64f3df7:

EXIT=0
  PRESENT via $SYLPHEED_DISC
  PRESENT via $SYLPHEED_RES3D
  PRESENT via $SYLPHEED_ISO
  suites=31 passed=209 failed=0 ignored=14
  slowest: 1234.03s / 154.20s / 131.78s / 102.14s

mesh_consistency_disc at 1234.03 s vs 1235.53 s on the pre-cleanup run
— 0.1% apart, i.e. noise. Both directions now hold on the final tree, so the
description's table stands as written.

Nothing blocking merge from my side.

Note for whoever reads this PR's CI: the runner has no corpus, so its green
means parser-only coverage — its own corpus block will say ABSENT in the job
log. The disc-backed evidence above is local and the runner structurally cannot
reproduce it.


🤖 Generated with Claude Code

Implements remedy **(3)** of #16: make the corpus env vars an actual control. ## The defect, restated precisely `unset SYLPHEED_DISC` did **not** disable the disc-backed suites on the machine that has the disc — every `disc_root()` fell back to a hardcoded absolute path that exists there. The variable *looked* like a control and was not one. Same for `$SYLPHEED_RES3D` and `$SYLPHEED_ISO`. ## What the refactor actually found The 17 `disc_root()` copies were not 17 copies of one function. They had drifted into **five variants**, and one differed *semantically*: `movie_manifest_disc`, `movie_subtitle_disc` and `slb_disc` already honoured `$SYLPHEED_DISC` **and nothing else**, while the other 14 fell back to the hardcoded path. So the same function name already meant two different things inside one directory — a third instance of the exact shape #16 is about. That also settled the design question: the shared helper **adopts the env-only behaviour those three already had**, rather than inventing a sixth variant. ## Changes | | before | after | |---|---|---| | `disc_root()` definitions | 17 | **1** | | skip-macro copies | 7 | **1** | | executable hardcoded absolute paths | 16 | **0** | | resolvers `corpus_report.rs` reports on | its own 2nd copy | the same one the suites use | Three of the 16 were inline in `mesh_disc.rs`, in no resolver at all, and two were in `examples/` — a remedy scoped only to `tests/*_disc.rs` would have missed them. Two module docs still described the fallback after it was deleted (the same defect in prose): `texture_disc` claimed *"or the default dev path exists"* and `pak_idxd_disc` said *"or drop it at the default dev path below"*. Both now say what the code does. ## Verification — both directions, on the machine that has the corpus This is the only machine where the refactor can be **falsified**, because it is the only one where the old fallback used to resolve. | | corpus block | suites | passed | failed | ignored | slowest | |---|---|---|---|---|---|---| | **A** env unset | `ABSENT — $SYLPHEED_DISC unset` | 31 | 209 | 0 | 14 | **0.12 s** | | **B** env set | `PRESENT via $SYLPHEED_DISC` | 31 | 209 | 0 | 14 | **1235.53 s** | Identical tallies, opposite corpus states, ~10 000× apart in wall clock. - **(A) is new behaviour** — it was literally unreachable on this box before. - **(B) proves nothing broke**: `mesh_consistency_disc` still decodes for ~20 min. That the two runs are indistinguishable by tally is not a flaw in the test — it *is* #16, and it is why PR #19 added the corpus block. Read the block. `cargo fmt --all -- --check` clean; no new compiler warnings. ## Scope note: remedy (1) is deliberately **not** here `#[ignore]` + `--ignored` was considered and rejected. Remedy (3) already moves the mode from *the machine's filesystem* into *the environment*, which is the property #16 asks for. And `#[ignore]` already carries **three** meanings in this directory (corpus-absent ×10, known-failing ×1, bare ×3 — the 14 ignored). Overloading it a fourth time would re-create the very defect being fixed. Happy to do (1) as a follow-up if you'd rather have `--ignored` as the gate, but it should then come with disambiguating the three existing meanings first. ## Note for review CI here runs with the corpus **ABSENT**, so its green means "parser-only coverage" — exactly as the corpus block will state in the job log. The disc-backed evidence is (B) above and cannot be reproduced by the runner. Refs #16 --- ### Re-verified on the final tree The table in the description was measured **before** the last cleanup commit content (unused imports, doc-comment reattachment, the two stale module docs). Those edits are non-semantic, but that is an inference, and this repo has a standing lesson about inferring instead of counting — so I re-ran the disc suites against the exact tree at `64f3df7`: ``` EXIT=0 PRESENT via $SYLPHEED_DISC PRESENT via $SYLPHEED_RES3D PRESENT via $SYLPHEED_ISO suites=31 passed=209 failed=0 ignored=14 slowest: 1234.03s / 154.20s / 131.78s / 102.14s ``` `mesh_consistency_disc` at **1234.03 s** vs **1235.53 s** on the pre-cleanup run — 0.1% apart, i.e. noise. Both directions now hold on the final tree, so the description's table stands as written. Nothing blocking merge from my side. Note for whoever reads this PR's CI: the runner has **no corpus**, so its green means *parser-only coverage* — its own corpus block will say `ABSENT` in the job log. The disc-backed evidence above is local and the runner structurally cannot reproduce it. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fabi added 1 commit 2026-09-10 18:48:18 +00:00
test(formats): make $SYLPHEED_DISC an actual control (#16 remedy 3)
All checks were successful
CI / Native — linux (pull_request) Successful in 33m40s
CI / WASM — Web (pull_request) Successful in 29m29s
CI / Formatting (pull_request) Successful in 1m1s
64f3df7d72
Before this commit, `unset SYLPHEED_DISC` did not disable the disc-backed
suites on the machine that has the disc: every `disc_root()` fell back to a
hardcoded absolute path that exists on this box. The env var looked like a
control and was not one. Same for $SYLPHEED_RES3D and $SYLPHEED_ISO.

Replace the duplicated resolvers with one `tests/common/mod.rs`:

  - 17 local `disc_root()` definitions -> 1
  - 7 copies of the skip macro -> 1 (`skip_without_disc!` and siblings)
  - 16 hardcoded absolute paths -> 0 executable ones
    (3 of those were inline in `mesh_disc.rs`, in no resolver at all,
     and 2 were in `examples/`)
  - `corpus_report.rs` now reports on the SAME resolver the suites use,
    instead of a second copy of the logic its own comments flagged as a
    drift risk.

The 17 copies had already drifted into FIVE variants, and they were not all
the same function. `movie_manifest_disc`, `movie_subtitle_disc` and `slb_disc`
honoured $SYLPHEED_DISC and nothing else, while the other 14 fell back. So one
name already meant two things -- a third instance of the shape #16 is about.
The shared helper adopts the env-only behaviour those three already had, rather
than inventing a sixth variant.

Two module docs still described the fallback after it was deleted, which is the
same defect in prose: `texture_disc` claimed "or the default dev path exists"
and `pak_idxd_disc` said "or drop it at the default dev path below". Both now
say what the code does.

Verified both ways on the machine that HAS the corpus, which is the only place
this refactor can be falsified:

  A  env unset  -> "ABSENT -- $SYLPHEED_DISC unset; its suites self-skip"
                   suites=31 passed=209 failed=0 ignored=14, slowest 0.12s
  B  env set    -> "PRESENT via $SYLPHEED_DISC" (all three corpora)
                   suites=31 passed=209 failed=0 ignored=14,
                   slowest 1235.53s (mesh_consistency_disc)

Identical tallies, opposite corpus states, ~10000x apart in wall clock. (A) is
new behaviour -- it was previously unreachable here. (B) proves nothing broke.

`just test-disc` sources `.env` (already gitignored) for the set case. Note the
quoting trap documented there: the corpus paths contain spaces, and an unquoted
`VAR=a b c` parses as "run command `b`", failing silently into ABSENT -- which
looks exactly like a working skip.

Remedy (1) (`#[ignore]` + `--ignored`) is deliberately NOT done here: (3) already
moves the mode from the filesystem into the environment, and `#[ignore]` already
carries three meanings in this directory (corpus-absent, known-failing, bare).
Overloading it a fourth time would re-create the defect.

`cargo fmt --all --check` clean; no new compiler warnings.

Refs #16

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fabi merged commit 641be935d6 into main 2026-09-12 14:30:23 +00:00
Sign in to join this conversation.