feat(billing): bootstrap Stripe Checkout tenant identity - #573
feat(billing): bootstrap Stripe Checkout tenant identity#573seonghobae wants to merge 12 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
Caution Review failedAn error occurred during the review process. Please try again later. 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. Comment |
1 similar comment
|
Caution Review failedAn error occurred during the review process. Please try again later. 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. Comment |
Buyer/data-integrity objective
Refs #488. This stacked Draft closes the first-subscription identity bootstrap gap between a successful local Checkout attempt and later authoritative Stripe Subscription reconciliation. A signed Checkout event can supply provider Customer/Subscription identities, but it cannot choose a ScopeWeave organization by metadata or arrival order; tenant authority comes from exactly one server-recorded successful local Checkout attempt whose
provider_session_idmatches the verifiedcheckout.session.completedSession ID.Exact current stack
develop:2c328875e00e86537df3e965170be80532571cad;feat/stripe-webhook-reconciliation-queue-488@b8a5dab7117ee30967833abc5c8607dec6490cb8;7e480f0c10ac5598e641fff03d6f7d7a8afca8f2;Any parent, contributor-head, protected-base, review, or check movement invalidates ancestry- and head-sensitive evidence until freshly revalidated.
Implemented authority contract
server/stripe_checkout_identity_bootstrap.mjs:checkout.session.completedSubscription-mode Checkout objects with bounded canonical Session, Customer, and Subscription identifiers;billing_checkout_attemptsrow already recorded asprovider_succeededfor that exact Stripe Session ID;billing_stripe_customersandbilling_stripe_subscriptionsidentity tables instead of creating duplicate ownership state;orgs.plan, entitlement claims, session authority, membership, or RBAC.The webhook bootstrap installs the normalized Subscription identity schema before recorder configuration, performs Checkout identity binding inside the recorder's existing outer SQLite savepoint, then creates the pending reconciliation trigger. A downstream identity or trigger failure therefore rolls verified event/delivery evidence, provider identity, and queued work back together.
server/stripe_webhook_reconciliation_queue.mjsnow maps subscription-modecheckout.session.completedto its Subscription ID only as a reconciliation trigger. Payment/setup Checkout completion remains non-authoritative and produces no Subscription work.TDD and regression evidence
f316a1ec44b0d08cea6bb1f451901f9082d8ec0eintroduced the missing-module Checkout identity contract before production implementation;d0e51bf77787336402244b4eaa5f52ab9223ac37added the isolated normalized binder;811ca9c85d50a26c8822dfbed60a7e8d5203c6a8strengthened the real production webhook bootstrap contract before runtime wiring, including an injected SQLite second-write failure that requires event, delivery, identity, and trigger state to disappear together;package.json,tests/unit/stripe-checkout-identity-bootstrap-package-contract.test.mjs, andtests/unit/coverage-script-contract.test.mjslock the behavior test into normal unit CI and c8 while instrumentingserver/stripe_checkout_identity_bootstrap.mjsas owned production code.Standards and scope boundary
docs/doctoring/stripe-checkout-identity-bootstrap.mdrecords active-PR versus protected-shipped truth, the dual-source authority chain, nested savepoint atomicity, rollback semantics, and APA 7 references to current Stripe Checkout/Event documentation and SQLite savepoints.This slice does not consume the pending reconciliation queue, change retry/backoff/dead-letter state, or itself evaluate/grant entitlement. #569 remains the current-provider reconciliation boundary; #570 owns durable verified-event triggers. Subsequent work must still implement worker claiming/completion and final out-of-order convergence acceptance.
Current evidence boundary
Opening this PR creates fresh repository/organization checks for the exact contributor head. Until every applicable exact-head deterministic/browser/coverage/docstring/CodeQL/SAST/security/dependency/supply-chain/package/provenance gate is terminal and substantive, valid findings are zero, and qualifying independent current-head approval exists under live governance, all pending/queued/absent/stale/predecessor/status-only/model-only evidence is non-passing.
Remain Draft and do not integrate independently of #570/#569/#568 and the preceding #488 billing stack.