Skip to content

PAY-002B2C3A — Freeze the closed Stripe reconciliation decision contract #184

Closed

Description

@daliu

Officer impact: None. This child adds an unused server-only policy and tests. It changes no current checkout, payment, refund, or officer procedure.

Officer documentation: None — no public page, officer duty, provider account, deployment, or production behavior changes.

Deployment evidence: Source/tests only. Closure must explicitly say whether website, runmprc.com, Firebase, Stripe/provider configuration, and production behavior were changed; no green workflow proves those surfaces live.

Problem

PAY-002B2C2/#182 safely stops automatic POST retries when the original attempt is old or ambiguous. The next boundary must not turn a timeout, connection loss, Stripe 5xx, pruned idempotency key, missing reference, 404, or partial/empty search into permission for attempt 2.

A persistence or runtime API would be premature until the allowed evidence matrix is closed and exhaustively tested. Current C2 source also does not record a complete dispatch/response history.

Atomic outcome

Add one pure CommonJS classifier for attempt-1 reconciliation evidence. It returns only fixed frozen classifications:

  • existing_attempt_found — exact verified attempt-1 provider evidence exists; do not advance.
  • new_attempt_candidate — evidence is structurally sufficient for a later persistence/authorization review, but this result is not permission to send.
  • reconciliation_required — outcome remains unsafe or unknown; do not advance.

The first version may produce new_attempt_candidate only for:

  1. a complete trusted dispatch history proving endpoint execution never began, with exact plan binding and an explicitly eligible same logical operation; or
  2. an exact verified attempt-1 Checkout Session that is terminal expired, unpaid, bound to the exact plan, supported by verified expiry evidence, and paired with an explicitly eligible new logical generation.

An exact open attempt, or exact completed paid/no-payment-required attempt with verified success evidence, may produce only existing_attempt_found.

Every other valid evidence combination produces reconciliation_required. Invalid/schema-hostile input fails with one fixed non-identifying error.

Non-negotiable exclusions

  • No Firestore read/write or reconciliation record.
  • No Stripe/network/provider call or SDK dependency.
  • No provider-object ID, idempotency key, account, metadata, amount, member, order, or registration value in input/output.
  • No runtime/index import.
  • No send/execute/advance authorization, attempt-2 plan/key/document, response replay, or business transition.
  • No caller-selected free text, URLs, status codes, timestamps, reason strings, or booleans that can bypass the closed enum matrix.
  • No package/lock/workflow/Rules source/provider configuration/production data/officer procedure change.

Exact owned paths

  • new functions/commerceProviderReconciliation.js
  • new functions/commerceProviderReconciliation.test.js
  • STRIPE_COMMERCE_DESIGN.md
  • SYSTEM_DESIGN.md
  • SECURITY.md
  • IMPLEMENTATION_PLAN.md
  • GITHUB_ISSUES.md
  • GITHUB_ISSUE_SLICES.md

All other paths are excluded, especially functions/commerceCommandJournal.js, checkout creators, webhook runtime, index, Rules, package/lock/workflows, account/email/profile code, and officer docs.

Acceptance

  • Exact root fields, schema version, provider stripe, and attempt 1 only.
  • Closed enum matrix covers complete dispatch-never-began, exact open/success/expired provider evidence, and every unsafe/contradictory combination.
  • Timeout, connection loss, 409/424/429/5xx, old/pruned key, missing reference, 404 without an exact known object, empty/partial search, unknown/open/complete-processing/conflicting Session evidence never produces a candidate.
  • Results and error text are fixed/frozen and contain no input.
  • Extra/missing/inherited/symbol fields, accessors, proxies, custom prototypes, invalid Unicode, unknown/future enums, and mutation attempts fail closed without invoking traps.
  • Static tests prove no Firebase, Stripe, network, logger, environment, clock, random, filesystem, dynamic import, or runtime/index adoption.
  • Focused and full Node 20 Functions suites, frontend suite/build, Rules suite, and workflow/artifact guards pass.
  • Security, test/coverage, and documentation reviews approve the exact diff.

Dependencies and follow-ups

Dependencies complete: PAY-002B2C2/#182 merged as 95be260d08377b7e931dd3526da91b59c5fbf755; PAY-003A/#101 evidence vocabulary is merged.

This child does not complete PAY-002B2C3. Follow-ups remain:

  • C3B: persist immutable paired reconciliation evidence only after a trusted verifier can produce it.
  • C3C: authorize/version a later provider attempt only after persisted proof plus business transition and a fresh lease.
  • PAY-001B/C, PAY-002C/D, PAY-003B, RACE/MERCH capacity/inventory, runtime adoption, protected deployment, and live verification.

Activity

  1. self-assigned this
    on Jul 13, 2026
  2. added
    priority:P0Launch blocker or urgent security risk
    type:securitySecurity or privacy boundary
    size:MMedium multi-file issue
    status:in-progressClaimed and actively being implemented
    area:stripeStripe payments and financial lifecycle
    on Jul 13, 2026
  3. daliu commented on Jul 13, 2026

    @daliu
    ContributorAuthor

    CLAIMED by Codex agent /root at 2026-07-13T21:47:40Z.

    Branch: codex/issue-184-pay-002b2c3a-policy
    Isolated worktree: /Users/daveliu/Code/Run-MPRC.issue-184
    Exact base: 95be260d08377b7e931dd3526da91b59c5fbf755

    Owned paths are exactly the eight listed in the issue body: two new pure policy/test files plus six narrow root design/status documents. All journal persistence, checkout/webhook/runtime/index, Rules, package/lock/workflow, provider, production-data, account/email/profile, and officer paths are excluded.

    Invariant: classification is not authorization. This child cannot send, execute, advance, persist, or prove provider truth. C3B/C3C remain required.

  4. daliu commented on Jul 13, 2026

    @daliu
    ContributorAuthor

    EXTRACTION FINISHED by Codex agent /root at 2026-07-13T22:01:25Z.

    Exact staged scope is the eight claimed paths only: the new pure classifier/test plus the six named root design/status documents. git diff --cached --check is clean.

    Verification on Node 20 / Java 17:

    • focused reconciliation policy: 45/45
    • complete Functions Jest: 990 passed, 32 intentionally skipped
    • Functions ESLint: passed
    • frontend Jest: 133/133
    • standalone SPA safety: 10/10
    • artifact safety: 22/22
    • Firestore Rules: 317/317
    • command-journal emulator: 31/31
    • diagnostic production build: passed

    Three independent read-only reviews approved the exact corrected diff: security/correctness, adversarial tests, and documentation/dependency truth.

    Officer impact: None. No current checkout, payment, refund, page, or officer procedure changes.

    Officer documentation: None — this module is unused and has no officer-visible behavior.

    Deployment evidence: source/tests only. No runtime/index import, Firebase deployment, Stripe/provider call or configuration, website publication, runmprc.com verification, production data access, or live behavior. C3B evidence persistence and C3C later-attempt authorization/versioning remain open.

  5. daliu commented on Jul 13, 2026

    @daliu
    ContributorAuthor

    COMPLETE / CLAIM RELEASED at 2026-07-13T22:06:30Z.

    PR #185 admin-squash merged exact reviewed head f43237c2952e7ab334f1c2ad4d4b0ed6eb09cd69 as main 5c7d2d160237465b367c4dcc799cefcfab1e4e9b.

    Post-merge exact-main CI run 29288647739 passed all five jobs:

    • Frontend lint + build
    • Cloud Functions lint + test
    • Commerce command journal emulator
    • Firestore security-rules tests
    • Test artifact scrubber

    PR Netlify preview completed successfully. It is preview evidence only, not production publication.

    Three independent reviews approved the final eight-path diff after fixes. The source contract has exactly two candidate tuples, exact open/success existing-attempt tuples, and one fixed fail-closed reconciliation result for every other valid combination. Hostile input remains fixed-error/redacted.

    Officer impact: None.
    Officer documentation: None — no officer-visible behavior changed.
    Deployment evidence: Source/tests/merge only. No runtime/index adoption, Firebase deployment, Stripe/provider call or configuration, production data action, website production publication, runmprc.com revision verification, or live behavior. C3B and C3C remain open.

    The #184 path claim is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:stripeStripe payments and financial lifecyclepriority:P0Launch blocker or urgent security risksize:MMedium multi-file issuetype:reliabilityReliability and recoverytype:securitySecurity or privacy boundary

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions