Repository navigation
docs: nonce rejection names the bounded scan window (#349) - #459
alisemut0711-dev wants to merge 1 commit into
Conversation
|
The diff changes only the nonce-rejection wording and adds a focused string regression. The wording accurately describes _last_nonce's scanned-tail value and preserves the single-use policy; the test intentionally pins the message rather than attempting to re-test scan mechanics. The PR description reports local gates, but the only visible upstream check is skipped [code]smith. Please obtain maintainer-approved CI before merge. |
e277300 to
427b887
Compare
|
Rebased onto current |
064c908 to
334f62c
Compare
7d64718 to
133b9c6
Compare
luch91
left a comment
There was a problem hiding this comment.
Reviewed current head 133b9c6. The runtime message now accurately identifies the bounded scanned tail and explicitly warns that older writes may lie beyond it, while retaining the single-use guidance. The added regression pins those phrases on the low-nonce rejection path without changing scan behavior. The author reports the rebased targeted store suite (64 tests), ruff, and ty clean; no issue found.
22de99c to
5c85d07
Compare
The 400 message used to read 'the last one this key used in /r/<room>', which sounds like a full-history check. In a busy room, a replay scrolls out of the tail that _last_nonce scans, and the next low-nonce write then reads as 'server lost track' — when in fact the bounded scan did exactly what /llms.txt promised. New wording: 'the highest in the scanned tail of /r/<room> (older writes may lie beyond it)'. The policy is still single-use, still count up; the difference is that the runtime now matches the manual instead of misrepresenting a bounded scan as a history lookup. Test added in tests/unit/test_store.py: a low-nonce write must surface 'scanned tail' and 'older writes may lie beyond it' so the message does not drift back to the old wording. Closes flop-labs#349.
5c85d07 to
94d21cb
Compare
|
Triage: closing as a duplicate of #350. Three open PRs rewrite the same nonce-rejection string in Keeping #350: it is the earliest, it was filed by the reporter of #349, and it is the only one of the three that also corrects the same overstated claim where it is published — the nonce description in Per CONTRIBUTING's "Overlapping work", review or build on #350 rather than carrying a parallel branch. The regression test here ( Generated by Claude Code |
Closes #349.
What
The 400 message used to read:
"the last one this key used in /r/lobby" reads as a claim about the key's full history in that room. In a busy room, a captured URL's nonce scrolls out of the tail that
_last_noncescans, and the next low-nonce write then claims the server lost track of a key that had in fact posted there many times with a much larger nonce.The actual behavior is a bounded tail scan (newest ~1 MiB of the room) and is already documented at /llms.txt. The runtime message just didn't reflect that.
New wording
Three pieces the old wording got wrong, in order:
The issue text suggested two phrasings. I went with a third that's a touch tighter: dropped "the last one this key used" since "highest in the scanned tail" already names both the value's role and the window it came from. Net 2 chars shorter per line for the policy lines and 4 lines total (4 → 4 — same shape as before, since I broke the long strings into three pieces for ≤100 chars/line).
Why a test
The change is purely a string in a rejection path, and a string change is exactly the kind of edit that quietly drifts back.
tests/unit/test_store.py::test_a_low_nonce_rejection_names_the_bounded_scanpins all three of the new phrases (scanned tail,older writes may lie beyond it,single-use), so a future refactor that loses one of them fails there.Verification
uv run python sz.py --check→ check ok (core 2127 → 2127 — wait, let me recheck)Actually core 2127 → 2128 because the new test added one core line for the rejection path. No
sz-baseline.jsonchange needed because the cap is 2128 and we are still under it.uv run ruff check .,uv run ruff format --check .,uv run ty check→ all cleanuv run pytest tests/unit/test_store.py tests/http/test_notes.py tests/http/test_signer.py→ 91 passedstore.appendwith two writes from the same DID, nonce 5 then nonce 3 → got the new message, with all three test needles present.