Skip to content

PAY-003A13: reject impossible Checkout chronology - #591

Merged
daliu merged 1 commit into
mainfrom
codex/issue-590-checkout-chronology
Aug 2, 2026
Merged

daliu merged 1 commit into
mainfrom
codex/issue-590-checkout-chronology

Conversation

@daliu

@daliu daliu commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Outcome

Newly delivered supported Checkout Events now reject an embedded Checkout Session that claims it was created after the Event carrying that Session, before any target or business work.

Closes #590
Parent tracker: #106

Exact review identity

  • Base: 56332507f394f419616acfa6320f1bfbb16c60b5
  • Head: 8929be85a8276a02a2222c5b64e53d3723799ec4
  • Tree: 8a000d30283e1b6e876b703dbf25a27182cd11bf
  • Patch SHA-256: 172f0cbac9e1d461e3e34e41bf158dbbbed54152a9b4ed1470b3076eff8f0f80

Invariant and failure behavior

After exact processed-Event replay and the existing Checkout realm, lifecycle, metadata, outer Event-time, and Session-time structure checks:

Checkout Session.created <= Event.created

Equality is valid because both provider fields use whole seconds. A later Session second produces fixed durable needs_review:invalid_checkout_session_event_chronology with:

  • valid outer stripeCreatedAt;
  • null target fields;
  • fixed redacted logging;
  • no Session-time timestamp conversion, storage, response detail, or logging;
  • no reference/fallback query, provider binding, business read/mutation, money check, or transition.

Equal and earlier chronology preserve existing lifecycle outcomes. Valid claimed missing targets remain retryable. Exact replay remains read-only and authoritative.

Changes

  • functions/stripeWebhook.js: one Checkout-only strict chronology comparison and fixed reason after both time-shape checks.
  • functions/stripeWebhook.test.js: one named 62-test PAY-003A13 matrix/helpers and only three inherited chronology-valid fixture corrections in PAY-003A8, A10, and A11.
  • STRIPE_COMMERCE_DESIGN.md: one PAY-003A13 SOURCE ONLY / NOT LIVE contract and chronology-specific A12 historical reconciliation.

No schema, Rule, index, package, workflow, API, provider configuration, migration, backfill, history repair, or live change.

Trustworthy RED

On the exact base, the test-only four-lifecycle × two-domain matrix failed 8/8 because later Session time reached normal target/business processing and recorded payment_confirmed, payment_failed, or payment_expired instead of fixed target-free review.

Test-only diff SHA-256: 027964b02b0151a1adb6c061dee22c94c231c0cd121a8f6a30cdb61cb31a1f51.

Verification

Node 20.20.2 and Java 21; Firebase commands used demo projects and emulators only.

  • PAY-003A13: 62/62
  • Complete webhook: 822/822
  • Functions lint: passed
  • Functions full: 7,284 passed; 64 intended skips
  • Frontend: 951/951
  • Workflow/artifact/supply safety: 86/86
  • SPA navigation: 11/11
  • Firestore Rules demo emulator: 418/418
  • Commerce command-journal demo emulator: 63/63
  • Frontend lint baseline: 118 files; 113 reviewed legacy errors; 6 reviewed legacy warnings
  • Diagnostic build: passed
  • Workflow YAML and diff checks: passed
  • Dependency audits, unchanged by this no-package patch: root full 59, root production 4, Functions 8; no forced upgrade

A discarded diagnostic inherited shell-default Node 22 and reproduced a known Error-own-surface mismatch in an unrelated projection suite. Under the required Node 20 runtime, that suite passed 25/25 and the complete Functions suite passed as listed.

Three independent exact-diff reviews returned GO: runtime/security, tests/compatibility, and design/backup-officer continuity.

Self-review

  • Authorization/App Check: no callable, authorization, or browser-write surface changed.
  • Input bounds/coercion: comparison occurs only after both values pass the existing primitive safe-integer and inclusive Firestore-range checks.
  • PII/secrets/logging: Session time is never stored, returned, converted, or logged; review logs remain fixed and redacted.
  • Idempotency/replay: the existing processed Event remains first, byte-preserving, and log-once.
  • State transitions: contradictory evidence stops before all target work; equal/earlier lifecycle outcomes remain unchanged.
  • Non-Checkout behavior: refund Charge chronology keeps its existing reason; all Dispute and unsupported Event behavior remains unchanged.
  • Production fallback: none added; no provider call or production service is used.
  • Migration: none; historical processed ledgers remain authoritative.

Officer continuity

Officer impact: None — server-only pre-target evidence comparison. No officer screen, task, field, permission, topology, approval path, incident step, or available recovery action changes.

Officer documentation: None — current officer procedures remain factual. The engineering boundary is documented in STRIPE_COMMERCE_DESIGN.md.

Deployment evidence

  • Source changed: yes, in this PR.
  • Tests passed: yes, locally as listed; hosted CI pending.
  • Code merged: no.
  • Website published: no.
  • runmprc.com verified: no.
  • Firebase deployed/read back: no.
  • Stripe or outside provider configured/contacted: no.
  • Production data changed: no.
  • Checkout/payment/refund/dispute performed: no.
  • Production behavior verified: no.

Source and synthetic tests prove none of the unverified deployment/provider/live states.

@netlify

netlify Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for luminous-fox-7c393f ready!

Name Link
🔨 Latest commit 8929be8
🔍 Latest deploy log https://app.netlify.com/projects/luminous-fox-7c393f/deploys/6a6ea6c1ad8a810008fd922f
😎 Deploy Preview https://deploy-preview-591--luminous-fox-7c393f.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@daliu
daliu merged commit 38600a1 into main Aug 2, 2026
9 checks passed
@daliu
daliu deleted the codex/issue-590-checkout-chronology branch August 2, 2026 02:12
@daliu

daliu commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

FINAL MERGE / RELEASE RECORD

Exact reviewed head 8929be85a8276a02a2222c5b64e53d3723799ec4 squash-merged as exact main 38600a13aeaf57fa1c4d5571efa72af09ea983a1; tree 8a000d30283e1b6e876b703dbf25a27182cd11bf and patch SHA-256 172f0cbac9e1d461e3e34e41bf158dbbbed54152a9b4ed1470b3076eff8f0f80 remained identical. Exact-main CI 30728441536 passed all five jobs.

Officer impact: None — server-only pre-target evidence comparison.
Officer documentation: None — no officer-visible or operational procedure changed.
Deployment evidence: source/tests/merge only. No GitHub deployment, Firebase deployment/readback, Stripe/provider action, production data, checkout/payment/refund/dispute, or live verification. Netlify preview was nonproduction; the exact-main production attempt errored with no publication; the live site remains bounded #473 source 9ad6837756cdd409d296009fde5082eeeae5c059.

#590 is closed and its claim is explicitly released.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PAY-003A13 — Reject impossible Checkout Session/Event chronology

1 participant