CODEX TASK 11
You are Cedric on gpt-6-astra (high reasoning), worker #1, pass 11: FULL CODE-QUALITY GATE. Run AFTER pass 10 is committed and BEFORE pass 9 (migration), in worktree branch wt/WT-dc65/fhir-demo. Follow docs/ANDREW-STYLE-GUIDE.md. Synthetic data only. Commit per item with git -c user.name="Andrew Jones" -c user.email="andrewjonesdev1@gmail.com" commit and the Co-Authored-By trailers for Cedric (Codex) and Claude Opus 5.5. Push.
COMMIT RULE for this pass: commit and push each item yourself as soon as its own check passes. Do NOT invoke council-code-review and do NOT stop to ask for a review chair. Clahadore runs the council + Fable/Astra review on the whole branch before it merges to main; that is the gate. Passes 10 and Forge 2 stalled uncommitted waiting for a chair; do not repeat that. Never edit an already-applied EF migration; add a new migration instead (flag any pass-10 edits to StatusLiteralBackfill/VerificationStatusBackfill in VERIFY.md with the reason they are safe or a replacement migration).
Andrew (2026-11-12): "this needs to hold up to all of our code quality." The repo becomes a public GitHub repo handed to Innovare, and it deploys to GCP.
0. ONE bar for every track (Andrew: "The SSM style and this style, both have to be to the same standards")¶
Every gate below applies EQUALLY to each of these tracks. No track gets a lighter gate.
- (A) SSM-style lakehouse:
- FhirDemo.Lakehouse: the bronze/silver/gold transforms and gold SQL views
- EFCore.DuckDB, vendored under lib/EFCore.DuckDB from andrewjonesdev-tools/EFCore.DuckDB: source and tests only, never BRIEF/QUACK/REVIEW notes
- the Metabase setup
- (B) Innovare-style operational:
- EF Core / SQL Server / SQLite
- the API, sync and RiskEngine
- the Vue app
- (C) Way 2:
- the Ottehr/Oystehr track (ehr-track/, TypeScript Zambda) from branch wt/WT-dc65/ottehr-track
- merge it into this branch first: git merge origin/wt/WT-dc65/ottehr-track and resolve conflicts
Deliver docs/QUALITY-MATRIX.md: rows = gates, columns = A/B/C, each cell = the command + the pasted result. Add a CI check that fails if any cell is missing.
Per-track specifics:
- A:
- NUnit tests for each medallion layer
- contract tests pinned to captured gold-table output; the gold rows must equal the operational risk flags (the existing parity)
- Stryker mutate scope = the transforms + the provider's SQL generation / type mapping
- Semgrep SQL-injection rules over the raw SQL
- B: as written in sections 1 to 3.
- C:
- Vitest + StrykerJS (break > 0, 0 mutants = fail) on the Zambda risk rules
- Semgrep p/typescript
- npm audit
- a contract test on the captured Ottehr QuestionnaireResponse and the Zambda output
- Way1 = Way2 parity stays in CI
1. Test stack: Andrew's, not xUnit¶
- Convert tests/FhirDemo.Tests from xUnit to NUnit. Convert one file per commit and run the full suite after each one.
[Fact]→[Test],[Theory]/[InlineData]→[TestCase],Assert.Equal/True/Throws→Assert.That(..., Is.EqualTo/...)/Assert.ThrowsAsync,IClassFixture/IAsyncLifetime→[OneTimeSetUp]/[SetUp]/[TearDown].- Remove the xUnit packages entirely; no mixed frameworks.
- Moq replaces hand-written stubs where they are plain stubs (HTTP handlers, ISourceSettings, IUnitOfWork). Keep a hand-written fake only where it carries real behavior, and say why in one line.
- AutoFixture + Bogus for NON-clinical data only: settings, request DTOs, sync-cursor, crosswalk and outbox rows.
- Clinical records stay on the Synthea fixtures. Random A1c/BP values are clinically incoherent and would make the risk tests meaningless.
- Document this in docs/TESTING.md ("Bogus for shape, Synthea for clinical truth").
- Gate: the test count after conversion is >= the count before, and all tests pass. Paste both counts.
2. Mutation testing: Stryker.NET that can FAIL the build¶
- Pin
dotnet-strykerin.config/dotnet-tools.json. Addstryker-config.json. - mutate scope (project-relative globs):
- RiskEngine
- the FHIR→entity mapper
- the sync skip-if-unchanged/upsert logic
- FhirStatus
- (later) the pass-9 reconciliation
- thresholds:
break> 0, set at the measured baseline minus 5, never 0. - A run reporting 0 mutants is a FAILURE (known vacuous-pass trap); assert the mutant count in the CI step.
- Every surviving mutant in RiskEngine is either killed by a new test or listed in docs/TESTING.md as equivalent, with the reason.
- Paste: total mutants, killed / survived / timeout / no-coverage, and the score.
3. Security and supply chain (all OSS, all in CI, all able to fail)¶
- SAST:
- Semgrep (p/csharp, p/typescript, p/secrets), pinned version
- plus the .NET analyzers:
AnalysisLevel=latest-recommended, warnings-as-errors in CI - Dependencies:
dotnet list package --vulnerable --include-transitivefails on any High/Criticalnpm audit --audit-level=highfor web/ and forge-studio/- Secrets: gitleaks over the full tree and history; zero findings.
- DAST: an OWASP ZAP baseline against the API started locally (snapshot/read-only mode) in CI. It fails on High.
- IaC:
cdktn synth+terraform validate+ checkov (or tfsec) on the synthesized JSON; it fails on High. - Invariants: no
allUsersinvoker on Cloud Run, the runtime SA has no project roles, budget present. - Contract tests: at least one test per boundary pinned to a VERBATIM captured payload with an origin comment:
- FHIR Bundle from the HAPI/Synthea producer
- CDS Hooks response
- snapshot JSON consumed by Vue
- Ottehr QuestionnaireResponse
Each asserts the negative (the wrong shape fails).
4. One CI workflow (.github/workflows/ci.yml)¶
- Jobs: build (0 warnings) → test (NUnit) → web tests +
build:snapshot+ e2e → mutation → SAST → deps → gitleaks → DAST → IaC. - Pin actions by SHA. Least-privilege
permissions:. No secrets are needed for any job. - A README badge for CI.
5. Public-release readiness (do NOT publish; Andrew approves that separately)¶
tools/ReleaseAudit(C# console): fails if the tree contains any denylisted string. It reads the list fromrelease-denylist.txt, which the orchestrator supplies at release time; do not write the actual values into the repo.- Run it and paste the output.
- LICENSE: All rights reserved (Andrew, 2026-11-12: "for now all rights reserved since private, we might change it later"). This covers the whole repo, including lib/EFCore.DuckDB:
Copyright (c) 2026 Andrew Jones. All rights reserved.plus a line saying viewing via the shared link is permitted and no license to use, copy or modify is granted. Third-party parts keep their own licenses, listed in THIRD-PARTY-NOTICES.md with name, version/commit, license and path: Ottehr intake JSON, Synthea fixtures, the Floorplan output, and the npm/NuGet packages via the license report. - README rewrite for a hiring manager:
- what it is (2 sentences)
- the two ways
- a 3-command local run (Aspire)
- live links placeholder
- architecture (C4 links)
- the quality gates list with how to run each
- "What I'd do at Innovare"
- Public naming: "Jones" for the AI teammates. Never "GitHub Copilot". Oystehr is described only as "evaluated Oystehr's public FHIR API".
DONE¶
dotnet build(0 warnings)- NUnit suite all green (count >= before)
- Stryker: mutants > 0, score >= break
- semgrep / deps / gitleaks / ZAP / IaC scan outputs with 0 High/Critical
npm test,build:snapshot, e2e- ReleaseAudit run
Paste the REAL outputs into VERIFY.md "Pass 11 (quality gate)". Mark anything you could not run as NOT DONE with the exact error.