feat(billing): export bounded reconciliation evidence - #582
Draft
seonghobae wants to merge 37 commits into
Draft
Conversation
|
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: trueThanks 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/audit objective
Refs #488. This Draft child of #579 adds a tenant-scoped, bounded export of durable Stripe reconciliation evidence for incident review, diligence, and customer/auditor evidence without exposing raw webhook payloads, provider credentials, active lease-token hashes, or plaintext operator recovery references.
Exact current stack
develop:2c328875e00e86537df3e965170be80532571cad;feat/stripe-reconciliation-scheduler-488@673fde2c10108783ddcc698cbe4c233d118c3ae9;08d89b004c66e0f0bc57c40d2fcd77965a865213;feat/stripe-reconciliation-evidence-export-488;Any parent, contributor-head, protected-base, review, or check movement invalidates ancestry- and revision-sensitive evidence until freshly revalidated.
Evidence export contract
billing_stripe_subscriptions -> billing_stripe_customers -> organization_id; URL tenant input never substitutes persisted provider/tenant authority.413behavior.attempt_countmust match a complete contiguous append-only attempt history; job lifecycle, latest attempt lifecycle, active-lease state, and recovery/attempt outcome/error linkage must agree. Contradictory restored state fails closed rather than becoming authoritative evidence.Cache-Control: no-store,X-Content-Type-Options: nosniff, an explicit JSON content type, and a fixed attachment filename.schemaVersion,eventCount, andevidenceDocumentSha256; and those exact serialized bytes are then returned. The audit event is therefore bound to the specific exported artifact without copying its private contents into the audit stream.docs/doctoring/stripe-reconciliation-evidence-export.mdrecords active-PR versus protected-shipped truth, operator next actions, privacy/boundedness rationale, and current evidence limitations.TDD and review-driven hardening
The slice was built and hardened through realistic contract-first boundaries on the existing #488 stack. Historical RED/GREEN pairs cover the absent repository module, absent authenticated route, orphaned recovery links, incomplete append-only attempt history, job/attempt lifecycle contradictions, recovery/attempt contradiction, lease consistency, and nested-history bounds. The current tree also contains a file-backed WAL concurrency regression proving the export observes one consistent snapshot while a second connection advances worker state.
A fresh current-source audit found that successful evidence disclosures were access-logged only with schema version and Event count. Two distinct exports with the same count/schema were therefore not cryptographically distinguishable in the audit stream even though the route already had the exact portable artifact before disclosure.
49d9010108fd63b757395bc10af4bd6367630d81changed the existing authenticated API acceptance path to hash the exact response body and require that digest in the durable audit metadata. Its hosted workflow generation was cancelled by the immediate production repair and is retained as test-first lineage, not as passing or failed merge evidence.ab8692718dd1c40c1fd2c4c4551eff66a2fa8390serializes the report once, computes SHA-256 over those exact bytes, writesevidenceDocumentSha256before disclosure, and returns the same bytes. Audit-sink failure still returnsstripe_reconciliation_evidence_export_audit_failedwithout disclosing the report.08d89b004c66e0f0bc57c40d2fcd77965a865213updates code-current doctoring for the digest-binding and one-snapshot contracts.No security gate, threshold, production file, or review requirement was weakened to obtain the repair.
Current evidence boundary
Fresh workflow runs for exact contributor head
08d89b004c66e0f0bc57c40d2fcd77965a865213exist but are currently queued and therefore non-passing:32762464997— queued;32762465045— queued;32762465461— queued.Other applicable exact-head gates are absent from this stacked-head enumeration and are non-passing, not implicitly successful. The repository-wide Server Tests exact-contributor checkout repair remains owned by #523 and has not reached protected
develop; the centrally reusable SAST/Security exact-head defect remains on its existing.githubowner path. Synthetic merge, predecessor, cancelled, absent, skipped-required, model-only, status-only, queued, or stale evidence does not transfer. There is no qualifying independent exact-current-head approval.Remain Draft. Do not integrate independently of #579/#575 and the preceding #488 stack. Before integration, refetch the then-live prerequisite stack and require every applicable exact-head deterministic/browser/owned statement-branch-function-line coverage/docstring/CodeQL/SAST/security/dependency/supply-chain/package/SBOM/provenance/recovery/review gate under live governance.
Primary implementation basis