Repository navigation
fix: server review fixes — suspended tenants, permissions, error mapping, expiry, perf - #301
Merged
Merged
Conversation
…ng, expiry, perf) Suspended tenants (governance spec): SUSPENDED keys authenticate again; reserve.lua/event.lua refuse new budget claims (403 FORBIDDEN), dry_run and /decide answer DENY TENANT_SUSPENDED, commit/release/extend and reads work. API-key permissions: controllers enforce the governance Permission values with 403 (admin:read satisfies *:read). Kill switch: cycles.auth.enforce-permissions=false. Error mapping: Spring MVC client errors return their 4xx instead of 500; a key-store outage during auth returns 500 INTERNAL_ERROR instead of 401. Expiry: expire.lua validates every budget row before mutating (quarantine CORRUPT_BUDGET) so a bad row cannot cause a repeated partial release; the sweeper drains up to cycles.expiry.max-batches-per-sweep batches per tick. Events: reservation.denied on live 409 reserve denials and deepest scope on /decide; budget.exhausted when remaining crosses below zero; event balance events carry the resolved overage policy. Performance: GET /v1/balances reads the budgets:<tenant> index (SCAN fallback); reservation ownership is checked inside commit/release/extend Lua and the GET read; auth uses one pooled connection; release.lua single HMGET.
Three-trial medians of PR head 2399262; all 19 cases passed with zero errors and zero ledger mismatches. No metric approaches the 25% release threshold. Comparison with v0.1.25.55 is unpaired.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes from a review of the server for bugs, spec compliance and performance. Runtime and governance YAML are unchanged.
Suspended tenants (governance spec: "Read-only, no new reservations"; existing reservations can still commit/release)
reserve.luaandevent.luarefuse new budget claims. Dry runs and/decidereturnDENY.Bugs and spec gaps
INTERNAL_ERROR.admin:readsatisfies*:read).expire.luachecks that every refund has a distinct scope, an existing ledger with canonical int64 counters, sufficient reserved funds and room to credit remaining. The tenant-close cascade has already credited CLOSED budgets. After expiry plus grace, the sweeper preserves closed budget snapshots and refunds scopes still holding funds. A CLOSED owning tenant yieldsRELEASEDwithrelease_reason=tenant_closedand a release timestamp visible to admin GET. Ordinary expiry still yieldsEXPIRED. Open budgets with insufficient reserved funds still trigger quarantine before any refund.reservation.deniedfires on live 409 reserve denials;/decidedenials report the deepest scope;budget.exhaustedfires when remaining crosses below zero; event balance events carry the overage policy actually applied.Performance
GET /v1/balancesuses SCAN by default so externally seeded budgets remain visible. Setcycles.balances.use-governance-index=truewhen governance indexes all budgets. Both listing paths skip unreadable rows.cycles.expiry.max-batches-per-sweepbatches (default 20). It advances past entries still in grace so later due reservations can settle in the same tick.release.luauses a singleHMGET.The Maven revision and production Compose image pins are now
0.1.25.60.Reviewer notes
FORBIDDEN: the runtimeErrorCodeenum has no suspended code. A dedicated code needs a spec change.TENANT_SUSPENDEDdecision reason defaults off so v0.1.25.59 replicas can read shared idempotency responses. Enablecycles.decisions.emit-tenant-suspended-reasononce all replicas support it. Before rollback, disable it everywhere and allow 24 hours for existing entries to expire.cycles.auth.enforce-permissions=false./decideneedsreservations:create;/eventsneedsreservations:createandreservations:commit.budget.exhaustednow reports the actualremaining(may be negative) instead of a hardcoded 0.bi1.cursor; legacy scan cursors keep working.Not included
scope_filterenforcement (semantics underspecified).Testing
BENCHMARKS.mdrecords three workstation trials on2399262. The release workflow evaluates its own results, including 200-client throughput, against rolling CI history.