Skip to content

CI-001B3 — Gate the commerce command journal on the Firestore emulator #167

Closed

Description

@daliu

Officer impact: Pull requests gain one clearly named safety check. Officers still review a green/red result and do not run terminal commands.

Officer documentation: Update OFFICER_START_HERE.md and docs/officers/PUBLISH_AND_CHECK.md so the plain-language checklist names this check and says what a red result means.

Deployment evidence: Closure must prove the job on the pull-request commit and the merged commit. It must separately state website, Firebase, Stripe/provider, and live behavior. This issue changes CI only.

Parent and dependency

Atomic child of #105. PAY-002B2A/#165 merged as 59aa088a50ba2934d830a460c0a865a631a293d6 and supplies the dedicated opt-in emulator suite. No live issue, claim, or pull request represents this gate.

Problem

The command journal transaction has local Firestore emulator proof for concurrency, conflicts, orphan prevention, and retries. Hosted Functions CI intentionally skips that suite because it does not start exact project demo-pay002b2-test or set REQUIRE_COMMERCE_COMMAND_JOURNAL_EMULATOR=1.

A later lease/fencing change could therefore pass hosted unit tests while breaking the real Firestore transaction boundary.

Outcome

Add one named blocking CI job: Commerce command journal emulator.

It must:

  1. run on every pull request and push already covered by ci.yml;
  2. use Node 20 and Java 17;
  3. install only committed root and Functions lockfiles;
  4. start only the Firestore emulator with exact demo project demo-pay002b2-test;
  5. set the explicit journal-suite opt-in;
  6. run only commerceCommandJournal.emulator.test.js in band;
  7. make a guard failure or test failure fail the job;
  8. use no secret, cloud credential, production project, network provider, Stripe call, or production data.

The protected release workflow must require exactly one successful result for this job both at initial preflight and after protected approval. The release must stop if the job is missing, duplicated, skipped, cancelled, stale, or failed.

Security invariants

  • The project ID is a Firebase demo project so non-emulated service access fails.
  • The test itself continues to require an explicit loopback host and exact opt-in.
  • Use the lockfile Firebase CLI; do not install latest or a global CLI.
  • Do not weaken the standard Functions or Rules jobs.
  • Do not combine the Rules project with the journal project.
  • Do not expose secrets, real command IDs, member data, provider IDs, Checkout URLs, or payment data.
  • A green emulator job proves source behavior only. It does not prove Firebase deployment, Stripe configuration, or live behavior.

Exact source boundary

  • .github/workflows/ci.yml
  • .github/workflows/deploy.yml
  • tests/ci-workflow.test.js
  • tests/release-workflow.test.js
  • SECURITY.md
  • OPERATIONS_RUNBOOK.md
  • GITHUB_ISSUES.md
  • GITHUB_ISSUE_SLICES.md
  • OFFICER_START_HERE.md
  • docs/officers/PUBLISH_AND_CHECK.md

Post a scope amendment before editing packages/lockfiles, journal runtime/tests, Functions/Rules source, other workflows, environment files, provider settings, or production data.

Acceptance criteria

  • PR CI shows one named Commerce command journal emulator job and it passes the exact six-test suite.
  • The job uses Node 20, Java 17, committed lockfiles, exact demo project, Firestore only, explicit opt-in, and an in-band focused Jest target.
  • Static tests reject a missing/renamed job, wrong project, missing opt-in, broad emulator scope, non-lockfile CLI, or omission from either protected-release recheck.
  • Existing Frontend, Functions, and Rules jobs remain green.
  • Protected release source requires all four named CI jobs at both checks.
  • Post-merge CI proves the new job on the merge commit.
  • Officer and engineering docs distinguish local proof, hosted proof, merge, deployment, provider configuration, and live behavior.
  • No runtime, package, lockfile, provider, Firebase deployment, Stripe action, website publication, or live behavior is changed or claimed.

Verification

  • Parse both workflow YAML files.
  • Run the new static workflow tests and the existing release-verification tests.
  • Run focused journal unit and dedicated emulator suites locally.
  • Run Functions lint/full tests, frontend, SPA, Rules, and diagnostic build.
  • Review the exact diff and sensitive patterns.
  • Obtain two independent exact-snapshot reviews.

Migration and rollback

No data/schema migration. Rollback is the reviewed workflow/docs commit only, but removing the gate reopens a known concurrency-verification gap and must not be done silently.

Claim protocol

Creation is not a claim. Before editing: confirm exact current main, assign the issue, post CLAIMED by /root at <UTC> with branch codex/issue-167-journal-emulator-ci, apply status:in-progress, and use an isolated worktree.

Activity

  1. added
    priority:P0Launch blocker or urgent security risk
    type:securitySecurity or privacy boundary
    area:firebaseFirebase services and data
    area:ciContinuous integration and deployment
    size:SSmall focused issue
    status:readyDependencies complete and ready to claim
    area:stripeStripe payments and financial lifecycle
    type:testingTest infrastructure and quality gates
    on Jul 13, 2026
  2. daliu commented on Jul 13, 2026

    @daliu
    ContributorAuthor

    CLAIMED by /root at 2026-07-13T17:03:42Z on branch codex/issue-167-journal-emulator-ci, exact base 59aa088a50ba2934d830a460c0a865a631a293d6.

    Ownership is limited to the ten exact paths in the issue. Journal runtime/tests, packages/locks, Rules/Functions source, provider settings, environment files, and production data remain untouched.

  3. added
    status:in-progressClaimed and actively being implemented
    and removed
    status:readyDependencies complete and ready to claim
    on Jul 13, 2026
  4. self-assigned this
    on Jul 13, 2026
  5. daliu commented on Jul 13, 2026

    @daliu
    ContributorAuthor

    EXTRACTION FINISHED — 2026-07-13T17:15:29Z

    Exact scope: the ten claimed paths only.

    Critical hashes:

    • CI workflow: 3532ff02a50f23eadd119d418c3faa645161c3ac10a89a170722273e92296165
    • protected release workflow: 61ef8ad013d9b06a52fba5dff81559c3fa3885babf7a2bfcbcb7e7ae41df1312
    • CI negative tests: 1b7512e66d302f636941391e7134aad2fa5ae28e7ff5a0cc91451cb7cca56c80
    • release tests: 61093dd2f669bbf1b95b1b769618f38dbfeb7546969039ff07555b1d3366003a

    Local verification:

    • exact Node 20/Java 17 hosted command: journal emulator 6/6
    • workflow/static/release/readback: 16/16; both YAML files parse
    • Functions lint and full tests: 701 passed, 7 skipped
    • frontend: 132/132; SPA: 10/10
    • Firestore Rules: 305/305
    • diagnostic build: passed
    • changed-test lint, diff, selected relative links, and sensitive-pattern scan: passed

    The static guard rejects missing/renamed jobs, wrong projects, missing opt-in, broader emulator scope, unlocked CLI use, changed test target, conditional skips, continue-on-error, shell failure swallowing, and omission or relocation from either protected-release recheck.

    Three independent reviews approved the exact workflow, test, documentation, and scope snapshot. This is CI/source evidence only; it deploys no Firebase code, contacts no Stripe/provider service, publishes no website, and proves no production behavior.

  6. daliu commented on Jul 13, 2026

    @daliu
    ContributorAuthor

    COMPLETE — PR #168 merged as exact main e1f887203e4ba75d22908f3ef51259a339aaaa08.

    Hosted evidence:

    • PR CI 29269762240: all four GitHub jobs passed; the new Commerce command journal emulator job passed the exact 6/6 suite in 53 seconds; Netlify preview 6a551d5cdec3840007a55181 was ready
    • post-merge CI 29269902441: all four jobs passed on the merge commit; the journal job passed in 54 seconds
    • protected release 29269992663: exact-current-main preflight accepted the successful four-job push CI, proving the new job is a release prerequisite
    • three independent exact-snapshot reviews approved

    Deployment truth:

    • the protected release then failed closed before build because the required public App Check/reCAPTCHA site key is absent
    • GitHub Pages and Firebase deployment were skipped
    • automatic Netlify production deploy 6a551ddd230b80000865d997 errored and was not published
    • the last ready Netlify production revision remains e86a0f702cff6495f50630c5de3337290db8b8cb
    • no website, Firebase, Stripe/provider, or live behavior changed or was claimed

    The ten-file claim is released. PAY-002B2B may now extend the existing journal/emulator files and will be gated by this named hosted job.

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

Metadata

Metadata

Assignees

Labels

area:ciContinuous integration and deploymentarea:firebaseFirebase services and dataarea:stripeStripe payments and financial lifecyclepriority:P0Launch blocker or urgent security risksize:SSmall focused issuetype:reliabilityReliability and recoverytype:securitySecurity or privacy boundarytype:testingTest infrastructure and quality gates

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions