feat(billing): fetch authoritative Stripe invoice state - #561
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 Draft child of the Stripe entitlement-policy stack adds the authoritative Invoice read boundary required before paid Invoice evidence can become an entitlement-policy input. It verifies exact server-owned Invoice, Customer, Subscription, and organization authority; bounds Stripe transport and response parsing; supports the current Basil Invoice provenance shape and the legacy pre-Basil shape without trusting metadata as sole identity authority; and returns immutable payment evidence only.
Exact current stack
develop:df0fa17bd5035af6455c889022c540b4f439e3d6;feat/stripe-entitlement-policy-488@9da3f3663a80cf20aa9562132eb3d1b7f5fcb1d0;e26164934ddbe7417635b6839e78adf29f6d6197;CHANGELOG.md+5/-0 and coverage contract +25/-0.The effective delta is limited to the additive Unreleased changelog, Invoice doctoring, package/coverage registration,
server/stripe_invoice_provider.mjs, and two focused Invoice-reader regressions. No auth/session, Clearfolio, attachment, existing billing persistence, application route, dependency lockfile, workflow, scanner suppression, or branch-protection artifact is changed.TDD and focused evidence
Test-only commit
a83b002210c2448f7cdfaaab94b506ab1c581473registered a realistic Invoice provider contract before the production module existed, making the new boundary RED at module resolution. Implementation commite26164934ddbe7417635b6839e78adf29f6d6197added the reader, edge coverage, additive parent-style coverage contract, doctoring, and changelog evidence.Private focused execution after implementation passed all seven Invoice-reader subtests and produced 100% line / 100% branch / 100% function coverage for
server/stripe_invoice_provider.mjs. Hosted exact-head evidence remains authoritative for integration.Provider and compatibility contract
GET https://api.stripe.com/v1/invoices/{invoice}with a 15-second abort budget and redirects rejected;parent.type=subscription_details/parent.subscription_details.subscriptionsupport plus legacy top-levelsubscriptionsupport, failing closed when both shapes disagree;status_transitions.paid_at, currency, amount, and timestamp consistency checks; andStripe-Versionpin in this slice, preserving the existing account-default API-version boundary while rejecting provider shapes outside the tested current/legacy contracts.Stripe's current Invoice reference exposes
parent.subscription_details.subscription; Stripe's2025-03-31.basilbreaking-change record explicitly moved Subscription provenance into thatparentshape while deprecating the prior top-level fields. The doctoring record captures the current/legacy compatibility boundary and APA 7 references to Stripe's primary documentation.Current exact-head evidence
Fresh repository-native workflows for unchanged head
e26164934ddbe7417635b6839e78adf29f6d6197are queued and therefore non-passing:32277320425;32277320435; and32277320865.There are no submitted reviews or review threads on this exact head and no qualifying independent current-head approval. Queued, pending, skipped-required, cancelled, absent, neutral-required, failed, stale, predecessor, synthetic, status-only, author-only, or model-only evidence is non-passing.
Scope boundary
This PR does not persist Invoice observations, mutate
orgs.plan, persist entitlement claims, or grant access. Normalized Invoice/payment persistence, transactional claim/audit storage, reversible entitlement application, operator recovery, and end-to-end out-of-order convergence remain subsequent #488 work.Remain Draft. Do not integrate independently of #528 and its prerequisite stack. After the stack reaches protected
develop, reconcile this bounded semantic delta onto the resulting live head and regenerate every then-applicable exact-head deterministic/browser/statement/branch/function/line coverage/docstring/SAST/security/dependency/supply-chain/package/provenance/migration/recovery/review gate required by live policy.