Skip to content

feat(db): add dormant R2-B2-A capture preparation - #17

Merged
daniel-tsx merged 1 commit into
mainfrom
chore/r2-b2-a-design
Oct 27, 2026
Merged

daniel-tsx merged 1 commit into
mainfrom
chore/r2-b2-a-design

Conversation

@daniel-tsx

@daniel-tsx daniel-tsx commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

What and why

Add the dormant R2-B2-A SQL boundary between genuine accepted first-capture intent and later financial application. SQL binds P-B/P-C/B1 authority and derives the exact principal, cumulative fee and expected effects; preparation, financial effects, source clearance and terminal capture writes cannot commit before B2-B installs complete validators.

No B2-B/B2-C, monetary-policy change, historical migration edit, runtime writer, scope activation or production installation is included.

Review guide

  • Read carefully: 0015_capture_application_preparation.sql, especially capture_preparation_sources, prepare_capture_application, issuance/permit readers and the independent deferred commit guards. Check equivalent bound capture evidence against independent blockers and P-B historical cause recognition.
  • Skim: schema mapping, appended migration-journal entry, current-chain counts, the legacy comparison extended through 0015, fixture composition and owning-document updates.
  • Least confident about: external provider behavior and operational writer coordination remain unverified and outside this dormant checkpoint.
  • Tests removed, weakened or newly skipped: none. The guard reports the rename “fresh fifteen-migration…” → “fresh sixteen-migration…”; it is the same installation test with the current chain count updated. The six pre-existing RUN_F01_PENDING cases remain gated and are not claimed fixed.

Task size

T2 / HIGH_RISK — LedgerFlow R2-B2-A.

Preserve the canonical CAPTURE terminal identity, immutable accepted command/proof ownership, exact principal/currency/account/policy/epoch, claim fencing, current source revisions, cumulative fee policy and transaction/backend/session permit. Preparation takes own inbox → configured account SHARE → canonical advisory/scope → payment NO KEY UPDATE → ordered attempts. It reuses P-B's protected claim witness and restricted owner.

Only a bounded nonterminal claim may commit separately. Preparation is inspect-and-ROLLBACK only: financial consumers refuse CAPTURE, and independent deferred guards reject preparation COMMIT even when all application/effect groups are omitted. B2-B owns complete atomic financial application; B2-C owns acknowledgment/recovery.

Checks

Local execution is separate from hosted CI.

Result Command Scope / notes
PASS pnpm lint Fresh pre-PR root run; API and web
PASS pnpm test Fresh root run: API 50 + web 3 passed; API 1,331 DB cases gated in this command
PASS pnpm build Fresh Nest/Next production builds
PASS pnpm typecheck Fresh API/web checks after build-generated route types
PASS node scripts/sync-agent-skills.mjs --check Vendored skill synchronization
PASS node scripts/check-engineering-workflow.mjs First-party workflow/resume guards
PASS pnpm test:verification Fresh 34 passed / 0 failed / 0 skipped
PASS node scripts/check-migration-history.mjs origin/main HEAD Committed append-only 0015 + newer appended journal entry; old SQL/snapshots/journal prefix unchanged
PASS node scripts/check-pr-review-signals.mjs origin/main HEAD T2 detected; no focused/new skipped tests or assertion removal; rename-only warning explained above
PASS pnpm test:integration:docker Accepted unchanged implementation: isolated PostgreSQL 17, 1,325 passed / 0 failed / 6 existing F01 gated; 42 suites passed; scoped resource cleanup passed
PASS PostgreSQL 18 B2-A integration/migration suites Accepted unchanged implementation: 78 passed / 0 failed / 0 skipped; exact arithmetic, privilege, independent closure, source admission, observed concurrency and upgrade/rollback checks; disposable cluster removed
PASS git diff --check and source-content bridge Clean task checkout after commit; exactly 17 accepted files; all 588 source files byte-identical before/after commit
PASS Hosted Node 22/24 + PostgreSQL 17 CI Run 40509478599, exact head d5d7e518e67b828779b649a77a019cafd5ff348c: both Node jobs passed all checks; PostgreSQL 17 passed 1,325 / failed 0 / 6 existing gated skips; migration-history and review-signal jobs passed

Unverified boundaries

No actual Stripe/test-mode entitlement, RabbitMQ/Redis runtime, mixed-version writer floor, production credential/session fence, deployment, installation or activation was exercised. Subsequent shared-PI captures, capture failure authority, acknowledgment/recovery and runtime finality remain closed. F01/F04/F05/F06 closure is not claimed.

Review

The human accepted the original independent implementation review, native security review and verification evidence, then separately authorized this commit/push/PR. Original full-source fingerprint: 6a32d1f2fca10f50f1b5ea48bff6c9a3bad67de7b9ea5ee564be186d739bb4c9.

  • Independent code reviewer /root/b2a_code_review: REVIEW_APPROVED; no P0/P1 or acceptance-blocking P2.
  • Independent native security reviewer /root/b2a_security_review: no blocking security findings. Native review was explicitly selected by the human; no Claude/external review is claimed.
  • Correction rounds: 0/2 used.
  • Fresh committed-head publication reviewer /root/b2a_publication_review: REVIEW_APPROVED; no P0/P1/P2 findings on d5d7e518e67b828779b649a77a019cafd5ff348c. Independently reconstructed the original accepted fingerprint using the current actual source bytes/modes and original Git metadata; it matches exactly.
  • Reviewers inspected actual sources and Git/fingerprint evidence; the listed PostgreSQL suites were implementation verification, not independent reviewer reruns.

Engineering workflow r2-b2-a reached HUMAN_APPROVAL with a READY guard before the human-authorized commit. Accepted evidence is preserved unchanged. Git metadata necessarily changes on commit; the separate content-only hash across all 588 source files remains 0e5d594e727b5fdce11a461e62a42e5f3d48e2004187e047321fd9e4a8e4e2a3.

Docs and temporary files

Updated existing owners: docs/database-design.md, docs/payment-lifecycle.md, docs/concurrency.md. Consulted approved accounting contract §16, H01–H12/D01 and accepted R2 design/capture preflight.

Keep ignored .tmp/agent-workflows/r2-b2-a/ state, plan, immutable reviews, verification/final-check evidence and finalization handoff until merge/finalization. Preserve the original design artifacts and PR draft under the task's ignored directory. The initial failed exploratory Docker-run evidence remains per runner policy; the successful run and local PostgreSQL 18 resources were cleaned up. No permanent audit report is added.

Human review required. Do not auto-merge or activate financial writers.

@github-actions github-actions Bot added the t2-area Touches a T2 area: read carefully label Oct 27, 2026
@daniel-tsx
daniel-tsx merged commit 654572c into main Oct 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t2-area Touches a T2 area: read carefully

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant