Repository navigation
feat(db): add dormant shared payment-proof envelope (P-A) - #8
Merged
Merged
Conversation
Add dormant REFUND_V1 and PAYMENT_OPERATION_V1 manifest branches with exact ownership and immutable provenance checks. Preserve REFUND application gates, historical migrations and all financial assertions. Verified 1014 PostgreSQL integration cases and 50 unit tests; six historical F01 financial failures remain unchanged. Fresh independent review approved P-A only; no payment application or financial scope is activated.
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.
What and why
Add the dormant P-A shared payment-proof envelope.
REFUND_V1remains the default;PAYMENT_OPERATION_V1requires an exact owned B1 proof and immutable original command/source/execution/receipt provenance. No payment application, capture intent, financial posting or financial scope is activated.Review guide
0012_shared_payment_proof_envelope.sqlbranch CHECK, generated conditional FKs, canonical-root/provenance trigger and restricted NOLOGIN owner; corresponding Drizzle mapping and the two new PostgreSQL suites.Task size
T2 / HIGH_RISK. Invariants: exactly one complete tagged proof branch; payment/merchant/currency/account/operation ownership; immutable original evidence; legacy REFUND behavior; restricted SQL privileges; deferred effect closure and rollback. Forward DDL is transactional with a10s lock timeout and preserves all0000–0011 SQL and prior journal entries. No monetary policy, runtime handler or financial application gate is opened.
Checks
pnpm test:integration:dockersettlement-f01.pending.spec.ts,RUN_F01_PENDING=1pnpm --filter @fintech-lab/api test:unit --cache=falsepnpm testbefore publicationpnpm lint;pnpm build; post-buildpnpm typecheckpnpm test:verificationnode scripts/check-migration-history.mjs origin/main HEAD;node scripts/check-pr-review-signals.mjs origin/main HEAD991554cd52ef274cee2d7208be217d0476a4cf5c: all five jobs green. Node22/24 checks passed; PostgreSQL1014 cases/36 suites passed with6 intentional F01 skips; append-only history and review signals passed. Completed job logs independently inspected.Unverified boundaries
Native PostgreSQL18, actual Stripe/provider calls, live Redis/RabbitMQ and deployed role/fencing/cutover behavior were not exercised. P-B MANUAL authorization application, P-C protected capture intent, B2-A monetary preparation, B2-B effects, B2-C recovery and B3 activation remain separate work. Existing F01 defects remain unchanged.
Review
engineering-workflowtaskr2-prerequisite-p-a-implementation, HIGH_RISK: independent/root/pa_plan_review_resumereturned PLAN_APPROVED; fresh read-only/root/pa_code_review_1inspected the actual SQL/diff/privileges/evidence and returned REVIEW_APPROVED with no P0/P1/acceptance-blocking P2. One of two correction rounds fixed historical0011 fixture selection and added0012 coverage without changing financial assertions. FINAL_GATE passed and stopped at HUMAN_APPROVAL; the human subsequently authorized commit, push and this draft PR. The full571-file staged tree was checked against the approved source before commit.Docs and temporary files
Updated existing
docs/database-design.mdfor the durable dormant contract; no permanent per-run report. Consulted approved H01–H12/D01 decisions, capture accounting §16, R2-A/B1 contracts and accepted P-A design.Local ignored
.tmp/agent-workflows/r2-prerequisite-p-a-implementation/retains the original checkpoint/history, plan, immutable plan/code reviews, compact verification/final checks and preserved original blocked evidence. Failed Docker/F01 evidence remains local; passing-run outputs were removed by the runner. The isolated task checkout is.tmp/r2-prerequisite-p-a-implementation/worktreeand will remain through PR disposition. No temporary files or environment values are committed.