feat(billing): recover Stripe reconciliation dead letters - #575
Draft
seonghobae wants to merge 22 commits into
Draft
feat(billing): recover Stripe reconciliation dead letters#575seonghobae wants to merge 22 commits into
seonghobae wants to merge 22 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 |
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.
Buyer/operability objective
Refs #488. This Draft child of #574 adds a bounded operator recovery path for Stripe reconciliation work that exhausted its automatic retry budget. It preserves append-only attempt history and does not reset the automatic retry budget: each explicitly authorized recovery creates exactly one new finite lease/attempt, re-fetches current provider state through the existing authoritative reconciliation service, and returns to
dead_letterimmediately if that manual attempt fails.Exact current stack
develop:2c328875e00e86537df3e965170be80532571cad;feat/stripe-reconciliation-worker-488@18bec1d606b7e6762bf11ff6cf429d024ba729bc;24b1fe3d7f447748aff943bb7f5395ac90cce8ad;feat/stripe-reconciliation-dead-letter-recovery-488;Any parent, contributor-head, protected-base, review, or check movement invalidates ancestry- and head-sensitive evidence until freshly revalidated.
Recovery contract
evidenceReferenceis durable idempotency authority for one Event recovery;orgs.plan, membership/RBAC, or browser session authority.TDD and bounded request repair
The original RED contracts cover tenant isolation, immutable attempt history, retry success/failure, same-evidence replay, new-evidence retry, validation, in-progress replay, transactional audit rollback, API auth/RBAC, tenant non-disclosure, provider reconciliation, idempotent replay, backlog clearing, and durable actor/evidence attribution.
Fresh current-source inspection found an additional ScopeWeave-owned resource-boundary defect: the privileged retry route called
c.req.json()before enforcing any request-body byte ceiling. A tenant administrator could therefore cause the process to buffer an arbitrarily large JSON body even though the durableevidenceReferenceis itself bounded.Repair chronology:
f2d41bc403a0d3d7f8afa67adac1a9adf66757a4adds realistic API regressions for both an oversized declaredContent-Lengthbody and an oversized streamed body with no declared length; both must fail with HTTP 413 and a stable non-secret error;24b1fe3d7f447748aff943bb7f5395ac90cce8aduses Hono's built-inbodyLimitmiddleware at a 4 KiB ceiling, preserving the existing authenticated route and JSON contract while enforcing both declared and streamed byte limits before JSON parsing.This keeps the root-cause fix small and deterministic while leaving the provider, entitlement, audit, and authorization boundaries unchanged.
Coverage and scope
server/stripe_reconciliation_recovery.mjsandserver/stripe_reconciliation_recovery_routes.mjsremain registered in canonical c8 instrumentation. The API recovery regression remains registered intest:apiand therefore in canonical coverage cases. No threshold, production file, security gate, or dependency check was removed to make the repair green.Current exact-head evidence
Fresh repository-native runs for exact head
24b1fe3d7f447748aff943bb7f5395ac90cce8adexist but are not passing evidence yet:32452371660— queued;32452371676— queued;32452371677— queued;32452371662— queued; and32452372112— queued.CodeQL Required is absent from this stacked exact-head enumeration because the repository-wide stacked/exact-head CodeQL control remains in #523 rather than protected
develop; absence is non-passing, not implicit success. There is no qualifying independent current-head approval. Pending, queued, absent, skipped-required, cancelled, stale, predecessor, synthetic, status-only, model-only, rate-limited, or infrastructure-only evidence is not merge authority.Stack and merge boundary
Child #579 was content-forwarded after this parent moved so its current source retains the same bounded recovery-body regression and middleware instead of semantically reverting the repaired parent. Because that child was originally forked from predecessor
c314af00c5949c728909f56bc1aff7c3ee439a50, its ancestry still needs normal stack reconciliation before integration; no force-push or destructive rebase was used.Remain Draft. Do not integrate independently of #574/#573/#570/#569/#568 and the preceding #488 stack. Do not merge or enable auto-merge until the unchanged exact head is reconciled to the then-live prerequisite stack and every applicable exact-head repository/organization deterministic/browser/coverage/CodeQL/SAST/security/dependency/supply-chain/package/provenance/review gate is substantively terminal-passing under live governance.