Skip to content

fix: make the optional-plain-compare leak case print its peak, not its checksum - #808

Merged
kacy merged 1 commit into
mainfrom
fix-leak-case-prints-checksum
Aug 19, 2026
Merged

fix: make the optional-plain-compare leak case print its peak, not its checksum#808
kacy merged 1 commit into
mainfrom
fix-leak-case-prints-checksum

Conversation

@kacy

@kacy kacy commented Aug 19, 2026

Copy link
Copy Markdown
Owner

The leak gate's contract (documented in tests/leaks/leakprobe.pith) is that a case prints peak_kb() and nothing else — the harness runs it at two round counts and compares the two numbers. The case added in #807 printed its hit counter instead, so the gate compared checksums: 800k rounds × 3 hits minus 200k × 3 = exactly the "grew 1800000kb" that turned main red. The compare shapes themselves do not leak.

This aligns the case's main with the other cases: accumulate a checksum so the loop cannot be optimized away, guard it behind an impossible branch, print probe.peak_kb().

what was tested

  • the gate's own measure sequence against the rebuilt case: PITH_LEAK_ROUNDS=200000 → 2616 kb peak, 800000 → 2656 kb peak, growth 40 kb against the 2048 kb limit
  • fmt + lint clean

…s checksum

The gate contract is that a case prints peak_kb() and nothing else; the
case from #807 printed its hit counter instead, so the "growth" the gate
compared was 800k*3 - 200k*3 = 1,800,000 — the difference of two
checksums, not two peaks — and main went red on a case that does not
leak.

## what was tested

- the gate's own measure sequence against the rebuilt case:
  PITH_LEAK_ROUNDS=200000 -> 2616 kb, 800000 -> 2656 kb, growth 40 kb
  against the 2048 kb limit
@kacy
kacy merged commit a4a2b71 into main Aug 19, 2026
0 of 2 checks passed
@kacy
kacy deleted the fix-leak-case-prints-checksum branch August 19, 2026 04:57
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