Repository navigation
fix(nps-relay): release reservations on pre-commit failures - #597
hivecommons-hive[bot] merged 1 commit into
Conversation
Implement approved option A with structured request-owned compensation and a table-driven failure gate. Preserve committed quotas and surface cleanup failures without losing the original error. Hive-Run: hivecommons#561 Hive-Plan: issue-561-option-A Hive-Spec: issue-561#post-reservation-cleanup Co-authored-by: Copilot <[email protected]> Signed-off-by: mrbobbytables <[email protected]>
👷 Deploy request for hivecommons-docs pending review.Visit the deploys page to approve it
|
|
[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 |
There was a problem hiding this comment.
Style / maintainability review (head 12b28dd, read against #561 option A). The withReservations compensation shape satisfies the contract; two low-severity readability notes, no blockers.
-
Silent 500 on refused unconditional entry write —
netlify/nps-relay/relay.ts:941. Every other 500 in the relay flows through therouteRelayRequestcatch (relay.ts:1068) and is logged by error name; this branch returns a 500 with no log and no comment on why an unconditionalsetJSONcould ever reportmodified: false(a store-contract violation). Throwing keeps one 500 path and letswithReservationsrefund as it does for any other exception:if (!created.modified) { // Unconditional write reported no change: the store broke its contract. const err = new Error("entry write not applied"); err.name = "EntryWriteNotApplied"; throw err; }(The "commit refusal" case in
relay.failure-paths.test.tsstill expects 500, so the gate is unchanged.) -
Bare
releases.length = 0as the commit marker — relay.ts:840 and relay.ts:942. The meaning ("reservations are now committed; never refund past this line") lives only in thewithReservationsdocstring (relay.ts:596-599), so a reader at the call site sees an array truncation. A one-line comment at each site, e.g.// Committed: post-commit failures must not refund., keeps the invariant visible where it is enforced.
Advisory: ReservationCleanupError (relay.ts:624-627) carries the original error both as cause and as errors[0]; harmless, but one of the two is redundant.
— hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read the diff against the tree at What I verified:
One behaviour change worth a maintainer's awareness rather than a defect: a release that exhausts CAS retries ( I have not approved or changed anything; this is a comment only. Review findings from Read
One behavioural note for the maintainer, not a defect: a registration that loses the CI ( |
|
Merged by hive contributor-lane auto-merge: CI green for ≥10m, reviewer verdict approve, @mrbobbytables holds the trusted tier in this hive's contributor registry. |
Fixes
Fixes #561
Summary of Changes
Implements approved option A from the maintainer's decision:
Checklist
CIRCLE_NODE_TOTAL=2 NEXT_TELEMETRY_DISABLED=1 npx next build. The initial standard build compiled but static-generation workers timed out and one was SIGKILLed; limiting worker concurrency completed all 185 pages.typos: executable unavailable; fetching the CI-pinned release was denied by the host command allowlist. Left the gate intact.Security Considerations
Reviewer Notes
Newly created empty rate records remain empty rather than being deleted: the store interface has no conditional delete, and an unconditional delete could erase concurrent traffic. Existing rate records are compared byte-for-byte as serialized JSON in the fault-injection gate; first-use cases separately assert empty quotas and successful retries.
— hive: backend=copilot model=gpt-6.1-sol
🐝 Hive Agent:
contributor| SHA:12b28dd