Skip to content

One assertion at two readings is one failure; an index is two - #472

Open
Japabu wants to merge 3 commits into
mainfrom
wt/toyos-aloneclass
Open

Japabu wants to merge 3 commits into
mainfrom
wt/toyos-aloneclass

Conversation

@Japabu

@Japabu Japabu commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

The suite's ALONE: line re-runs one red alone and says whether the same
defect came back. It decided that by comparing the wide run's headline with
the isolated re-run's byte for byte, so an assertion that prints what it
measured wrote a different sentence every time it fired and the arm claimed
a second defect. Nightly ci run 35072262489 is the case: one assertion,
two boots, 0.303 s and 0.300 s, reported as red again on a DIFFERENT failure — it failed twice, on two assertions. That is the larger of the two
findings, so the defect sent an adjudicator looking for a second defect that
does not exist, and it did it to every timing, counting or sizing assertion
in the suite.

toyos_build::alone::same_failure decides it instead, on a rule derived
from what the two cases are rather than fitted to the sentences that
produced them: what differs between two readings of one assertion is a
measurement, and what differs between two failures is an identity.
So only
what is unmistakably a measurement is taken out before the comparison — a
number carrying a unit of time or size (0.303 s, 1007 ms, 12 MiB), and
the time in a kernel record's stamp ([kernel 0.075 cpu0], which no two
boots write the same). Everything else stays, because it names which thing
was observed: slot 1 against slot 2, a port, an APIC id, a CPU, an
opcode, a register, a count with no unit. Merging two of those would lose
the larger finding, which is the defect this module exists to stop.

Every fixture in the module's tests is a line this tree prints, whole: the
floor and ceiling of tests/common/usb.rs's first-port window, the transport
break of kernel/src/drivers/xhci/wait/msc.rs with the controller's BDF
inside the slot (the line src/redlist.rs quotes off CI), the durability
sentence of tests/common/volumes.rs, the stall line of
kernel/src/heartbeat.rs. The units list holds ten spellings and each is one
an assertion here prints — µs, TiB and kB occur in no string literal in
tests/, kernel/src, userland/, src/, bootloader/, toyos/ or
toyos-abi/, and every entry only widens a merge that has to err toward
"different", so they are gone. every_unit_is_one_this_tree_prints holds the
list against the site that prints each.

What the scan does not reach

A scan closes the spellings it matches. A reading rendered with no unit
beside it reads as an identity, so one assertion printing two of them is
reported as two failures — the safe direction, and four assertions in this
tree are in it: check_physical's wake lateness rendered a second time as
pipeline depths, the dither floor's percentage, the tone peak's bare count,
and the log-drain verdict's bytes spelled out, which is not B. The module
header states the limit in one sentence, a test per shape asserts same=false
from that assertion's own wording, and
issues/build/the-alone-classifier-cannot-see-a-reading-with-no-unit.md
records the compromise with its owner, the four sites and two exit conditions.

The line itself gains one arm: a reproduction at two readings says red again, the same failure both times — the defect is real and prints the wide
run under wide: and the alone run under alone: rather than picking one.
One call decides it — byte equality is a case same_failure already answers,
so asking it first would be a second rule nothing tests.

The two checks

  • Negative control, both arms, measured on this host at 6630db78
    (git status --porcelain empty before and after each, restored by a
    trap-guarded script):
    • The rule this replaces — same_failure is one == other:
      cargo build -p toyos-build --lib exit 0; cargo test -p toyos-build --lib alone:: exit 101, 8 passed 3 failed —
      one_assertion_at_two_measurements_is_one_failure,
      one_verdict_at_two_kernel_stamps_is_one_failure,
      an_index_is_an_identity.
    • The other extreme — reading returns the literal's length unconditionally,
      so every standalone number is a reading: cargo build -p toyos-build --lib
      exit 0; cargo test -p toyos-build --lib alone:: exit 101, 4 passed
      7 failed — an_index_is_an_identity (slot 1 against slot 2),
      a_skeleton_keeps_everything_that_is_not_a_reading,
      one_verdict_at_two_kernel_stamps_is_one_failure,
      a_reading_rendered_twice_keeps_the_copy_with_no_unit,
      two_percentages_are_two_failures, two_bare_counts_are_two_failures,
      bytes_spelled_out_is_not_a_unit.
    • The label swap on the new arm — the alone run's sentence printed under
      wide: and the wide run's under alone:, which is the mis-attribution the
      gate exists to stop said the other way:
      cargo build -p toyos-build --test toyos-build exit 0;
      cargo test --test toyos-build alone_line_reports_the_alone_run exit 1,
      FAIL alone_line_reports_the_alone_run: "the controller started at 0.303 s, …" is not the line's "wide: " run.
  • Independent oracle: the recorded real failure. The fixture is the two
    sentences nightly ci run 35072262489 actually printed, which the
    classifier has to call one failure, and the pair from run 31424496450 —
    xhci_hid_break's endpoint count against its pointer delivery — which it
    has to keep apart. The usb-storage fixture is the line CI produced and
    src/redlist.rs records verbatim.

Green arms on this host at 6630db78: cargo test -p toyos-build --lib
exit 0, 319 passed, 0 failed, 1 ignored; cargo test --test toyos-build alone_line_reports_the_alone_runexit 0, PASS alone_line_reports_the_alone_run (52µs). Clippy, the root shape as
src/clippy.rs declares it with $ADOPTED expanded and -D warnings
(--workspace --all-targets --keep-going) → exit 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_014iqcj4jDKpaiDX8B7CMvmK

The `ALONE:` line compared the wide run's headline with the isolated
re-run's byte for byte, so an assertion that prints what it measured wrote
a different sentence every time it fired and the arm claimed a second
defect. Nightly `ci` run 35072262489 is the case: one assertion, two boots,
`0.303 s` and `0.300 s`, reported as `red again on a DIFFERENT failure — it
failed twice, on two assertions`. That is the larger of the two findings,
so the defect sent an adjudicator looking for a second defect that does not
exist, and it did it to every timing, counting or sizing assertion in the
suite.

`toyos_build::alone::same_failure` decides it instead, on a rule derived
from what the two cases are rather than fitted to the sentences that
produced them: what differs between two readings of one assertion is a
measurement, and what differs between two failures is an identity. So only
what is unmistakably a measurement is taken out before the comparison — a
number carrying a unit of time or size (`0.303 s`, `1007 ms`, `12 MiB`),
and the time in a kernel record's stamp, which no two boots write the same.
Everything else stays: `slot 1` against `slot 2`, a port, an APIC id, a
CPU, an opcode, a register, a count with no unit. Merging two of those
would lose the larger finding, which is the defect this module exists to
stop, so the rule refuses to guess.

The limit that carries is stated in the module header and pinned by a test:
an address is digits with no unit after them, so one assertion printing two
addresses — `tests/common/iommu.rs`'s translation verdicts are the shape —
still reads as two failures. That is the conservative direction of the same
rule, and closing it would need a rule that can tell an address from an
index.

The negative control is the rule it replaces. Mutation: `reading` returns
the literal's length unconditionally, so every standalone number is a
reading, unit or not — `cargo build -p toyos-build --lib` exit 0, `cargo
test -p toyos-build --lib alone::` exit 101 with three tests red, including
`an_index_is_an_identity` on `usb-storage: slot 1 …` against `slot 2 …`.
The green arm is 314 passed, 0 failed, and the oracle is the recorded
failure itself: the two sentences run 35072262489 printed, quoted as the
fixture the classifier has to call one failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014iqcj4jDKpaiDX8B7CMvmK
Japabu and others added 2 commits September 18, 2026 17:10
… tracked

Round 2 of the ALONE classifier, against the review of aac1627.

**Fixtures.** `two_assertions_stay_two_failures` carried the wording of an
unlanded branch — `named {after_start:.3} s after the controller started` — and
its doc claimed both sentences open `the first port was named`, which this tree
contradicts: `tests/common/usb.rs`'s floor and ceiling both open `the first port
was named at`. Both fixtures are now those two assertions at
`FIRST_CONNECT_S = 0.4` and the doc says what is true. `an_index_is_an_identity`
held truncations rather than lines: the transport break is now the whole line
`kernel/src/drivers/xhci/wait/msc.rs` writes, BDF inside the slot and the
`Broke::Silence` rendering behind it, as `src/redlist.rs` quotes it off CI; the
durability check is `tests/common/volumes.rs`'s whole sentence; the stall line
is `kernel/src/heartbeat.rs`'s, `heartbeat: ` included.

**Units.** `µs`, `TiB` and `kB` occur in no string literal in `tests/`,
`kernel/src`, `userland/`, `src/`, `bootloader/`, `toyos/` or `toyos-abi/` —
only in comments and identifiers — and every entry in that list widens a merge
that must err toward "different", so all three are gone.
`every_unit_is_one_this_tree_prints` pins the remaining ten against the site
that prints each, and reds on a unit added without one.

**The limit.** The scan closes the spellings it matches and nothing else, and
four assertions in this tree render a reading with no unit beside it:
`check_physical`'s wake lateness rendered a second time as pipeline depths, the
dither floor's percentage, the tone peak's bare count, and the log-drain
verdict's `bytes` spelled out. All four read as two failures at two readings,
which is the safe direction and was unstated. The module header states it in one
sentence, a test per shape asserts `same=false` from that assertion's own
wording, and `issues/build/the-alone-classifier-cannot-see-a-reading-with-no-unit.md`
records the compromise with its owner, the four sites and two exit conditions.

**One decision at the call site.** `said == wide` was a second rule that
`same_failure` already subsumes; the two arms reached one verdict and differed
only in whether the sentence was quoted once or twice. Now one call, and the
reproduction arm always prints `wide:` and `alone:`. The gate asserts which
sentence sits under which label, so swapping the two fields — the
mis-attribution the line exists to stop, said the other way — reds it; before,
that mutation passed.

Prose deleted rather than rewritten: the units doc's restatement of the header
rule three lines above it, and the narration of the two lines under the
kernel-stamp test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014iqcj4jDKpaiDX8B7CMvmK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant