Skip to content

Make the hold-probe test actually depend on the exemption - #21

Merged
gvonnessi merged 1 commit into
mainfrom
test/pin-hold-probe-exemption
Aug 10, 2026
Merged

gvonnessi merged 1 commit into
mainfrom
test/pin-hold-probe-exemption

Conversation

@gvonnessi

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #20. The test that shipped with the exemption did not pin it.

Peer and probe both ran on a 60s step, so the first probe to land set hist.last() to its own timestamp and the next was admitted by the ordinary throttle on the boundary — last.t > now - INTERVAL is false at equality. The session sustained its own cadence, the peer never regained the slot, and from the second write onward the exemption was not what kept the probes landing.

This was found by mutation, not inspection: an exemption that fired twice and then did nothing passed the old test unchanged. Only outright removal failed it — the regression least likely to occur, and the one review would catch anyway.

  • The peer now writes one second before each probe on a 61s step. At every probe the session's own last sample is 61s old (opening the per-session gate) while the shared slot was claimed a second ago (so the ordinary throttle would refuse it). Each probe lands only on the exemption.
  • A final uncontended write shows the hold releasing: with the switch proven it wins the ordinary slot unaided and is recorded as spend rather than demoted to a probe.
  • Narrows the gate from "the counter differs" to "the counter climbed", so it agrees with hold, which releases on u > first_move. A slot spent on a counter that went down buys evidence the release can never use. Unreachable with real cumulative counters; it stops the two rules disagreeing.

Test plan

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo build, cargo test --all (85 passed)
  • Partial break — exemption fires twice then stops: passed before, now fails (got 5 against the 40+ the schedule produces). This is the regression the old test could not see.
  • Full removal — still fails (got 3)
  • Re-confirmed both after the directional narrowing

The test added with the exemption did not pin it. Peer and probe both ran on a
60s step, so the first probe to land set `hist.last()` to its own timestamp and
the next one was admitted by the ordinary throttle on the boundary — `last.t >
now - INTERVAL` is false at equality. The session sustained its own cadence, the
peer never got the slot back, and from the second write on the exemption was not
what kept the probes landing.

Verified rather than reasoned: an exemption that fired twice and then did
nothing passed that test unchanged. Only removing it outright failed, which is
the regression least likely to happen and the one a reviewer would catch anyway.

The peer now writes one second before each probe on a 61s step, so at every
probe the session's own last sample is 61s old — opening the per-session gate —
while the shared slot was taken a second ago, so the ordinary throttle would
refuse it. Each probe lands only on the exemption. The partial break now fails
(5 samples against 40+), as does removal (3).

Also narrows the gate from "the counter differs" to "the counter climbed", so it
agrees with what `hold` accepts as proof: `hold` releases on `u > first_move`, so
a slot spent on a counter that went down buys evidence the release can never
use. Unreachable with real cumulative counters; it stops the two rules disagreeing.
@gvonnessi
gvonnessi merged commit 4ebef95 into main Aug 10, 2026
3 checks passed
@gvonnessi
gvonnessi deleted the test/pin-hold-probe-exemption branch August 10, 2026 15:00
@gvonnessi gvonnessi mentioned this pull request Aug 10, 2026
3 tasks done
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