CODEX TASK 2

You are Cedric (Codex), worker #1, pass 2. Clahadore (Claude) orchestrates and reviews. Your v2 work is committed at a129dce on this branch (wt/WT-dc65/fhir-demo). Clahadore reviewed it: it's good. Do NOT rewrite it. Make these additions, and commit after each numbered item (committing on this branch IS authorized; the council gate runs before main).

Use per-command identity for commits: git -c user.name="Andrew Jones" -c user.email="andrewjonesdev1@gmail.com" commit -m "...". Include the trailers Co-Authored-By: Cedric (Codex) <noreply@openai.com> and Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>.

  1. Static snapshot mode (docs/DEPLOY-TASK.md Part A). This is the PRIMARY demo path for a phone at a restaurant.
  2. Add FhirDemo.Cli snapshot --out web/public/snapshot. It writes JSON for every route the Vue app calls:
    • patients
    • dashboard
    • each patient summary (with CDS cards)
    • the 5 reports
    • a recorded sync result: the REAL second-run counts (0 inserted, 0 updated, N unchanged)
  3. In web/src/api.ts, VITE_DATA_MODE=snapshot maps each API path to the snapshot file. In snapshot mode:
    • POST allergies builds the FHIR AllergyIntolerance JSON client-side (same shape as the server's outbox) and shows it.
    • "Run sync again" returns the recorded result.
  4. Add the npm script build:snapshot.
  5. Generate and COMMIT the snapshot JSON (synthetic data only).
  6. Read-only + security (from docs/STEER.md STEER 2):
  7. Demo:ReadOnly setting: when true, every POST except /cds-services/patient-risk returns 403.
  8. Security headers: CSP default-src 'self'; frame-ancestors 'none'; object-src 'none'; base-uri 'self', X-Content-Type-Options, Referrer-Policy.
  9. CORS allowlist from config.
  10. Tests for ReadOnly and for the headers.
  11. AbortController. Add it to web/src/api.ts. Cancel the in-flight patient summary request when another patient opens, so a stale response can't overwrite a fresh one. Add a small Vitest test for that ordering, and add vitest + a test script.
  12. Deploy IaC (docs/DEPLOY-TASK.md Part B), in a NEW project infra/FhirDemo.Deploy (cdktn C#).
  13. Two stacks:
    • fhir-demo-gcp: a project on billing account 01D28B-C2F0EB-2DC50A, Artifact Registry, a Cloud Run API with Demo__ReadOnly=true, and a $10 budget.
    • fhir-demo-cf: 2 Cloudflare pages_projects, account 2a59c9c45db9f7893484b8ed59604979.
  14. A Dockerfile for FhirDemo.Api.
  15. docs/DEPLOY.md runbook.
  16. Run synth and terraform validate. Try terraform plan only if credentials are already available; NEVER apply, NEVER wrangler deploy, NEVER gcloud mutations.
  17. Put the REAL outputs in docs/VERIFY.md under "Deploy".
  18. Metabase: finish provisioning if feasible in about 20 minutes. Otherwise leave the /api/reports + SVG fallback, and document exactly what's missing under NOT DONE.
  19. README: replace the demo script with the snapshot-first 3-minute script (phone): Overview → patient chart with CDS cards → Add allergy → Compare. Mention the laptop Aspire path only as optional.

DONE = dotnet build, dotnet test, cd web && npm run build && npm run build:snapshot && npm test, and the deploy synth/validate. Paste the REAL outputs into docs/VERIFY.md. Tests blocked by Windows Application Control on this PC must be listed as BLOCKED (not passed). Clahadore will re-run them on another PC.

When finished: git push origin HEAD.