Repository navigation
Fix reservation fixture after migration identity restoration - #135
Draft
sidneyswift wants to merge 8 commits into
Draft
sidneyswift wants to merge 8 commits into
sidneyswift wants to merge 8 commits into
Conversation
AI work needs to authorize capacity before paid calls start and settle the actual charge exactly once afterwards (app#2105 milestone 1, which Context accounting app#2123 reuses). The existing preflight only reads the balance, so concurrent requests can each pass it and overspend. Holds live in a new credit_reservations table; they are claims, never temporary debits, so refill, top-up and auto-top-up never see them as consumption. Reserve, settle and release lock the owner's single wallet row first and compute spendable = remaining_credits - outstanding holds. Settlement charges through record_credit_charge_once with the same operation key, so reservation and charge share one retry-stable identity. Service role only; no price, ceiling, expiry, top-up or caller is added, and legacy debit writers still ignore holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-up for credit reservations. The service role's UPDATE grant now covers only the closing columns (state, credits_charged, charge_event_id, closed_at), so a hold's owner, key and amount cannot be rewritten outside the functions; a new test checks this and that the service role can still read open holds to reconcile a lost key. The docs now say that connecting any caller requires database#101 and api#1009 (main's API top-up and refill still write an absolute balance read earlier, which can erase a settlement) and database#88. The top-up and refill tests are renamed to say they model atomic writers. The docs also note that every raised rejection is SQLSTATE 22023 and rolled back, and that a held receipt is not an execution lease for duplicate deliveries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Updates to Preview Branch (codex/reservation-history-composition) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
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.
Composing Database #134 with #125 leaves the new reservation fixture opening the old pack migration filename, which #125 restores to its recorded version. The affected suite fails before running any tests. This isolated successor normally merges both existing candidates and changes only the fixture to import the owning release-pack fixture's migration constant.
No SQL bytes are changed: all282 migration files match the previously inspected combined tree914fc433104f34dd2bee7fc9b86da6bc0ea6f858. Original #125, #134 and #115 branches remain untouched and open; this PR does not close or authorize merging them.
Validation: reproduced the exact FileNotFoundError on PostgreSQL17, then all17 affected composition tests passed on PostgreSQL15 and17. Independent narrow review is recorded separately. Catalog's completed four-migration bundle qualification was not repeated. Normal required CI still applies.
Release boundary: this full combined tree exposes SIX pending migrations against the November17 collected production ledger, not Catalog's reviewed four:20261010210500,20261022120000,20261106120000,20261110010000,20261110010100,20261117000000. Merging this PR as-is is therefore not an inert test-only release. Keep draft pending root's four-first versus six-file disposition and exact integration executor/ordering/transaction semantics. If #125's four are released first, refresh the actual ledger before claiming only the two reservation versions remain. No hosted apply, migration-history repair, grants, access, financial data, spending or activation was performed or authorized. Root owns the merge/release decision.
Summary by cubic
Fixes the credit reservation composition fixture after migration identity restoration so the affected suite no longer fails before running any tests. The fixture now imports the owning release-pack fixture's migration constant instead of the old
20261020150000_release_pack_jobs.sqlfilename.Combines the previously open #125 and #134 with no SQL byte changes — all 282 migration files match the previously inspected combined tree, and only the fixture file and two renamed migration files are touched. The affected release-pack and professional-account migrations are restored to their recorded names (
20261020154953and20261024002432). Reproduced the exactFileNotFoundErroron PostgreSQL 17, then all 17 affected composition tests passed on PostgreSQL 15 and 17.Release
20261010210500,20261022120000,20261106120000,20261110010000,20261110010100,20261117000000.Written for commit e1a42e9. Summary will update on new commits.