Repository navigation
🐛 fix(nps-relay): release the per-IP registration slot when the day cap refuses a registration - #558
Conversation
… refuses a registration Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for hivecommons-docs canceled.
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Evidence bundle `#5580a54f60` sha256:162b6e987b529e12f2d7e7774d0d3acb7d826675057c513cf2ffeec85c95bce1 — download from the dashboard or `hivectl review evidence #558`. |
There was a problem hiding this comment.
Read handleRegister and handleSubmit on the PR head (0a54f60) and ran the suite. This looks correct to me.
relay.ts:749-769now mirrors the submit path exactly:handleSubmitalready doesreserveSlot(ip)→reserveSlot(install)→releaseSlot(ip)on refusal (relay.ts:863-874), andreleaseSlot(relay.ts:575-586) removes thenowtimestamp this same call reserved, so the release cannot drop another request's slot.- The CAS loop in
compareAndSwap(relay.ts:538-553) means the release is safe under concurrent registrations from the same IP. - Test:
netlify/nps-relay/relay.test.ts:493-505fails onorigin/mainwithexpected [ 1790683200000 ] to deeply equal []and passes with the fix; full file 49/49 green.
Matches #557's scope with no extra changes; changelog fragment follows the fixed-<n>-… naming. Nothing blocking from my side.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
…ubmit request (#564) Three fixes in a row (#555, #558, #560) each closed one path where a reserved slot was not released after a later refusal. Each shipped a site-local regression test; nothing asserted the class. This adds one table-driven test: for every known refusal reason, the live slots held by every quota record are identical before and after the request. Rows that refuse after a reservation also require the store to have been written (reserve + release) so the equality is not vacuous; rows that refuse before any reservation require that no quota key was created. Reverting any one of the three release hunks makes exactly one row fail. Closes #563 Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]>
Mirror of #555's handleSubmit fix for handleRegister. The per-IP slot is reserved before the global day counter is checked; when the day cap refused, the 429 left the slot consumed. Each IP only gets 3 registrations per window (24h), so a day-cap refusal burned one of them for 24h, outlasting the day roll-over that would have let the registration succeed. The slot is now released on refusal.
Closes #557
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88