Skip to content

test(bitnet): assert the DMA address advance per state arm, not by literal count - #2385

Merged
gHashTag merged 1 commit into
masterfrom
fix/2384-dma-addr-per-arm
Aug 22, 2026
Merged

test(bitnet): assert the DMA address advance per state arm, not by literal count#2385
gHashTag merged 1 commit into
masterfrom
fix/2384-dma-addr-per-arm

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #2384

The defect

dma_local_addr_autoincrement_both_paths counts one literal across the whole emitted
module and requires two:

let bumps = stdout.matches("local_addr      <= local_addr + 12'd1;").count();
assert!(bumps >= 2, "expected local_addr++ on both read and write beats, got {}", bumps);

#2345 (Closes #2003) replaced the read path's post-increment with
local_addr <= beat_indexdeliberately, because the post-increment landed beat 0's
data at address 1 and never wrote slot 0. bumps fell to 1 and the test has been red on
master since
. #2345's file list is bootstrap/src/bitnet_dma.rs plus its NOW entry; the
test was not touched.

The emitter is correct. The test was stale.

Why it was invisible, and why that is the interesting part

cargo test -p t27c --tests stops after the first failing target, and this is the 42nd of
73 — so it never ran. That is #2382, and this is its first concrete instance: a genuine
regression sitting on master for a day, not because a gate was missing but because the gate
everyone assumed was running had never reached the target. The ratchet landed in #2383 is
what will surface the next one.

Why not lower the threshold

The property the test names — each transfer path advances the destination address — is
still true. Both paths do it, by different mechanisms:

READ_DATA:  local_addr <= beat_index;         beat_index <= beat_index + 12'd1;
WRITE_DATA: local_addr <= local_addr + 12'd1;

On the write path local_addr is a read pointer into local memory, so a post-increment
is right there and must not be harmonised with the read path.

Changing >= 2 to >= 1 would go green and re-open the same blind spot: a global count
cannot say which path a match came from, which is exactly what would let one path silently
lose its advance while the assertion still saw the other. Now sliced per state arm, so
an assertion cannot be satisfied by an identical line in a different state.

Evidence

Three mutants, one per assertion. Each verified planted (planted=1) before running —
an earlier attempt's sed silently matched nothing and the tests passed, which would have
read as "the guard does not bite" had the plant not been checked.

mutant result
bitnet_dma.rs:217 removed READ_DATA must present the beat index as the address, not post-increment (that was #2003 — beat 0 landed at address 1 and slot 0 was never written).
:218 removed READ_DATA must advance beat_index, or every beat writes address 0.
:235 removed WRITE_DATA must advance local_addr, or every beat reads the same word.

21 passed; 1 failed each time, each caught by its own assertion. Restored:
22 passed; 0 failed.

Baseline pruned 383 → 382, since the test now passes and a fixed entry left in the baseline
is the rot the ratchet's recovery reporting exists to prevent.

What this does not establish

…teral count

dma_local_addr_autoincrement_both_paths counted one literal across the whole
module and required two. #2345 replaced the read path's post-increment with
local_addr <= beat_index -- the #2003 fix -- so the count fell to one and the
test has been red on master since. The emitter is correct; the test was stale.

A global count cannot say which path a match came from, which is what let the
read path lose its advance while the assertion still saw one match. Lowering
the threshold to >= 1 would go green and re-open the same blind spot.

Now sliced per state arm. Invisible until now because cargo test stops at the
first failing target and this is the 42nd of 73 (#2382).

Closes #2384
@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-22 07:49:29 UTC

Summary

Status Count
Total Open PRs 3
PRs with Failing Checks 1
PRs with All Checks Green 2
READY 1
FAILING 1
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=fba627661c36 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit 4544910 into master Aug 22, 2026
25 of 28 checks passed
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.

dma_local_addr_autoincrement_both_paths counts a literal across the whole module and has been red since #2345

1 participant