Repository navigation
Description
crates/nostream-relay/src/sink.rs (at 9d45d48, the head of #1028's branch; same lines at beaacde apart from the shift):
A byte-level re-pin of a Refusal cause now takes three edits, and only two of them are held by a test.
| # | site | holds it |
|---|---|---|
| 1 | sink.rs:78-80 — const NO_REFUSAL: u8 = 0; / QUEUE_FULL = 1 / BUDGET_EXHAUSTED = 2 |
test-held |
| 2 | sink.rs:704-705 — the pinned tuple (NO_REFUSAL, QUEUE_FULL, BUDGET_EXHAUSTED) against the literals (0, 1, 2) |
test-held — this is what fails when a constant moves |
| 3 | sink.rs:425-426 — PINNED_BYTES_MESSAGE, which spells the numbers out in prose: "the refusal bytes are pinned to 0, 1, 2 — …" |
not held by anything |
Edit 1 without edit 2 fails loudly (left: (0, 4, 2) vs right: (0, 1, 2)). Edit 1 with edit 2 and without edit 3 leaves the suite green and the failure message stating a number the code no longer uses.
That is the shape this repository keeps filing issues about — a claim that a command cannot falsify — introduced by the fix for #1028, whose whole subject was a message asserting something untrue. The message is deliberately prose: it has one definition, it is read by a human in a failing test's output, and no test can see it (measured: changing only the string leaves cargo test -p nostream-relay at 259 passed / 0 failed).
Three ways to close it, none obviously right:
- Derive the sentence from the constants — build it at the test with
format!fromNO_REFUSAL, QUEUE_FULL, BUDGET_EXHAUSTED, so the numbers cannot disagree. Costs an allocation on the failure path and makes the message a computed value; the test module would carry the formatting rather than a reader-facing sentence. - Drop the numbers from the sentence —
"the refusal bytes and the enum's discriminants must agree with word()"— so there is nothing to re-pin. Loses the immediate "which byte moved" answer the numbers give in the failure output. - Accept the prose and make the reminder mechanical — a comment on the constants pointing at the sentence, or a grep added to the repository's own checks. Cheapest, and the reminder is exactly the thing that gets deleted next.
Whichever is chosen, spec.md of job 020-pin-test-message must move with it: its requirement 2 fixes the current wording, and .factory/jobs/ is untracked, so a later run of that job would reintroduce the sentence.
Filed from job 020-pin-test-message's code review (its carry-forward note), with the three sites and the measurement that separates them.
Activity