Skip to content

Fix reservation fixture after migration identity restoration - #135

Draft
sidneyswift wants to merge 8 commits into
mainfrom
codex/reservation-history-composition
Draft

sidneyswift wants to merge 8 commits into
mainfrom
codex/reservation-history-composition

Conversation

@sidneyswift

@sidneyswift sidneyswift commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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.sql filename.

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 (20261020154953 and 20261024002432). Reproduced the exact FileNotFoundError on PostgreSQL 17, then all 17 affected composition tests passed on PostgreSQL 15 and 17.

Release

  • No hosted apply, migration-history repair, grants, access, financial data, spending, or activation is performed or authorized by this PR.
  • The combined tree exposes six pending migrations against the November 17 collected production ledger, not the reviewed four: 20261010210500, 20261022120000, 20261106120000, 20261110010000, 20261110010100, 20261117000000.
  • Merging as-is is not an inert test-only release; keep it draft pending root's four-first vs six-file disposition and exact integration/executor/ordering/transaction semantics.
  • If Restore recorded migration source identities #125's four are released first, refresh the actual ledger before claiming only the two reservation versions remain. Root owns the merge/release decision.

Written for commit e1a42e9. Summary will update on new commits.

View guided diff Turn on auto-fix

sidneyswift and others added 8 commits October 10, 2026 16:41
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>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@supabase

supabase Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Updates to Preview Branch (codex/reservation-history-composition) ↗︎

Deployments Status Updated
Database ✅ Tue, 17 Nov 2026 19:48:13 UTC
Services ✅ Tue, 17 Nov 2026 19:48:13 UTC
APIs ✅ Tue, 17 Nov 2026 19:48:13 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations ✅ Tue, 17 Nov 2026 19:48:13 UTC
Migrations ✅ Tue, 17 Nov 2026 19:48:18 UTC
Seeding ✅ Tue, 17 Nov 2026 19:48:18 UTC
Edge Functions ✅ Tue, 17 Nov 2026 19:48:18 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant