↑↓ to navigate Enter to open "…" all these words ANDOR to combine

Onboarding guide

CI/CD and Operations

This chapter walks the GitHub Actions workflows that govern MMCA, from the framework's continuous integration and lockstep NuGet release in MMCA.Common, through the ADC application's build/test/deploy pipeline, end-to-end Playwright testing, cost-guard automation, performance load testing, the pull-request secret scan, and the repository-automation workflow (the weekly MAUI dependency audit). (Two further ADC workflows, dr-drill.yml and the weekday-nightly cross-service-tests.yml, are covered in the cross-workflow summary at the end rather than given their own sections.) For each workflow you will learn the triggers, the job/step sequence with file-and-line citations, and, critically, why each gate exists and what would break without it. Rubric categories are tagged inline so you can connect each pipeline decision to its architecture-quality axis. Cross-links to the primer and other tier chapters are included throughout.

Two hardening conventions run through every workflow below and are not repeated in each section: every third-party action is pinned to a commit SHA with its version in a trailing comment, and a ${{ ... }} value that reaches a shell body arrives through a step-level env: block instead of being interpolated into the script text. In ADC both are mechanical: the workflow lint in the required supply-chain job fails any expression inside a run: body and any checkout that does not set persist-credentials: false or state why it needs git credentials (MMCA.ADC/.github/workflows/deploy.yml:798-805). MMCA.Common applies the env: rule to every value a person or an event controls, the release tag included (MMCA.Common/.github/workflows/release.yml:30-44), while matrix constants and secret or step-output values still appear inline (MMCA.Common/.github/workflows/ci.yml:185, release.yml:193). A template value is pasted in before the shell parses the line, so a ref name or a dispatch input carrying shell metacharacters would otherwise run as code, and a mutable action tag can be repointed at malicious code while a SHA cannot.


MMCA.Common, ci.yml

File: MMCA.Common/.github/workflows/ci.yml

What it is

The continuous-integration workflow for the MMCA.Common framework. Because the published packages (the authoritative id list and count live in MMCA.Common/FACTS.md) are consumed by every downstream application, a regression here propagates to both MMCA.ADC and MMCA.Store. The workflow runs twenty jobs: a changes classifier that every other job keys off (ci.yml:45); the unit, architecture and bUnit tiers, split into a per-framework matrix build-and-test-tfm (ci.yml:100), a build-and-test-checks job for the FACTS gate and the vulnerability audit (ci.yml:196) and a build-and-test aggregator that carries the required context (ci.yml:245); a windows build-maui for the one package that cannot compile on Ubuntu (ci.yml:269); a ui-e2e cross-browser matrix for real-browser accessibility and render-smoke testing (ci.yml:339); a performance-smoke benchmark gate (ci.yml:514); a coverage job that turns the unit tier into a report and enforces a floor (ci.yml:564), with a non-required coverage-risk ratchet beside it (ci.yml:633); three canaries that catch failure modes the solution build cannot see: consumer-source-build (ci.yml:682), package-consumption (ci.yml:914) and sample-deployment-validate (ci.yml:1012); a non-required workflow-lint job (ci.yml:992); and eight engine, broker, emulator or orchestrator tiers for the components whose behavior only a real server can falsify: redis-integration (ci.yml:1002), postgresql-integration (ci.yml:1069), rabbitmq-integration (ci.yml:1129), sqlserver-integration (ci.yml:1181), aws-integration (ci.yml:1240), gcp-integration (ci.yml:1300), azure-integration (ci.yml:1366) and the blocking apphost-testing (ci.yml:1426).

That job count is the interesting fact about this workflow. A framework cannot verify itself by compiling itself: most of these jobs exist because a green dotnet build on the framework's own solution has, at some point, coexisted with a broken consumer, a broken package, or a broken deployment sample.

[Rubric §17, DevOps & Deployment] assesses whether CI/CD is automated, gates are meaningful, and deployments are reproducible. This workflow embodies §17 as the automated gate that every MMCA.Common change must pass before it can influence downstream consumers.

Triggers

# ci.yml:14-16
on:
  pull_request:
    branches: [main]

Pull requests only. There is deliberately no push: [main] trigger, and the comment above the trigger (ci.yml:3-13) records why: main is protected with "Require branches to be up to date before merging", so a pull_request check runs against refs/pull/N/merge, which is main already merged into the PR head. Under squash merge that merge result is the tree that lands on main, so a push-triggered re-run only re-verified an already-verified tree. The comment carries the measurement that settled it: 30 such runs over three days in July 2026, 266 wasted minutes, competing for the same concurrency slots as the PR runs they duplicated.

Release verification does not depend on this, which is what makes the deletion safe: release.yml runs its own restore, build, and test against the v* tag before publishing.

# ci.yml:27-32
env:
  FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
  PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.ms-playwright

The first var forces GitHub's bundled JavaScript actions onto the Node 24 runtime, avoiding deprecation warnings that would surface as build noise. The second redirects Playwright's browser install out of ~/.cache/ms-playwright and into the workspace, which is what lets actions/cache carry the browser binaries between runs. It has to be workflow-level rather than step-level because both the install step and the test run read it.

# ci.yml:36-38
concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Pushing to a PR again supersedes the still-running check set, since a stale run's result is never actionable. The cancel-in-progress expression is guarded on event_name rather than hardcoded to true so that a future non-PR trigger cannot cancel itself.

Job: changes, the docs-only short-circuit

The first job (ci.yml:45-91) classifies the diff and exposes a single code output (ci.yml:48-49) that every heavy step below is guarded on. It walks the changed files against the base ref and sets code=false only when every changed path ends in .md.

The design detail worth internalizing is that the flag guards steps, not jobs. All eight required status contexts must still post green on a docs-only PR, and a skipped job posts no context at all, so guarding at job level would leave branch protection waiting forever on checks that never arrive. Guarding at step level means the jobs all run, do almost nothing, and report green.

The classifier is fail-safe in both directions (ci.yml:67-74): an unresolvable base ref or a failed git diff sets code=true and runs the full pipeline. Guessing "code changed" wastes runner minutes; guessing "docs only" ships an unverified change.

One step deliberately escapes the guard, covered next.

Job: build-and-test

Three jobs behind one required context. The work is split so the two framework lines run in parallel. build-and-test-tfm is a [net10.0, net11.0] matrix (ci.yml:107-110) in which each leg runs the full locked restore (a single-framework restore fails --locked-mode with NU1004, because every lock file lists both frameworks), then builds and tests its framework alone through -p:TargetFramework and --framework (ci.yml:93-99). build-and-test-checks (ci.yml:196-200) runs the FACTS gate and the vulnerability audit once rather than per leg (the audit is the shared composite action at ci.yml:236). The job branch protection actually names is the aggregator build-and-test (ci.yml:242-247): it needs both, runs with if: always(), and fails unless every leg succeeded. Without it a red or cancelled leg would leave the required check skipped, and a skipped required check posts green. Read the step walkthrough below with that split in mind: restore, build and test run in each matrix leg.

Runs on: ubuntu-latest (ci.yml:103). The Ubuntu runner matters: the Linux file system is case-sensitive, so path-casing bugs that Windows masks are caught in CI. This is a deliberate choice documented in MMCA.Common/CLAUDE.md ("CI runs on Ubuntu, file paths are case-sensitive"). Each leg is bounded at timeout-minutes: 15 (ci.yml:106): the comment (ci.yml:104-105) records the combined job at 13.7 minutes, so a one-framework leg sits well under the cap, and a hung restore or test host fails the job instead of holding a runner for GitHub's 6-hour default. The coverage job gets the same treatment at 5 minutes (ci.yml:570).

Step 1, Checkout (ci.yml:112-114):

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
  with:
    persist-credentials: false

A default shallow checkout is enough: no build derives its version from git history. Every non-release build carries the 0.0.0-dev placeholder from Directory.Build.props (:87-90), and only the release workflow passes a real version, the tag. Full history is fetched only where a step reads it: the changes path classifier (ci.yml:54) and build-and-test-checks, whose FACTS gate derives the version from the latest reachable tag (ci.yml:205).

Step 2, .NET setup (ci.yml:116-134): actions/setup-dotnet@v6 installs both 10.0.x and 11.0.x (ci.yml:120-122), so the runner carries both framework lines the projects multi-target. It also caches ~/.nuget/packages, keyed on the committed lock files plus Directory.Packages.props, because build/facts and build/perfgate sit outside the solution and carry no lock file, so the props file is what actually pins their versions. The cache itself is gated on the code flag (ci.yml:128): on a docs-only PR every restore step is skipped, ~/.nuget/packages is never created, and setup-dotnet's cache-save step would otherwise fail the whole job with "Cache folder path does not exist on disk".

Step 3, Verify FACTS.md is current (ci.yml:220-223):

dotnet run --project build/facts -- . --check

A fast, dependency-free drift gate. build/facts recomputes the framework-wide facts from source (version from the git tag, package count, fitness-method and base-class counts) and fails if the committed FACTS.md disagrees. Regenerate with dotnet run --project build/facts -- .. The ADR count and range are deliberately not in that list: the comment (ci.yml:217-219) records that the Website ADR index owns them, so the one number the framework repo cannot see is not checked against a stale copy.

This is the one step not guarded on the code flag, and the comment (ci.yml:221-222) explains why: FACTS.md is itself markdown, so a docs-only PR is exactly the kind of change that can make it drift. The gate has to run precisely when everything else is skipped.

[Rubric §26, Documentation & Knowledge Management] is served here in the only way that survives contact with time: the numbers other documents are told to link rather than restate are themselves machine-checked against the code.

Step 4, Restore (ci.yml:136-145):

dotnet restore MMCA.Common.slnx --locked-mode

MMCA.Common uses NuGet lock files (RestorePackagesWithLockFile) and pins packageSourceMapping to nuget.org only, no GITHUB_TOKEN is needed to restore. This is explicitly documented in MMCA.Common/CLAUDE.md ("building/testing Common needs NO GitHub token"). The lock file makes the restore reproducible: the exact dependency graph is committed and any unexpected transitive upgrade fails the restore. --locked-mode (ci.yml:138-145) is what makes that binding rather than advisory: the restore either reproduces the committed packages.lock.json graph or fails, so CI cannot build, audit and pack a graph nobody reviewed. A deliberate dependency change regenerates the lock files locally with dotnet restore --force-evaluate and commits them in the same pull request. Every project in MMCA.Common.slnx has a lock file; the three that do not (build/facts, build/perfgate and the Benchmarks project) sit outside the solution and are unaffected.

[Rubric §32, Dependency & Supply-Chain] assesses whether package sources are pinned, audited, and supply-chain risks are visible. The pinned source mapping plus committed lock files are the §32 implementation: a compromised or mutated transitive package cannot silently enter the build.

Step 5, Build in Release mode (ci.yml:147-149):

dotnet build MMCA.Common.slnx -c Release --no-restore

Building in Release mode matters because the five analyzers (Meziantou, SonarAnalyzer, StyleCop, Roslynator, Microsoft.VisualStudio.Threading) run at error severity. Some analyzer rules only trigger in Release (e.g. certain null-forgiving suppression patterns). TreatWarningsAsErrors is globally enabled; a single analyzer finding fails the build. The --no-restore flag re-uses the locked packages from Step 4.

[Rubric §15, Best Practices & Code Quality] (quality enforcement via analyzers at error severity) is realized here: the build is the static-analysis gate.

Step 6, Vulnerability audit (ci.yml:229-240):

- name: Audit dependencies (fail on known vulnerabilities)
  if: needs.changes.outputs.code == 'true'
  uses: ./.github/actions/nuget-vulnerability-audit
  with:
    solution: MMCA.Common.slnx

The step is a call into a composite action in the same repository, .github/actions/nuget-vulnerability-audit/action.yml, and the comment (ci.yml:231-235) says why the logic moved there: ADC and Store deploy.yml run the very same action by ref (ivanball/MMCA.Common/.github/actions/...@main), so the framework and its consumers share ONE implementation instead of a per-repository copy that drifts (ADR-038). The action takes a solution, an optional props-file (default Directory.Build.props) and an optional report-path (default audit.log) (nuget-vulnerability-audit/action.yml:15-26).

Inside it (nuget-vulnerability-audit/action.yml:43-65), dotnet list package --vulnerable --include-transitive queries NuGet's vulnerability database for every direct and transitive dependency and writes the report. The gate then fails closed (SEC-Common-62) on two assertions before it will trust an empty result: the command's exit code must be 0 (:63-68), and the report must carry a recognised header, either the sources header or a per-project verdict line (:69-73). Without those two checks, every way the tool itself can fail (an advisory-feed timeout, an auth or proxy error, a renamed output) produced an empty grep and a green "no vulnerabilities".

Only then does it apply the accept-list. Because dotnet list --vulnerable ignores NuGetAuditSuppress, the action honors the same accepted-advisory list itself: it extracts the suppressed GHSA-... ids from Directory.Build.props (the single source of truth), filters those advisories out of the vulnerable-package rows (the >-prefixed lines), and fails only if a non-suppressed vulnerable row remains (:74-92).

Note how narrowly the extraction is scoped (nuget-vulnerability-audit/action.yml:74-84): it matches only real <NuGetAuditSuppress ... Include="GHSA-..." elements, not every GHSA- string in the file, so a GHSA id merely mentioned in a comment about a non-accepted advisory cannot silently suppress it here. A looser grep would have turned prose into policy.

Why this gate exists and why it comes before tests: a vulnerable dependency that reaches the published packages is a supply-chain liability for every downstream consumer. Catching it before the release workflow runs (and before the package is published) is cheaper than retracting a published version.

[Rubric §32, Dependency & Supply-Chain] is directly served by this step. [Rubric §11, Security] (assesses whether secrets, auth, and dependency security are properly managed) is also touched: the vulnerability audit ensures the framework's own dependencies do not carry known CVEs.

Steps 7 and 8, Test with coverage and the discovery-regression floor (ci.yml:164-185):

dotnet tool install --global dotnet-coverage
dotnet-coverage collect -f cobertura -o coverage.unit.cobertura.xml \
  "dotnet test --solution MMCA.Common.slnx -c Release --no-build --framework ${{ matrix.tfm }} --minimum-expected-tests 11250 --max-parallel-test-modules 1"

The test run is wrapped in dotnet-coverage collect (installed in the step before), which emits a cobertura report and returns the inner test command's exit code, so a test failure still gates the build, coverage itself is report-only (the coverage job below consumes it).

Two settings on the leg answer real failures. --max-parallel-test-modules 1 runs one test module at a time because dotnet-coverage races on Linux when test hosts start in parallel and dies with SIGBUS (exit 135, the comment at ci.yml:175-184), at a cost of about a minute per leg. And the step before the test raises fs.inotify.max_user_instances to 1024 (ci.yml:155-162): every test host that builds configuration from a JSON file takes an inotify instance for its reload watcher, and run 45092597262 lost eight MMCA.Common.Aspire.Tests to the default limit of 128.

--minimum-expected-tests 11250 is the load-bearing number. It is a Microsoft Testing Platform (MTP) flag that fails the run when fewer than N tests are discovered, and the floor sits about 10 percent under one framework's measured suite of 12,579 (25,161 across both frameworks, the comment at ci.yml:170-174). A floor of 1 would only catch a project that discovered nothing at all; a floor near the true count catches the far more common and far more dangerous failure, a discovery or filter regression that silently drops thousands of tests and reports green with a handful run. The solution test suite covers the per-layer projects (Shared.Tests, Domain.Tests, Application.Tests, Infrastructure.Tests, API.Tests, Grpc.Tests, UI.Tests, UI.Web.Tests, Aspire.Tests, Aspire.Hosting.Tests, Gateway.Tests, Testing.Tests, plus the Infrastructure.Tests.MigrationsFixture helper project, MMCA.Common.slnx:47-79) plus Architecture.Tests (layer/purity/extraction fitness functions on the ArchitectureTypes engine, see the doubled architecture-enforcement / fitness functions).

[Rubric §14, Testability & Test Strategy] assesses whether tests actually run and cover the system. The --minimum-expected-tests floor is a mechanical enforcement of §14: you cannot merge a change that quietly stops running the suite.

The unit-tier cobertura report is uploaded as the coverage-unit artifact (ci.yml:187-193) for the coverage job to merge and gate on, under if: always() so a failing run still yields its partial coverage data.

Job: build-maui, the one package Ubuntu cannot compile

MMCA.Common.UI.Maui multi-targets net10.0-android/ios/maccatalyst/windows, which needs the MAUI workloads, which Ubuntu runners do not have. So it stays out of MMCA.Common.slnx and builds in its own windows-latest job (ci.yml:269-332), the same mechanism that keeps the gallery and UI E2E projects out of the fast unit run (ADR-042). It is a required merge gate alongside build-and-test.

There are no tests here, and the comment says why (ci.yml:267-268): the capability contracts and their browser fallbacks are covered in MMCA.Common.UI.Tests on ubuntu, while the MAUI implementations are thin Essentials wrappers exercised on-device. A test that only proves a wrapper forwards a call is not worth a windows runner.

The job is the critical path of the whole CI run (the only windows runner), and the largest single cost in it is the MAUI workload. Install MAUI workload runs dotnet workload install maui --version "$env:MAUI_WORKLOAD_VERSION" (ci.yml:307-309) on every code run with no workload cache, and the comment records why, by measurement (ci.yml:299-305): saving the 2.2 GB of packs took 430 seconds, a cache hit still spent 225 seconds restoring plus 192 in the install, and a cache saved by a pull_request run is only visible to that same PR, so every cached variant was slower than the plain install (about 380 seconds). A cache is a bet that restoring is cheaper than recomputing; for a payload this size on a windows runner, it is not.

The install is uncached but not unpinned. MAUI_WORKLOAD_VERSION is a workflow-level variable (ci.yml:33-36, value 11.0.100.1) so the MAUI toolchain only moves in a reviewed PR, and its comment names the two coupling rules: keep it equal to the same variable in release.yml (release.yml:9-11, read by the MAUI pack job's install step at release.yml:362), and move it when the SDK feature band that global.json resolves to on the runner moves, because a workload set belongs to one band. Pinning both files to one value is what makes the toolchain that builds the irreversible release the one a PR verified.

Job: ui-e2e, accessibility and render-smoke gate

This job (ci.yml:339-504) runs in parallel with build-and-test, on its own ubuntu-latest runner, with a 34-minute job timeout (ci.yml:343), sized to hold the 26-minute bound on the install step (ci.yml:427) plus the build and the suite. It is a cross-browser matrix over chromium, firefox, and webkit (ci.yml:344-348) with fail-fast: false, so one engine's failure does not cancel the others.

All three engines are required merge gates. The matrix was introduced with the non-chromium legs non-blocking, then promoted as each proved itself: firefox on 2026-07-12 after a clean observed streak, webkit on 2026-07-16 after 11 consecutive green runs since its last flake (ci.yml:349-351). There is no continue-on-error in this job today. A webkit red blocks the merge like any other check.

Its purpose is to catch two failure classes the unit-test job cannot: WCAG 2.1 AA accessibility violations in the shared Blazor UI components, and rendering regressions (a component that compiles but throws during render).

Why a separate job? The gallery host (Tests/Presentation/MMCA.Common.UI.Gallery) and the E2E test project (Tests/Presentation/MMCA.Common.UI.E2E.Tests) are intentionally excluded from MMCA.Common.slnx (ci.yml:334-338 comment). Playwright requires a full browser install (several hundred megabytes) and a browser-capable runner config. Including these in dotnet test --solution would slow every CI run for every code change, most of which do not touch the UI. Keeping the E2E gate separate means the unit/arch job stays fast while accessibility remains enforced.

Step-by-step:

  1. Checkout (ci.yml:353-355): a default shallow checkout with persist-credentials: false, same as build-and-test.

  2. Build the E2E project directly (ci.yml:377-381):

    dotnet build Tests/Presentation/MMCA.Common.UI.E2E.Tests/MMCA.Common.UI.E2E.Tests.csproj -c Release

    Building by csproj path, not solution, ensures only the gallery and E2E graphs are compiled (restore included). The E2E project references MMCA.Common source projects directly (via project references, not NuGet packages), so no GITHUB_TOKEN is needed.

  3. Resolve the Playwright version (ci.yml:383-395): the step reads the Microsoft.Playwright PackageVersion out of Directory.Packages.props and fails the job when it is missing, then also emits the runner image id (ImageOS/ImageVersion). The comment states the reason (ci.yml:383-384): browser builds are a function of the Playwright version alone, so a cache keyed on a hash of the whole props file was thrown away by every unrelated package bump.

  4. Cache the browsers and the OS packages (ci.yml:397-419). Browser binaries run 100 to 300 MB per engine and were re-downloaded on all three legs of every run, which is what the workflow-level PLAYWRIGHT_BROWSERS_PATH and the browser cache (ci.yml:400-406, keyed on engine plus Playwright version at ci.yml:406) exist to stop. A second cache (ci.yml:413-419) holds the engine's .deb files, keyed on engine, Playwright version and runner image (ci.yml:418), with a restore-keys fallback to an older image's set (ci.yml:419). The comment (ci.yml:408-412) records why: webkit's OS dependencies are about 130 packages (117 MB) fetched from the runner's apt mirror on every run, and a mirror that crawls without erroring held webkit in the install until the old 20-minute job timeout (PRs #592 and #603). With the archives cached, a warm run installs offline and a cold one resumes across retries instead of restarting.

  5. Install Playwright, bounded and retried (ci.yml:425-489, step timeout 26 minutes at ci.yml:427). The step does four things:

    • Writes an apt config (ci.yml:429-434): 3 retries and 30-second HTTP timeouts per transfer (ci.yml:432), with the cached archive directory as apt's download cache, kept after install.
    • Reorders the Ubuntu mirror list (ci.yml:444-464). apt moves to the next mirror only on an error, never on a slow transfer; on 2026-10-26 the Azure mirror served about 25 KB/s for over an hour (#615). Each candidate gets a 20-second probe of one index file, the fastest goes first, and the list is left alone when the first entry already wins.
    • Wraps each install in a three-attempt retry helper (ci.yml:466-474) that runs dpkg --configure -a between attempts. Browser binaries download only on a cache miss (ci.yml:477, 180 seconds per attempt); install-deps always runs (ci.yml:485, 480 seconds per attempt), because OS-level shared libraries and fonts live outside the cached browser directory and a restored cache without them produces a browser that cannot launch. install-deps runs as root under sudo timeout, so apt-get sits in timeout's own process group and dies with it; the comment above the step (ci.yml:421-424) records that letting the CLI elevate itself left apt-get in a separate sudo session that outlived the timeout and held the dpkg lock against every retry.
    • Hands the archive directory back to the runner user (ci.yml:488), because the post-job cache save runs as that user.

    The playwright.ps1 script is emitted into the build output by the Playwright MSBuild integration; find locates it dynamically so the step does not hard-code a .NET version suffix.

  6. Run the E2E suite (ci.yml:491-496): every leg runs the same plain dotnet test command, code-guarded like the other heavy steps, with no coverage collection (E2E coverage is not part of the merged report). The step is:

    env:
      E2E_HEADLESS: "true"
      E2E_BROWSER: ${{ matrix.browser }}
    run: dotnet test --project Tests/Presentation/MMCA.Common.UI.E2E.Tests/MMCA.Common.UI.E2E.Tests.csproj -c Release --no-build -- --minimum-expected-tests 145

    E2E_HEADLESS: true runs the browser without a display server (no Xvfb needed). E2E_BROWSER selects the engine; MMCA.Common.Testing.E2E's PlaywrightFixture reads this env var. The -- separates the MTP options, and --minimum-expected-tests 145 is the same class of guard as in build-and-test: the floor sits about 5 percent under the measured per-engine total of 153, so a discovery fault that runs a fraction of the gallery fails instead of passing on one test (ci.yml:516-519).

    The suite self-hosts the gallery (MMCA.Common.UI.Gallery) in-process, then scans the Login and Register pages plus a primitives showcase with axe-core (via Deque.AxeCore.Playwright) at WCAG 2.1 AA conformance level. Any failing violation causes a test failure, which fails the job.

    [Rubric §21, Accessibility (a11y)] (assesses whether the UI is programmatically tested against a standard like WCAG 2.1 AA) is enforced here. [Rubric §28, Front-End Testing & Quality] (assesses whether browser-level tests catch rendering and functional regressions) is also embodied: the render smoke confirms that the real component tree renders without exceptions in a real browser context.

  7. Upload Playwright traces on failure: each leg uploads its traces (ci.yml:498-504):

    if: failure()
    uses: actions/upload-artifact@v7
    with:
      name: ui-e2e-traces-${{ matrix.browser }}
      path: Tests/Presentation/MMCA.Common.UI.E2E.Tests/bin/Release/net10.0/playwright-traces/**
      if-no-files-found: ignore

    Playwright traces (HAR + screenshots + video) are produced only on failure and uploaded as a per-browser GitHub artifact. if-no-files-found: ignore prevents the upload step from failing if no trace was recorded (e.g. the failure occurred before any browser interaction). This is a developer-experience detail: without traces, diagnosing a flaky E2E failure in CI requires reproducing it locally.

    [Rubric §33, Developer Experience & Inner Loop] (assesses whether CI gives developers actionable feedback fast) is served: the trace artifact turns an opaque CI failure into a reproducible debugging session.

Job: performance-smoke, benchmarks plus a committed baseline

This job (ci.yml:514-559) runs the BenchmarkDotNet harness and then compares the results against a committed baseline, which makes it two gates in one. Its context, Performance gate (BenchmarkDotNet Short + baseline verify), is one of the eight required merge gates on main (MMCA.Common/CONTRIBUTING.md:60-71).

The run itself (ci.yml:544-550) uses --filter "*" and --job Short:

dotnet run -c Release --project Tests/Performance/MMCA.Common.Benchmarks --no-launch-profile -- --filter "*" --job Short --exporters json

--filter "*" selects every benchmark non-interactively, and without it BenchmarkDotNet prompts for a selection and hangs in CI. --job Short (3 warmup + 3 iterations) produces real measurements in under a minute instead of a full multi-iteration timing run. --no-launch-profile keeps it deterministic on hosted runners.

Then build/perfgate (ci.yml:552-559) compares the exported results against Tests/Performance/perf-baseline.json and fails on any violation. The baseline holds two kinds of assertion, and the difference matters: deterministic allocation ceilings (byte counts, which are stable across machines) and machine-independent ratio floors, such as the compiled-expression specification cache staying at least 1000x ahead of the recompile anti-pattern. Wall-clock times are not asserted, because a shared hosted runner cannot deliver them reproducibly. Moving a number deliberately means updating the baseline file in the same PR.

[Rubric §12, Performance & Scalability] is served in the only form CI can honestly provide: not "is it fast" but "did the property that makes it fast stop holding".

Job: coverage, merge report and coverage floor

This job (ci.yml:561-624) runs after build-and-test regardless of its outcome (needs: [changes, build-and-test], if: always(), ci.yml:565-567). It downloads the coverage-* artifacts, turns the unit/architecture/bUnit cobertura into a ReportGenerator report (+MMCA.*;-*.Tests), and publishes the summary to the run's Step Summary (ci.yml:580-601). The ui-e2e browser tier collects no coverage.

It then enforces a coverage floor (ci.yml:609-624) as a regression backstop: the unit tier must stay at 68.3% line coverage or better with generated *.generated.cs/*.g.cs code excluded (ci.yml:621-624), and only when build-and-test succeeded, so that an upstream failure does not add a confusing secondary coverage failure (ci.yml:610-611).

Two decisions are encoded in that number. Generated code is excluded because source generators (for example Microsoft.AspNetCore.OpenApi) emit large uncovered files that otherwise tank the figure: 45.3% raw versus 61.9% hand-written, measured 2026-06-19. And the floor sits about 2 points below the 70.3% measured after the July 2026 coverage program (session auth, broker bus, Grpc/OAuth/JWKS, UI services), leaving just enough slack to avoid false reds while still catching a real regression. It is meant to be ratcheted up as coverage grows.

[Rubric §14, Testability & Test Strategy] is served: the coverage floor is a mechanical regression backstop on top of the --minimum-expected-tests guard.

Job: coverage-risk, the non-required CRAP ratchet

coverage-risk (ci.yml:626-635) merges the unit report with the reports of the eight Testcontainers and emulator tiers and fails only on new risk: a method absent from .github/coverage-baselines/crap.txt with a CRAP score above 30, or a baselined method whose CRAP score rose (ADR-147). The integration tiers upload under an integration-coverage-* artifact name, not coverage-*, so the required coverage job, which downloads coverage-*, keeps exactly the inputs it always had (ci.yml:1063-1064).

It is a separate job for a branch-protection reason (ci.yml:626-629). Its needs lists the non-required integration tiers, and a failed job in needs skips its dependents. Had this logic gone into the required coverage job, one red integration tier would skip that job, and a skipped required check posts green, silently passing the line floor. So coverage keeps needs: [changes, build-and-test], and coverage-risk runs with if: always() on code changes (ci.yml:635). It is not a required check.

[Rubric Section 14, Testability] assesses whether coverage is measured where risk actually lives. A ratchet on CRAP (complexity weighted by missing coverage) targets the methods most likely to hide a defect, and failing only on new risk lets it gate today without first paying down every legacy finding.

The three canaries, and why a framework needs them

The remaining jobs all exist for the same reason: a green solution build does not prove the framework works for anyone who is not the framework.

consumer-source-build (ci.yml:682-902) is a cross-repo pre-merge canary, and it now proves two different things. It checks out MMCA.Helpdesk as a sibling directory (ci.yml:704-742) and builds and tests it against this PR's framework source, so a breaking public-API change fails here rather than surfacing after a release and a lockstep sweep. Helpdesk is the ideal canary precisely because it is minimal: a single-module app that needs no database and no GitHub Packages token to compile, shipping a committed local.props that swaps the MMCA.Common.* PackageReferences for ProjectReferences into ../MMCA.Common/Source. The sibling checkout layout is what makes that relative path resolve to the PR's own checkout. Its test step (ci.yml:801) carries the same discovery floor idea as build-and-test, set to 40 against a suite of about 91. Promoted to a required gate on 2026-07-16 after 9 consecutive green runs (ci.yml:677-678).

Two additions are worth reading closely. First, the job resolves which Helpdesk ref to build (ci.yml:715-730): if a branch with the same name as this PR's head branch exists on ivanball/MMCA.Helpdesk, the canary builds that pair together; otherwise it builds Helpdesk main. That convention is what makes a deliberate breaking framework change landable at all. Helpdesk's own CI builds against MMCA.Common main, so neither repo can adapt first while the canary pins the other's main: a mutual deadlock, resolved by letting one PR name its counterpart branch (ci.yml:710-714).

Second, the job runs the consumer's real EF migrations against a real SQL Server. An ephemeral SQL Server container starts before the build so it warms up while the solution compiles (ci.yml:764-776). Its image is the job-level SQLSERVER_IMAGE, pinned to one cumulative update, mcr.microsoft.com/mssql/server:2022-CU27-ubuntu-22.04, rather than 2022-latest (ci.yml:698-702): this is a required gate, so a new CU must not change what it runs without a reviewed diff, and the comment ties the tag to the sqlserver-integration tier, which pins the same one ("bump both"). go-sqlcmd is installed as a single static binary rather than the mssql-tools deb, and is itself pinned (ci.yml:814-821): a fixed SQLCMD_VERSION (v1.10.0) is downloaded to $RUNNER_TEMP and checked against SQLCMD_SHA256 with sha256sum -c before sudo tar extracts it, because piping releases/latest straight into a root tar ran whatever the newest upload was, unchecked. Version and digest are bumped together. The Aspire CLI the Helpdesk build needs comes the same way, from the shared aspire-cli composite action (ci.yml:787), which installs a pinned release and verifies its SHA-512 before running it (MMCA.Common/.github/actions/aspire-cli/action.yml:1-37); apphost-testing uses it too (ci.yml:1472), and ADC pins it by release commit. A 30 x 5s poll waits on a real SELECT 1 rather than on Docker's notion of "running" (ci.yml:824-839), and dotnet ef database update applies the Tickets migrations with the same dotnet-ef 10.0.8 the consumers deploy with (ci.yml:841-868). The reason is stated in the comment (ci.yml:847-851): migrations add and the model-drift gate never open a connection, so neither notices a framework change that breaks the generated DDL, the history table, or the design-time context wiring. database update does.

The step after it is the one that makes the apply falsifiable (ci.yml:870-902). dotnet ef database update exits 0 on a no-op, so a wiring mistake that applied nothing would pass silently. The assertion step therefore reads __EFMigrationsHistory for at least one row and checks that both a module table (Tickets.Ticket) and a framework table (dbo.OutboxMessages) exist. The framework table is the half that belongs to MMCA.Common, so a change that stops the framework's own tables reaching a consumer's schema fails right here rather than at a consumer's deploy. The job's timeout was raised to 30 minutes to pay for the container, the poll and the apply (ci.yml:686-688), and the throwaway SA password is inline rather than a secret so the gate still runs from a fork (ci.yml:690-693).

[Rubric §8, Data Architecture] is served in a way no build-only canary can reach: the framework's migration path is exercised end to end, on a real engine, by a real consumer.

package-consumption (ci.yml:914-976) closes the gap that the previous job cannot: source-mode builds bind ProjectReferences, so pack breaks (NU5xxx) and package-mode-only restore, analyzer, and reference failures stay invisible to them. The comment records that this failure mode shipped twice before the job existed (ci.yml:904-913). So this job packs every slnx package into a local folder feed under a CI-only version (PACK_VERSION at ci.yml:920, packed by build/consumer-check/Invoke-ConsumerCheck.ps1 -Stage Pack, which passes it as -p:Version and -p:PackageVersion at :147 so the consumer can pin the packed version exactly), then scaffolds a throwaway consumer (ci.yml:956-961) whose nuget.config maps MMCA.Common.* to that feed and everything else to nuget.org, and builds it (ci.yml:963-966).

Every one of those steps is a single line, ./build/consumer-check/Invoke-ConsumerCheck.ps1 -Stage <name> under shell: pwsh (ci.yml:954, :961, :966, :976). The script (build/consumer-check/Invoke-ConsumerCheck.ps1:1-56) is the one implementation of the check, and the comment at ci.yml:946-950 names why it lives outside the workflow: a contributor runs the same four stages locally with pwsh build/consumer-check/Invoke-ConsumerCheck.ps1 (-Stage All is the default, Invoke-ConsumerCheck.ps1:56), so a package-mode break can be reproduced before a push rather than read out of a CI log. CI calls one stage per step so each keeps its own name and log, and the job-level PACK_VERSION pins every stage to the same packed version; a single stage run without a version stops rather than guessing one (Invoke-ConsumerCheck.ps1:117-118). Off CI the consumer lands in <system temp>/mmca-pkg-consumer instead of RUNNER_TEMP/pkg-consumer (Invoke-ConsumerCheck.ps1:108-109).

The throwaway consumer lives in RUNNER_TEMP, outside the repo checkout, and that placement is the whole point: inside the checkout it would inherit Directory.Build.props and Directory.Packages.props and stop resembling a real downstream app. It references the meta set (API + Infrastructure + Testing.Architecture) to pull the full package graph transitively, and compiles one smoke type against Result to prove the references actually bind rather than merely resolve.

The job's last step, Layer rules ship with the packages (ci.yml:968-976), proves something a successful consumer build cannot. MMCA.Common.Shared carries a buildTransitive targets file (Source/Build/MMCA.Common.Shared.targets) that gives any consumer project named {App}.{Module}.{Layer} compile-time layer rules with no opt-in: MMCA0001 for a forbidden project reference, MMCA0002 for a forbidden package reference (the comment at ci.yml:970-974 ties it to ADR-015 and ADR-058). The step writes three kinds of probe project next to the throwaway consumer: one positive probe (Probe.Sample.Application referencing Probe.Sample.Domain, which must build, Invoke-ConsumerCheck.ps1:263-267) and two negative ones (Probe.BadPackage.Domain pulling MMCA.Common.Infrastructure, which must fail with MMCA0002, and Probe.BadProject.Domain referencing an Application project, which must fail with MMCA0001, Invoke-ConsumerCheck.ps1:269-276). The helper Assert-ProbeFails (Invoke-ConsumerCheck.ps1:238-239) fails the stage both when a negative probe builds and when it fails for a reason other than the expected code.

Why the negatives are the point: a passing positive probe on its own would also pass if the targets file were silently missing from the package, so only the two probes that must break prove the import reaches a package-mode consumer and that both error codes fire. [Rubric section 34, Governance] assesses whether architectural rules are enforced mechanically rather than by review; here the rules travel with the package and CI proves they arrive, which is the consumer-side twin of the doubled fitness functions.

sample-deployment-validate (ci.yml:1006-1028) type-checks the samples/deployment Bicep templates with az bicep build, no cloud credentials required. A library cannot deploy itself, so this IaC/OIDC reference is documentation that would otherwise rot unobserved; compiling it on every PR keeps it honest. A real what-if or deploy stays a consumer-side concern, since ADC's and Store's deploy.yml are the production-proven versions.

workflow-lint (ci.yml:992-1010) runs actionlint over .github/workflows: expression types, the job graph, needs and outputs, runner labels and action inputs (ci.yml:987-991). The binary is built from source with go install at a pinned commit (ACTIONLINT_REF, v1.7.12, ci.yml:1003-1006), so the Go module proxy's checksum database makes the fetched source verifiable and no unpinned binary or install script runs. Its shellcheck and pyflakes integrations are switched off (-shellcheck= -pyflakes=, ci.yml:1010) because they lint the scripts inside run: blocks, a separate concern from workflow structure. It is not a required check and runs on every PR because it is cheap: a typo in a needs name or an output reference is otherwise only discovered when the job graph runs, which for release.yml means on a tag. [Rubric section 33, Developer Experience] assesses how fast a mistake reaches its author; this job moves workflow-structure errors from run time to PR time.

Job: redis-integration

redis-integration (ci.yml:1002-1067) is a required check, one of the nine required contexts (MMCA.Common/AGENTS.md:36-38), and runs MMCA.Common.Infrastructure.Redis.Tests against a real Redis via Testcontainers, which Ubuntu runners support with no extra setup since they ship a Docker daemon. Like the E2E and benchmark projects it lives outside MMCA.Common.slnx so the fast solution-wide unit loop never requires Docker, and is therefore built and run by path.

The comment (ci.yml:1007-1011) states the falsifiability argument better than a summary can: the two-level cache behind HybridCacheService is where the storage format and the cross-replica view matter, and a fake L2 cannot express either. Redis keys are typed, so a mixed payload format round-trips against a fake and fails against a server, and a prefix invalidation only shows its reach when a second, independent cache instance reads the same server. A test that cannot fail against a fake is not a test of the thing you care about.

Its heavy step is code-guarded like every other job (ci.yml:1041-1045) so a docs-only PR does not pull a Redis image, while the job itself still runs and posts its context green, which is what keeps a required check safe on a docs-only PR. The test step carries --minimum-expected-tests 14 (ci.yml:1057), and the comment says why the number is exactly 14 (ci.yml:1048-1050): it is the [Fact] count in the project (11 HybridCacheService, 2 cross-instance invalidation and 1 rate limiter), so a tier that silently discovers fewer tests fails, and adding a test means raising the floor in the same PR. dotnet-coverage wraps the run and returns its exit code, so a failing test still fails the step, and the Cobertura file it writes feeds the non-required coverage-risk job (ci.yml:1051-1057). The hand-off is the job's last step, Upload integration coverage (ci.yml:1059-1067): it runs on always() so a red test run still passes its report on, and it publishes under integration-coverage-redis, which matches the integration-coverage-* pattern coverage-risk downloads (ci.yml:653-658) and deliberately not the coverage-* name the required coverage job reads (ci.yml:1063-1064). The same exact-count floor applies to the two database tiers below.

Jobs: postgresql-integration, sqlserver-integration and apphost-testing

postgresql-integration (ci.yml:1069-1127) is the Redis argument applied to the second database engine. The PostgreSQL provider is the one place where the SQL the framework emits matters, and a model assertion cannot express it: the comment is specific about the failure class (ci.yml:1074-1080), a partial-index predicate written the SQL Server way ([ProcessedOn] IS NULL), a soft-delete predicate comparing a boolean to 0, and a DateTime whose Kind is not UTC all build a perfectly valid EF model and are rejected by the server. The job runs MMCA.Common.Infrastructure.PostgreSQL.Tests against a real PostgreSQL over Testcontainers (ci.yml:1099-1117), built and run by path for the same reason the Redis tier is: the project sits outside MMCA.Common.slnx so the fast unit loop never requires Docker. The same container also exercises the built-in PostgreSql broker transport, the framework's own Npgsql transport (ci.yml:1077-1079; PostgreSqlBrokerTransport, MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Messaging/Transports/PostgreSql/PostgreSqlBrokerTransport.cs:36). Its floor is --minimum-expected-tests 20, the [Fact] count across PostgreSQLPersistenceTests.cs (9), InternalCommandLanePostgreSqlTests.cs (2), PostgreSqlBrokerTransportTests.cs (7: the six shared broker conformance scenarios plus the schema migration) and PostgreSqlLeaseRenewalTests.cs (2), per the comment at ci.yml:1106-1110.

sqlserver-integration (ci.yml:1181-1238) completes the set for the default engine. The comment (ci.yml:1188-1194) names what neither a mock nor SQLite can express on SQL Server, which is session state and server-generated values: SET IDENTITY_INSERT holds only on the session that ran it, a rowversion is issued by the server on every write, and the outbox row must reach the database in the same SaveChanges as its aggregate. The job runs the shipped SQLServerDbContext and DbContextFactory against a real SQL Server over Testcontainers. Its timeout is 20 minutes, the PostgreSQL tier's 15 plus headroom for the larger image pull and slower engine start (ci.yml:1185-1187), and the image tag is the same pinned 2022-CU27-ubuntu-22.04 the consumer-source-build canary uses, which is why the canary's comment says to bump both (ci.yml:698-702). The heavy step is code-guarded with the job still posting green (ci.yml:1213-1217), the project is outside MMCA.Common.slnx and run by path, and the floor is --minimum-expected-tests 5, the [Fact] count in SQLServerPersistenceTests.cs (ci.yml:1220-1221). It is not a required check yet: the comment records that promoting it is a branch-protection setting, not a workflow change (ci.yml:1193-1194).

apphost-testing (ci.yml:1426-1487) is the only tier that starts a real orchestrator. It boots the sample AppHost through Aspire.Hosting.Testing and closes the one layer nothing else executes, the AppHost wiring itself (ci.yml:1434-1437): the solution build never runs an AppHost, and every in-process test tier boots hosts directly through WebApplicationFactory, bypassing the orchestration, so a renamed resource, an unresolvable reference or a WaitFor cycle is invisible everywhere else. Three properties are worth carrying away. It is blocking: a red fails the run, though it is not a required merge check (ci.yml:1431-1432). It needs neither a container runtime nor a development certificate, because the sample AppHost declares two resources over one sample project, one with a SQLite file and one on the Http2-only h2c profile; the comment names the step a consumer stack with an https launch profile adds, dotnet dev-certs https --trust, since a resource probed over untrusted TLS never turns healthy (ci.yml:1444-1446). And the test step opts in through MMCA_APPHOST_TESTS (ci.yml:1474-1487), the environment gate the fixture reads, so a developer machine and every other CI job skip the collection with a named reason instead of paying for an orchestrator, while --minimum-expected-tests 1 makes a silently skipped tier visible here rather than passing as a no-op.

[Rubric §14, Testability & Test Strategy] is served by both jobs the way the Redis tier serves it: each covers a failure class that is structurally invisible to a mock, to a model assertion, or to a build.

Jobs: aws-integration and gcp-integration, the cloud adapters against emulators

These two tiers do for the cloud adapter packages what the engine tiers do for the database providers. aws-integration (ci.yml:1240-1298) runs MMCA.Common.Aws against LocalStack: the S3-compatible store and the SQS/SNS broker transport. The comment (ci.yml:1246-1253) names what the unit tier cannot settle, since it only asserts the requests the adapter builds: whether the S3 API accepts them (checksum posture, path-style addressing), whether Content-Type and Content-Disposition come back on the object, and whether the framework's own SQS/SNS transport (AmazonSqsTransport, MMCA.Common/Source/Hosting/MMCA.Common.Aws/Messaging/AmazonSqsTransport.cs:40) gets its topology, raw delivery, delayed redelivery and error queue right against a real endpoint. The ambient MMCA-* headers are the subtle part: a fully stamped message carries up to 11 headers and SNS and SQS both reject more than 10 attributes, so the transport packs every header into one message attribute (MMCA.Common/Source/Hosting/MMCA.Common.Aws/Messaging/AmazonSqsMessageMapping.cs:12-17), and only SNS raw delivery onto a real SQS queue proves the packed attribute arrives intact. gcp-integration (ci.yml:1300-1364) runs MMCA.Common.Gcp against fake-gcs-server and the Firestore emulator (ci.yml:1307-1319): the Cloud Storage store over the JSON API, the DataProtection key ring (only a real endpoint shows whether a stale IfGenerationMatch write is rejected with 412, the retry that keeps a concurrent writer's key), and the FCM installation registry's ownership transaction and conditional deletes. FCM itself has no emulator, so the send side is a recording fake.

Both follow the shape of the other engine tiers. Each has a 20-minute timeout (ci.yml:1245, ci.yml:1306); the GCP comment attributes its budget to the roughly 1.7 GB google-cloud-cli emulators image (ci.yml:1304-1305). The test step is code-guarded while the job still posts green, so adding either check to branch protection stays safe on docs-only PRs (ci.yml:1272-1276, ci.yml:1338-1342). Each project sits outside MMCA.Common.slnx because it needs Docker, and each carries an exact-count floor: --minimum-expected-tests 18 for AWS (3 S3, 7 SQS, 2 Secrets Manager, 1 DataProtection, 5 SNS push; ci.yml:1279-1288) and 14 for Google Cloud (3 Cloud Storage, 3 DataProtection key ring, 8 FCM installation registry; ci.yml:1345-1354). Neither is a required check: the comments record that promoting them is a branch-protection setting (ci.yml:1252-1253, ci.yml:1318-1319).

[Rubric §14, Testability & Test Strategy] is the category: it assesses whether each layer is tested at the level where its failures actually show, and these jobs put a real (emulated) cloud endpoint behind the adapters whose failures a request-shape unit test cannot see.

Jobs: rabbitmq-integration and azure-integration, the broker transports against real brokers

The framework ships its own broker transports (the ADR-118 exit replaced MassTransit), and the unit tier fakes the broker, so these two tiers run the transports against real ones. rabbitmq-integration (ci.yml:1129-1139, 15-minute timeout) runs the shared broker conformance scenarios (Tests/Shared/Messaging) against a real RabbitMQ in Testcontainers: that a fanout exchange fans out, that a delay queue's message TTL dead-letters the copy back to the host queue (redelivery with no plugin), that the error queue receives dead letters, and that competing consumers on one queue each get a message once.

azure-integration (ci.yml:1366-1380) runs MMCA.Common.Azure's native Service Bus transport against the official emulator through ServiceBusEmulatorFixtureBase (MMCA.Common.Testing.Azure), the base ADC and Store derive their own broker-parity tiers from. The unit tier asserts the messages, entity options and dispositions the transport builds; only a real broker settles whether the management plane accepts the topology, whether a subscription forwards to the queue, whether a scheduled redelivery comes back with its count, and whether a dead-lettered message lands in the native dead-letter queue with its reason. Its 25-minute timeout (ci.yml:1370-1372) budgets for the emulator and its companion SQL Server image, both pulled cold. It is not a required check (ci.yml:1379-1380).


MMCA.Common, release.yml

File: MMCA.Common/.github/workflows/release.yml

What it is

The lockstep NuGet release workflow. When a maintainer pushes a vX.Y.Z git tag, this workflow deterministically derives the version, packs every published package, generates a CycloneDX SBOM (a hard gate), and pushes to both GitHub Packages and nuget.org (ADR-053). Every package. One tag. One version. Every time. The authoritative package list and count live in MMCA.Common/FACTS.md, which CI regenerates from source and gates on (see the FACTS drift step in ci.yml above): read the count there rather than from any prose.

They are packed by two jobs, not one, and the split follows the solution boundary exactly. The ubuntu pack job runs dotnet pack MMCA.Common.slnx (release.yml:126-129), which packs every packable project the solution contains (MMCA.Common.slnx:10-46). The windows pack-maui job packs the one remaining package, MMCA.Common.UI.Maui, by csproj path (release.yml:355-358), because its four MAUI target frameworks need workloads that Ubuntu runners do not carry (ADR-042), which is also why that project stays out of the solution. Both jobs derive their version from the same tag, github.ref_name (release.yml:34-44, release.yml:276-287), so the lockstep release stays whole across the runner split.

Why lockstep matters

MMCA.Common's packages form a coherent framework layer. A consumer's Directory.Packages.props references all of them at the same version number. If they could release independently, a consumer bumping only some of them would import incompatible API surfaces, for example, an Application handler interface that references a Shared type that was renamed in Shared v2 but not yet reflected in the old Application v1. Lockstep eliminates this class of dependency mismatch entirely. This policy is ADR-016 (lockstep versioning + the MassTransit-v8 pin), documented in the versioning policy and in MMCA.Common/CLAUDE.md ("consumers bump every entry together in their Directory.Packages.props, no phased rollout"). The ADR's file name still carries its original MassTransit-v8 pin, which no longer applies: MassTransit left the framework at the ADR-118 exit, and the build gate that once capped its major version now bans it outright (DependencyVersionTests fails on any MassTransit* PackageVersion, MMCA.Common/Source/Hosting/MMCA.Common.Testing.Architecture/Bases/Governance/DependencyVersionTestsBase.cs:13-18).

[Rubric §32, Dependency & Supply-Chain] is embodied: the lockstep mechanism means a consumer's Directory.Packages.props is the single source of truth for which generation of the framework is in use, with no possibility of a half-upgraded state. (The set spans core, presentation, hosting/gateway, Aspire and testing layers, plus an MMCA.Common metapackage; the enumerated list is in FACTS.md, which is generated from the packable Source/* projects and is the file the CI drift gate checks.)

[Rubric §17, DevOps & Deployment] is embodied: releasing is a tag-driven, automated, reproducible action with no manual steps after the tag is pushed.

Trigger

# release.yml:3-5
on:
  push:
    tags: ['v*']

Any tag matching v* (e.g. v1.52.0) triggers the workflow. There is no branch condition, releases can be cut from any state of the repository that has a valid tag. In practice, releases are always cut from main.

Job: publish

Two stages, and why. The workflow splits every package set into a pack* job and a publish* job (release.yml:10-19). pack (release.yml:21) and pack-maui (release.yml:266) hold contents: read only and do everything that runs repository or package code: restore, build, the vulnerability audit, tests, pack and the SBOM gate, then upload the packed files as an artifact. publish (release.yml:157) and publish-maui (release.yml:386) hold the release environment and the write permissions, and run no repository code at all: no checkout, no restore, no build, no test. They download the artifact, attest it and push it to both registries, so no build-time dependency ever executes in a job that can mint the nuget.org trusted-publishing token. Both publish jobs need both pack jobs (release.yml:158, :387), so no registry receives any package of the lockstep set until every gate of every package has passed. A fifth job, github-release (release.yml:237), creates the GitHub release from that version's CHANGELOG.md section only after both publish jobs succeeded, and attaches the two CycloneDX SBOMs to it as release assets (release.yml:250-291); it alone holds contents: write, which keeps the OIDC publish jobs at contents: read. In the walkthrough below, steps that run repository code belong to pack and the pushes belong to publish.

Permissions of publish (release.yml:166-170):

permissions:
  packages: write
  contents: read
  id-token: write # OIDC token for nuget.org trusted publishing (ADR-053)
  attestations: write # build provenance attestations on the packed nupkgs (ADR-038)

packages: write is required to push to GitHub Packages using GITHUB_TOKEN. contents: read is the minimum a job token holds; the job checks nothing out. id-token: write lets the job mint an OIDC token, which is what it trades for a short-lived nuget.org key in step 11. No other permissions are granted, least-privilege OAuth scope for the token.

[Rubric §11, Security] (assesses secrets, OIDC, and minimal-permission token usage) is served: the job token only has write access to Packages, not to repo contents, issues, or deployments, and the public registry is reached with no stored API key at all.

The release environment and the merged-main assertion. Publishing to nuget.org is irreversible, a version can never be withdrawn (ADR-053), so the job declares environment: release (release.yml:165, and :393 on publish-maui) and waits on that environment's protection rules (a required reviewer, and a deployment policy limited to v* tags) before it runs at all, and it needs both pack jobs, so the reviewer is asked only after every package has passed every gate. The pack job refuses to build a tag that is not reachable from origin/main (release.yml:59-67): it fetches the branch tip and fails unless git merge-base --is-ancestor places the tagged commit on merged main. pack is bounded at timeout-minutes: 25 (release.yml:23-26, about twice the slowest recent tag run) and publish at 10 (release.yml:160-161), since it only downloads, attests and pushes, so a hung restore, test or push fails instead of holding a runner for six hours. pack-maui keeps 40 minutes (release.yml:268-271) because it has no MAUI workload cache and the workload install alone varies widely. A v* tag is the one ref pushed directly, outside the branch-protection pull-request flow, and this workflow re-runs only restore, build, test and SBOM, so the ancestry check is what makes the checks that ran on the merged pull request (the FACTS drift gate, the vulnerability audit, the Helpdesk consumer canary, the package-consumption canary, ui-e2e, the perf gate) the checks that actually covered the tree being published. pack-maui carries the same assertion (release.yml:294-311), because it packs from the same tag.

Step 1, Validate the tag (release.yml:30-44): the tag reaches the script through env: as TAG, never spliced into the script text, and must have the exact vMAJOR.MINOR.PATCH shape before anything else runs; every later step reads the validated VERSION output through env: as well. The checkout that follows (release.yml:46-49) uses fetch-depth: 0, because the next step proves the tagged commit is reachable from main (the comment at release.yml:49), with persist-credentials: false so the checkout token is not left behind in the workspace.

Step 2, .NET setup (release.yml:69-84): same as CI, 10.0.x and 11.0.x (release.yml:74-75), including the NuGet cache keyed on the committed lock files plus Directory.Packages.props.

Step 3, Restore (release.yml:86-91): dotnet restore MMCA.Common.slnx --locked-mode, so the packages that are about to be packed, SBOM'd and pushed irreversibly come from the committed lock graph rather than from whatever the feed resolves at tag time; no GITHUB_TOKEN is needed.

Step 4, Version from the validated tag (the last line of step 1, release.yml:44):

echo "VERSION=${TAG#v}" >> "$GITHUB_OUTPUT"

TAG is the full tag name (e.g. v1.52.0), already checked against the vMAJOR.MINOR.PATCH shape. The #v parameter expansion strips the leading v, yielding 1.52.0. Build and pack read it back as the VERSION environment variable, an explicit version override that no step pastes into its script text.

Step 5, Build with explicit version (release.yml:96-99):

dotnet build MMCA.Common.slnx -c Release --no-restore "-p:Version=$VERSION" -p:RunAnalyzers=false

-p:Version=... is the only source of the release version: no versioning package reads git history, and without this property the build would carry the 0.0.0-dev placeholder from Directory.Build.props. -p:RunAnalyzers=false skips the five analyzers, because a release tag only names a merged main commit whose tree already passed the analyzer-enforcing ci.yml legs (the comment at release.yml:93-95).

Step 5b, Audit dependencies (release.yml:101-110): the same ./.github/actions/nuget-vulnerability-audit composite action that ci.yml build-and-test runs, with the same accept-list (NuGetAuditSuppress in Directory.Build.props) and the same fail-closed behavior, re-run on the tag build. The comment (release.yml:101-104) gives the reason: the graph that gets packed is restored from the lock files here, and an advisory published between the PR run and the tag must stop a nuget.org push that can never be withdrawn.

Step 6, Test (release.yml:112-124):

sudo sysctl -w fs.inotify.max_user_instances=1024
dotnet test --solution MMCA.Common.slnx -c Release --no-build --minimum-expected-tests 22500

Tests run again on the tagged commit, both frameworks in one run, so the floor is twice the 11250 each ci.yml leg applies. The step before the test raises the inotify instance limit exactly as the ci.yml legs do (release.yml:112-118): this run starts both frameworks' test modules in parallel, so its exposure to the 128-instance default is at least a leg's. The comment (release.yml:121-123) states why the floor is repeated here: a discovery or filter regression that silently drops thousands of tests must fail the release, not publish behind a near-empty green run.

Step 7, Pack (release.yml:126-129):

dotnet pack MMCA.Common.slnx -c Release --no-build -o ./nupkgs "-p:PackageVersion=$VERSION"

dotnet pack over the entire solution packs every packable project it contains (Source/**) in one command. -p:PackageVersion sets the NuGet package version metadata. -o ./nupkgs collects all .nupkg files in one directory for the push step. The packages produced here all share the same version string. MMCA.Common.UI.Maui is not in the solution and is packed by the pack-maui windows job into its own ./nupkgs-maui directory from the same tag (ADR-042). The packed set is the last thing pack uploads, as the nupkgs artifact publish downloads (release.yml:148-155).

Steps 8 and 9, SBOM generation and upload (release.yml:134-151; the attestation runs in publish, release.yml:185-199):

- name: Attest build provenance (nupkgs and SBOM)
  uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
  with:
    subject-path: |
      ./nupkgs/*.nupkg
      ./sbom/*.cdx.json
- name: Generate SBOM (CycloneDX)
  uses: ./.github/actions/cyclonedx-sbom
  with:
    solution: MMCA.Common.slnx
    output-dir: ./sbom
    filename: mmca-common.cdx.json
- name: Upload SBOM
  uses: actions/upload-artifact@v7
  with:
    name: sbom
    path: ./sbom
    if-no-files-found: error

Two supply-chain artifacts follow the pack. Build provenance (release.yml:185-199): publish downloads the sbom artifact beside the packages (release.yml:185-190), and actions/attest-build-provenance writes a signed SLSA attestation binding each .nupkg and the SBOM to this workflow, this commit and this repository. GitHub stores it, and anyone holding a downloaded package or SBOM can check it with gh attestation verify <file> --owner ivanball. It needs the attestations: write permission the job declares; publish-maui downloads its own sbom-maui artifact and attests its package and SBOM the same way (release.yml:438-453). It answers the question an SBOM cannot: not what is inside the package, but whether this exact file was built by this pipeline from this commit (ADR-038). Attesting the SBOM too means the bill of materials is as verifiable as the packages it describes.

The two BOMs carry distinct file names (mmca-common.cdx.json at release.yml:144, mmca-common-ui-maui.cdx.json at release.yml:399) because both land on the same GitHub release: github-release downloads every sbom* artifact (release.yml:250-256) and refuses to create the release unless it finds exactly two (release.yml:285-291). Workflow artifacts expire; release assets do not, so the SBOM for every published version outlives the artifact retention window.

CycloneDX generates a Software Bill of Materials, a machine-readable inventory of every dependency's identity, version, and license. The SBOM is a hard gate (release.yml:131-146): the step calls the shared composite action .github/actions/cyclonedx-sbom, the same one ADC and Store deploy.yml run by ref, which fails the release when generation fails OR the BOM lists zero components (MMCA.Common/.github/actions/cyclonedx-sbom/action.yml:72-75); a missing artifact then fails the upload (if-no-files-found: error). Every published version must ship a verifiable SBOM.

[Rubric §30, Compliance, Privacy & Data Governance] (assesses whether supply-chain and licensing obligations are tracked) is served: the SBOM is the machine-readable artifact that fulfills the "know your dependencies" requirement for regulated or commercially-distributed software, and gating on it guarantees no version ships without one.

Step 10, Push to GitHub Packages (release.yml:192-193):

dotnet nuget push ./nupkgs/*.nupkg \
  --source "https://nuget.pkg.github.com/ivanball/index.json" \
  --api-key ${{ secrets.GITHUB_TOKEN }} \
  --skip-duplicate

--skip-duplicate means an accidental re-push of an already-published version does not fail the workflow, it silently skips duplicates. This is important because dotnet nuget push ./nupkgs/*.nupkg expands the glob before the push, so a partial push followed by a retry would otherwise fail on the packages that already uploaded.

GITHUB_TOKEN is automatically provided by GitHub Actions when packages: write is in the job permissions. No external secret is needed.

Steps 11 and 12, Push to nuget.org via trusted publishing (release.yml:195-213):

- name: NuGet login (OIDC to short-lived key)
  if: github.repository_owner == 'ivanball'
  uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1
  id: nuget-login
  with:
    user: ivanball # nuget.org profile name, not an email; public, so not a secret
- name: Push to nuget.org
  if: github.repository_owner == 'ivanball'
  run: dotnet nuget push ./nupkgs/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --skip-duplicate

Every release goes to both registries (ADR-053). The reason is install friction: GitHub Packages' NuGet registry demands a PAT with read:packages even for public packages, so a stranger following the README could not restore. nuget.org is the public install path; GitHub Packages remains the internal one.

The interesting part is the auth. There is no stored API key: NuGet/login exchanges the job's OIDC token for a key that lives one hour, so there is no long-lived secret to leak or rotate. The exchange is governed by a policy on nuget.org pinned to this owner, this repository, and this workflow file by their permanent GitHub ids, which is why release.yml cannot be renamed without breaking publishing, and why a fork cannot publish. The key is requested immediately before the push because it is single-use and short-lived. The if: github.repository_owner == 'ivanball' guard keeps a fork's release run from failing on an exchange it can never satisfy.

[Rubric §11, Security] again: this is the strongest form of the "no long-lived credentials in CI" property, since there is no secret to steal even momentarily.

Job: publish-maui

The MAUI package takes the same two stages. pack-maui, on windows-latest (release.yml:266-382), runs in parallel with pack and packs the one out-of-solution package, MMCA.Common.UI.Maui, which multi-targets net10.0-android/ios/maccatalyst/windows and therefore cannot build on the ubuntu runner at all (ADR-042). It validates the tag and derives the version first (release.yml:275-287), asserts the tagged commit is on merged main (release.yml:294-311), installs the MAUI workload (release.yml:330-331), restores in locked mode and audits (release.yml:337-347), builds and packs by csproj path into ./nupkgs-maui (release.yml:350-358), applies the same SBOM hard gate scoped to that one project (release.yml:360-374), and uploads the package (release.yml:377-382). publish-maui (release.yml:386-436) is an ubuntu job that needs both pack jobs, holds the release environment, and attests and pushes that artifact to both registries. Because both pack jobs read the same tag, the two runners produce the same version string and lockstep survives the split.

Two details are load-bearing, and the comments state them. The nuget.org trusted-publishing policy is keyed on the workflow file, so one policy covers both publish jobs, but each needs its own id-token: write (release.yml:169, release.yml:397) and its own exchange: a short-lived key is single-use and cannot cross a job boundary (release.yml:423-426). And the pushes run on ubuntu, where bash expands the *.nupkg glob (release.yml:384-385): the windows runner's default PowerShell would pass the pattern through unexpanded, so on pack-maui shell: bash appears only on the tag and ancestry steps (release.yml:278, release.yml:303).

The cost of the split is release surface: two runners must both succeed for a release to be whole.


MMCA.ADC, deploy.yml

File: MMCA.ADC/.github/workflows/deploy.yml

What it is

The primary CI/CD pipeline for the Atlanta Developers Conference application. It runs on every push to main, on every pull request targeting main, and on manual workflow_dispatch. On a push to main (or dispatch) it deploys to Azure; on a pull request it runs the validation jobs only, as a merge gate.

It is sixteen jobs, and the shape of the split is the interesting fact. A changes classifier (deploy.yml:80) that everything keys off; seven pull-request-only validation jobs, build-and-test (:314), build-and-test-net10 (:581), wasm-payload-budget (:648, which publishes with analyzers off, :668-681), static-security-scan (:901), integration-tests (:934), coverage (:1108) and the non-required coverage-risk (:1153); a supply-chain job (:761) that runs on every PR and on a code push and gates the deploy; four proof gates that run only on the deploy path, ai-eval-gate (:704), cost-guard (:1202), e2e-gate (:1230) and freshness (:1258, one job whose four steps carry the gate names dr-freshness, load-freshness, cross-service-freshness and cross-browser-freshness); and three deploy-path jobs, foundation (:1385), build-images (:1446) and deploy (:1610). The required merge checks are build-and-test, build-and-test-net10, supply-chain, integration-tests, coverage and wasm-payload-budget from this workflow, plus gitleaks from secret-scan.yml (MMCA.ADC/CONTRIBUTING.md:85-88).

Three structural decisions explain most of that. Validation is PR-only because branch protection enforces admins and requires branches to be up to date, so the PR's build-and-test already tested the exact tree that merges and is the test gate for the deploy (deploy.yml:1614-1616). Phase 1 and Phase 2 (foundation Bicep, then the image builds) live in their own jobs so they run concurrently with the roughly 20-minute e2e-gate instead of behind it (deploy.yml:1377-1384, :1628-1630); deploy itself is Phase 3 onward and consumes the prebuilt image tags. And the gates that remain on the deploy path cover what the PR run cannot see: e2e-gate the full stack in a browser on a UI diff, ai-eval-gate the paid live judge of the one component whose behavior can change with no code change at all (:683-703), and freshness the age of the scheduled proofs, including the firefox and webkit coverage that stays off the per-deploy critical path (:1250-1257).

Triggers and concurrency

# deploy.yml:3-8
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

The dispatch trigger also carries three inputs, skip_freshness_gates, skip_justification and runtime (deploy.yml:9-29), the first two being the break-glass described under the freshness gates below and runtime the net11.0 / net10.0 rollback switch.

# deploy.yml:60-62
concurrency:
  group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.ref) || 'prod-azure' }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

The group is chosen by event, and that is the whole design. Push and dispatch land on prod-azure with cancel-in-progress false, which serializes all production Azure mutations: a second push to main while a deploy is in flight does not cancel the running deploy, it waits. This is deliberately conservative, since an in-flight deploy cancelled mid-Bicep-apply can leave the environment in a partially-updated state. Pull requests get a per-branch pr-<ref> group that does cancel in progress, so a rapid push burst to one PR supersedes its own earlier runs and saves the minutes (deploy.yml:57-59). Splitting the group by event is what lets PR runs be cheap without ever making a deploy interruptible. The comment states the rule for anything added later (deploy.yml:54-56): any other workflow that mutates production Azure state joins the same prod-azure group.

[Rubric §29, Resilience, Reliability & Business Continuity] (assesses whether the system has deployment patterns that protect against partial-update failures) is served by the non-cancellable production concurrency group: it is a mechanical guarantee that two competing mutations cannot interleave.

Permissions (deploy.yml:43-52):

permissions:
  contents: read
  packages: read
  actions: read
  # no id-token here: each job that runs azure/login grants it itself

There is deliberately no workflow-level id-token: the four jobs that run azure/login (foundation, build-images, deploy, and cost-guard through its reusable workflow) each grant id-token: write in their own job-level block, which enables OIDC-based Azure login (no long-lived credential stored as a secret). The Azure login step (azure/login@v3) exchanges the OIDC token for a scoped Azure access token at runtime. No static client secret is ever stored in GitHub. packages: read is needed for GITHUB_TOKEN-authenticated NuGet restore of the MMCA.Common packages.

actions: read is the least obvious of the three, and the comment above it says why (deploy.yml:46-47): the four freshness steps read run history through the Actions API, and e2e-gate needs it here because a reusable workflow can never request more than its caller holds, so e2e.yml's own skip-if-unchanged guard would die on "Resource not accessible by integration" if the caller did not grant it. A permissions: block is a ceiling for every workflow it calls, not just for its own steps.

[Rubric §11, Security] is embodied: OIDC federated identity eliminates the secret-rotation burden and the credential-leak surface area of a static client secret. The federated credential is scoped to the production environment (deploy.yml:1391-1396), so only jobs that declare environment: production can obtain the Azure token.

Job: changes, the docs-only short-circuit and the per-image dirty map

The first job (deploy.yml:80-313) classifies the diff and exposes nine outputs (deploy.yml:83-92), which is where it differs from Common's single-flag version:

  • code: false only when every changed path ends in .md (deploy.yml:218-220).
  • ui: true only when the diff can change what a browser sees, that is the UI hosts, the Gateway, the AppHost, the E2E project, a module-owned Blazor UI project, a workflow file, or a build-wide file such as Directory.Packages.props or a .slnx/.slnf (deploy.yml:222-234).
  • scoring: true only for the three trees that own the AI session scorer, its use case and its evaluation suite, plus the two files its live judge composes its client from (deploy.yml:243-258), the flag that selects the paid half of ai-eval-gate.
  • six img_* flags, one per container image (deploy.yml:264-301), the per-leg dirty map the build-images matrix consumes.

The flags are consumed differently, and the difference is the point. code guards the heavy steps inside the required PR jobs, so a docs-only PR still runs every required job and posts every required status green while doing almost nothing; it additionally gates the deploy-path jobs off entirely (deploy.yml:65-69). ui gates e2e-gate, which costs roughly 20 minutes on every deploy: an infra-only or backend-only change cannot change what the browser renders, so it does not pay for a browser run (deploy.yml:71-73). The img_* flags let a build leg whose image is clean skip the build and push entirely.

All nine outputs are fail-safe in both directions, with one deliberate exception noted below. An unknown push range (a new branch or a forced ref, where github.event.before is empty or all zeros) sets code, ui, scoring and every image to true rather than guessing from a single commit (deploy.yml:136-148), and a failed git diff does the same (deploy.yml:151-163). Inside the classifier loop the default arm of each case is also true (deploy.yml:220, :241, :297-299), so an unrecognized path counts as code, as UI-affecting, and as dirtying every image. Over-running CI wastes runner minutes; under-running it ships an unverified change. The exception is scoring, whose per-path default arm is empty rather than true (deploy.yml:257): its only consumer is the paid live-judge step of ai-eval-gate, so a false positive there spends money on every unrelated deploy, while the two key-free tiers of that gate already run unconditionally (deploy.yml:246-247).

The ui classifier carries a scar worth reading: Source/Modules/*.UI/* and Source/Modules/*.UI.*/* are listed explicitly ahead of the general Source/Modules/* arm (deploy.yml:234-240), because module-owned Blazor UI ships to the browser and the earlier ordering had swallowed it into the backend-only bucket.

The img_* map is a fan-in graph, not a path-to-image mapping, and that is the part worth internalizing. First match wins, so the shared trees are listed before the per-image ones (deploy.yml:266-269). Build-wide inputs (version pins, MSBuild props, the SDK band, the feed config, the solution files, any lock file, this workflow, the Aspire AppHost and migrations tree) dirty every image (deploy.yml:272-277). A module's .Shared project carries the DTOs and identifier aliases that every service host and the Blazor UI compile against, so one .Shared edit dirties everything that ships module code, and only the Gateway (pure YARP over packages, referencing no module) escapes (deploy.yml:278-283). A .proto or adapter change in any .Contracts project dirties all four service images, because every service is both a gRPC server and a client of its peers (deploy.yml:284-287). Only after those does a per-service or per-host path map to its single image (deploy.yml:288-294).

[Rubric §31, Cost Efficiency / FinOps] is served here in a form that costs nothing at runtime: the classifier is one git diff and a case loop, and it removes both the browser leg and up to six image builds from deploys that cannot need them.

Job: build-and-test

Pull-request-only (deploy.yml:315,319): needs: changes plus if: github.event_name == 'pull_request'. The comment gives the rationale (deploy.yml:316-318): under strict require-branches-up-to-date protection the PR validates the exact tree that merges, so re-running the full CI on the post-merge push is redundant. Every heavy step below additionally carries if: needs.changes.outputs.code == 'true', so a docs-only PR still posts this job's required status green. No post-merge job re-runs these tiers on the push: branch protection enforces admins as well as strict up-to-date checks, so this PR run is the test gate for the deploy (deploy.yml:1614-1616).

Step 1, Setup and restore (deploy.yml:386-401):

- name: Restore dependencies
  run: dotnet restore MMCA.ADC.CI.slnf --locked-mode
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

MMCA.ADC.CI.slnf is the CI solution filter, it excludes the MAUI UI project (whose maui-android workload is not on Ubuntu runners), the AppHost (Aspire orchestration), the frozen combined migrations archive, and the integration and E2E test projects. The filter gives a fast, reliable build without requiring workloads beyond the standard .NET SDK. GITHUB_TOKEN is passed as an env var so the NuGet credential provider can authenticate to GitHub Packages and pull the MMCA.Common packages.

--locked-mode is what makes the NuGet cache above it trustworthy. The setup step keys ~/.nuget/packages on **/packages*.lock.json (deploy.yml:395), and the comment records the reasoning (deploy.yml:391-393): the committed lock files make the key exact, and locked mode means a cache hit is authoritative because the restore cannot resolve anything the key did not account for.

Step 2, Build (deploy.yml:403-405): dotnet build MMCA.ADC.CI.slnf --no-restore -c Release, same TreatWarningsAsErrors + five-analyzer enforcement as Common.

Navigation contract fetch (deploy.yml:470-489). Before the tests run, the job downloads adc-NavigationFlow.md from the Website repository at the pinned commit NAVIGATION_DOC_SHA, a workflow env value (deploy.yml:45), and exports its path as ADC_NAVIGATION_DOC (deploy.yml:487-489). NavigationContractTests compares ADC's @page routes and their access attributes with that document's Route Contract table (deploy.yml:472-473). The copy is never read from the Website's moving main: that branch is unprotected and a push publishes at once, so reading it would let anyone able to push there bless a page that lost its guard with no review in ADC (deploy.yml:474-477). The comment states the ordering rule outright: a route or guard change lands its Website doc PR first, then bumps NAVIGATION_DOC_SHA to that merge commit in the same ADC PR that changes the route, so the baseline moves only through a reviewed change in ADC (deploy.yml:477-480). The step rejects a value that is not a full 40-hex SHA (deploy.yml:483-486) and runs under set -euo pipefail with curl -fsSL (deploy.yml:482, :487), so an HTTP error fails the step instead of handing the test a missing file.

[Rubric §14, Testability & Test Strategy] (assesses whether the important behavior is pinned by automated tests) is served: the route and guard map a reader relies on in the navigation guide is checked against the code on every PR, so the document cannot silently drift from the @page attributes it describes.

Step 3, Unit and architecture tests with coverage (deploy.yml:491-507):

dotnet tool install --global dotnet-coverage
dotnet-coverage collect -f cobertura -o coverage.unit.cobertura.xml \
  "dotnet test --solution MMCA.ADC.CI.slnf --no-build -c Release --minimum-expected-tests 6800"

As in Common's CI, the run is wrapped in dotnet-coverage collect (it returns the inner exit code so a failure still gates) and uploaded as the coverage-unit artifact (deploy.yml:470-478, retention trimmed to 14 days) for the report-only coverage job. Coverage is not checked in this step: the two floor steps below fail the build (deploy.yml:494-496). The --minimum-expected-tests 6800 floor is solution-wide (dotnet test aggregates it across every test app): 6800 is the MMCA.ADC.CI.slnf total of 6827 measured on one PR run, rounded down to the nearest 50 so a few deleted tests do not trip it while a discovery or filter breakage that silently drops a whole project does (deploy.yml:497-501). The same comment records why this step is the production test gate: branch protection enforces admins and requires an up-to-date branch, so this run covers the exact tree that merges and no post-merge job repeats it (deploy.yml:501-503). Every global tool this workflow installs is pinned to an exact version (dotnet-coverage 18.11.0 and dotnet-reportgenerator-globaltool 5.5.11, at deploy.yml:438 and :503; the CycloneDX tool is installed inside the shared SBOM action), so a tool release cannot change what a gate measures between two runs of the same commit. Covers unit tests for all module layers plus Architecture.Tests (architecture fitness functions, layer flow, domain purity, module isolation).

[Rubric §14, Testability & Test Strategy] is served: architecture tests enforce that the modular structure is not accidentally violated by a new project reference (e.g. Domain referencing Infrastructure).

Step 4, Unit-tier coverage floor (deploy.yml:480-510). Unlike Common, ADC enforces its floor here rather than in the coverage job, and the comment says why (deploy.yml:482-483): build-and-test is a required PR check, while coverage is report-only and absent from deploy's needs, so a floor living there would gate nothing. The floor is 55.5% line coverage (deploy.yml:508), measured with ReportGenerator over +MMCA.ADC.*;-*.Tests;-MMCA.ADC.*.Service;-MMCA.ADC.*.Contracts (deploy.yml:505-506).

Every term in that filter is a correction of a measurement that lied. +MMCA.ADC.* excludes the consumed MMCA.Common assemblies, which are tested in their own repo and instrument at near zero here, deflating the figure to about 26.8%. The *.Service and *.Contracts exclusions were added on 2026-08-01 when MMCA.ADC.Services.Tests first pulled the service hosts and the gRPC contracts into the unit cobertura: hosts are integration-tier subjects (Program.cs, Kestrel config, warm-up) and contracts are dominated by protobuf-generated plumbing, so both deflate the unit number without measuring unit code, 52.8% raw versus 62.5% filtered on the same run (deploy.yml:489-494). A coverage floor is only a regression backstop if the number it watches moves for the reason you think it does.

Step 5, Application-layer branch coverage floor (deploy.yml:512-546). A second, narrower gate reads the same cobertura file, and the reason it exists is the sharpest coverage argument in the repository (deploy.yml:514-520). The repo-wide floor above is a blunt average dominated by UI, Infrastructure and generated code, so a command handler can lose every branch it had and the global number barely moves. The Application layer is where the business decisions live (guards, authorization short-circuits, retry and conflict paths), and those are branches, not lines: a handler can be fully line-covered by one happy path while every failure branch goes unexercised. So this gate measures branch coverage (deploy.yml:542) over the four Source/Modules/*/*.Application assemblies only (-assemblyfilters:'+MMCA.ADC.*.Application;-*.Tests', deploy.yml:534-535), with a floor of 77.5% (deploy.yml:544), about two points under the 79.7% measured on 2026-08-26 across the full unit tier.

The step's most transferable line is the guard before the measurement (deploy.yml:537-541): if the report covers fewer than four assemblies it fails outright, because a filter that matched nothing would otherwise let the floor pass vacuously. That is the same instinct as the --minimum-expected-tests floors throughout this chapter: a gate whose input went missing must be indistinguishable from a gate that failed.

Step 6, EF migrations model-drift gate (deploy.yml:554-569):

for module in Identity Conference Engagement Notification; do
  project="Source/Hosting/MMCA.ADC.Migrations.SqlServer.$module"
  dotnet ef migrations has-pending-model-changes \
    --project "$project" --startup-project "$project" \
    --context SQLServerDbContext --configuration Release --no-build
done

dotnet ef migrations has-pending-model-changes compares the EF design-time model to the committed migration snapshot without connecting to a database. If a developer changes an entity configuration (adds a column, renames a property) but forgets to author a new migration, this step fails the build. The comment at deploy.yml:556-558 names the comparison: the design-time model against the committed migration snapshot.

This is one of the most important gates in the pipeline. An entity model that diverges from the migration history means the production schema diverges from the application's EF model, a runtime crash on first query of the changed entity. The gate catches it at build time, before any container image is pushed. It is doubly important now that deploy.yml has no sqlcmd migration step: this build-time gate is the guarantee that the services' startup Migrate() always has a migration to apply for every model change.

The --no-build flag reuses the Release build from Step 2, so there is no rebuild overhead. dotnet-ef is installed globally (version 11.0.0, matching MmcaEfCoreVersion on the net11.0 line this job builds) in the step before this one (deploy.yml:548-552), because the tool must not be older than the EF Core runtime it loads and the two are bumped together.

[Rubric §8, Data Architecture] (assesses whether schema management is automated, versioned, and safe) is directly served. [Rubric §17, DevOps & Deployment] is served: the migration gate is the CI enforcement of the "migrations-before-code" discipline.

The expand/contract migration guard (deploy.yml:330-384) is the job's first step, ahead of even the .NET SDK setup, because it needs nothing but git, awk and grep:

# deploy.yml:330-331
- name: Expand/contract migration guard (schema rollback safety)
  if: needs.changes.outputs.code == 'true'

It is the other half of the schema-safety story the model-drift gate starts. The drift gate proves a migration exists for every model change; this one proves the migration is safe to be rolled back past. The post-deploy smoke gate's remedy (Phase 5 below) is a container-app revision rollback, and a revision rollback does not revert schema: each service self-applies its migrations at startup, so the previous release comes back up against the new schema. A DropColumn, DropTable or DropIndex (or a RenameColumn/RenameTable, which EF emits silently when a property or entity is renamed) in the migration that just shipped therefore breaks one-release-back compatibility, and the rollback that was supposed to rescue the deploy fails on the way back down. The step comment (deploy.yml:332-340) states exactly that chain.

The rule: for every migration file added by the pull request, if the Up() body contains DropColumn, DropTable, DropIndex, RenameColumn or RenameTable and does not contain EXPAND-CONTRACT-OVERRIDE, fail (deploy.yml:375-377). The renames are in the list because a rename breaks the previous revision exactly like a drop does, and the error text says so (deploy.yml:378). Three scoping decisions carry the design:

  • The file set is git diff --diff-filter=A --name-only "origin/<base>...HEAD" (deploy.yml:360-361), path-scoped to Source/Hosting/MMCA.ADC.Migrations.SqlServer.*/Migrations/*.cs. Only added files count, so the four per-service migrations projects are covered and nothing else in the tree is.
  • .Designer.cs files are skipped (deploy.yml:372-374), they carry the model snapshot, not operations.
  • Only the Up() body is scanned, extracted with awk between the Up( and Down( signatures (deploy.yml:375). Every additive migration's Down() legitimately drops what Up() added, and Down() never runs at startup (down-migration is explicit tooling only), so scanning the whole file would fail every ordinary migration.

The escape hatch exists because the contract half of an expand/contract sequence genuinely is a drop, and it is correct once the expand half has been in production for a release. It is documented as // EXPAND-CONTRACT-OVERRIDE: <reason> but enforced as a bare substring match (deploy.yml:377), so the comment form is convention, not syntax, and one occurrence anywhere in the Up() body exempts every destructive operation in that migration. The marker is a prompt for the reviewer to ask "has the expand half already shipped?", not a machine-checked proof that it has.

The checkout immediately above sets fetch-depth: 0 for this step alone, and says so (deploy.yml:325-327): without full history the base diff cannot resolve. That coupling produces the most transferable lesson in the whole job. There is deliberately no || true on the diff: when it fails, the step prints an error naming fetch-depth and exits 1 (deploy.yml:355-364). A gate that cannot evaluate must fail closed, because the alternative is a required check that reports green while checking nothing, and the comment records the incident that settled the point: swallowing that error is exactly what made this check silently pass on every run in MMCA.Store between 2026-07-25 and 2026-07-28. It is the same instinct as the --minimum-expected-tests floors elsewhere in this chapter: a gate whose input went missing must be indistinguishable from a gate that failed.

MMCA.Store runs the same step in its own build-and-test (MMCA.Store/.github/workflows/deploy.yml:279), path-scoped to Source/Hosting/MMCA.Store.Migrations.SqlServer.*/Migrations/*.cs; it ships the identical startup-migration plus revision-rollback model and had no equivalent guard before the port (MMCA.Store/.github/workflows/deploy.yml:289-294).

ADR-057 is the decision record. [Rubric §8, Data Architecture] is served at the level the drift gate cannot reach: not just "a migration exists" but "the schema stays compatible with the release you can still roll back to". [Rubric §29, Resilience, Reliability & Business Continuity] is served because it is what keeps the automatic rollback in Phase 5 an actual recovery path rather than a hopeful one.

OpenAPI documents are current (deploy.yml:407-422) is a contract-first gate that runs right after the Release build. Each *.Service host writes openapi/<host>.json during that build (the MmcaGenerateOpenApiDocument target in Directory.Build.props, per the comment at deploy.yml:409-412), and the four documents are committed. The step asserts that exactly four documents are tracked (deploy.yml:415-418) and that git diff --exit-code over Source/Services/*/openapi/*.json is empty (deploy.yml:419-421). A PR that changes a route, parameter, status code or response shape without committing the regenerated document therefore fails, so the contract change is a reviewable diff instead of a runtime surprise. When it fails, Upload the regenerated OpenAPI documents (deploy.yml:424-434, under if: failure()) publishes the runner's regenerated files as the openapi-regenerated artifact with a seven-day retention: those files ARE the expected contract, so the fix is a download and a commit rather than guessing from a --stat line, and a green run leaves no artifact behind. Both steps are guarded on the code flag like the rest of the job.

Job: build-and-test-net10, keeping the second framework line honest

ADC runs net11.0 by default with a gated net10.0 line (ADR-141). build-and-test-net10 (deploy.yml:581-585, PR-only, 20-minute timeout) keeps that second line from rotting: the same tree, restored from the packages.net10.0.lock.json lock file set, built with the same analyzers at error severity, and run through the same unit, architecture and bUnit suites (deploy.yml:571-580). MmcaNet arrives as an environment variable, which MSBuild reads as the property, so no command carries a -p: flag that could be forgotten. It deliberately omits what is framework-independent or default-line-only: the migration guard, the OpenAPI drift check (the committed documents are the net11.0 build's output), coverage, and the EF model-drift gate (one migration set is shared by both lines and checked once, on the default line). Without this job the #else branches of every #if NET11_0_OR_GREATER block would compile only when someone remembered to build the old line by hand.

Job: ai-eval-gate, the behavior that changes without a code change

ai-eval-gate (deploy.yml:683-752) exists for the one component in this repository whose behavior can move while every unit test stays green: the AI session scorer that ranks submitted talks for organizers. The comment states the case (deploy.yml:684-687): a prompt edit, a model deprecation, or a provider-side contract change each moves the numbers an organizer uses to accept or decline a talk.

The evaluation has two tiers split by cost, and the split decides where each one runs (deploy.yml:689-698):

  1. Golden replay plus prompt contract. No API key and no network: recorded proposals are replayed through the real scoring service, and the rendered prompt is hashed against the hash recorded for the current PromptVersion. This is the tier that catches a prompt edit that forgot to bump the version, a delimiter that stopped being emitted, and a change to the weighting math. These tests carry no trait, so they run on every pull request in build-and-test's MMCA.ADC.CI.slnf pass, against the exact tree that merges (deploy.yml:690-695).
  2. Live judge. Real paid calls to the configured AI provider's API for each golden proposal, asserting the overall score lands in the case's band. The bands are deliberately wide: a judge model is not deterministic, and a flaky gate gets ignored (deploy.yml:696-698).

The job exists for the second tier, so it runs only on a code deploy whose diff touches the scoring code, if: github.event_name != 'pull_request' && needs.changes.outputs.code == 'true' && needs.changes.outputs.scoring == 'true' (deploy.yml:706), precisely because it costs money; every other deploy skips it, and deploy accepts skipped (deploy.yml:700-703). It restores and builds one project by path, Tests/Modules/Conference/MMCA.ADC.Conference.Scoring.Evaluation.Tests, with --locked-mode (deploy.yml:723-729), so it never pays for the full solution, and it re-runs the replay tier first as a cheap precondition for spending on the judge, with --filter-not-trait "Category=AiEval.Live" --minimum-expected-tests 1 (deploy.yml:731-738): a filter breakage that runs zero tests must red the gate rather than report a vacuous pass.

Two details in the live step are worth reading. It sets no --minimum-expected-tests floor, and the comment says why (deploy.yml:741-743): without AI_API_KEY every case skips itself dynamically, reported as skipped and never as passed, so a zero-run must not red the deploy on a repository whose secret is absent. And the key arrives as a step-scoped env from secrets.ANTHROPIC_API_KEY mapped to the provider-neutral variable AI_API_KEY (deploy.yml:749-752; the secret keeps its name because it holds an Anthropic credential, and only the variable the test reads is neutral), never as a build argument or a workflow input.

This is also why scoring is the one classifier output that does not fail safe to true (deploy.yml:243-247): a false positive there spends money on an unrelated deploy, while the key-free tier already runs on every PR, so the narrow set costs nothing in coverage.

[Rubric §14, Testability & Test Strategy] assesses whether the system's behavior is actually verified rather than merely compiled. The golden replay is the honest answer for a non-deterministic component: the deterministic parts (prompt rendering, version pinning, weighting math) are asserted exactly, and the non-deterministic part is asserted as a band. [Rubric §31, Cost Efficiency / FinOps] is served by the tier split itself: the gate that costs money runs only for the diffs that can change what it measures.

Job: supply-chain

This job (deploy.yml:761) runs on every pull request and on every code push, if: github.event_name == 'pull_request' || needs.changes.outputs.code == 'true' (deploy.yml:763), so a docs-only push skips it along with the deploy. Unlike the other validation jobs it is not PR-only: it is in deploy's needs list (deploy.yml:1613) and its result must be success for the deploy to proceed (deploy.yml:1645). Both of its steps that matter are gates, and the comment above the job splits them by event (deploy.yml:754-760): the vulnerability audit runs on both events, the SBOM on the pull request only.

Three credential-free gates run first, on a pull request with a code diff:

  • Bicep compile (deploy.yml:771-796) builds infra/foundation.bicep and infra/main.bicep and fails on a non-zero exit or any output at all, because the deploy's arm-deploy step runs with failOnStdErr, so even an INFO diagnostic would fail the production deploy after Azure had already applied it (the comment at deploy.yml:773-778).
  • Workflow lint (deploy.yml:851-862) runs MMCA.Common's shared lint-workflows composite action, pinned to the v1.335.0 release commit (deploy.yml:860; MMCA.Common/.github/actions/lint-workflows/action.yml, one copy that Common, ADC, Store and Helpdesk all run, Helpdesk also over its template overlay workflows): every uses: is a 40-hex commit SHA, a local path or a digest-pinned docker:// image, no ${{ }} expression sits inside a run: body (comment lines included), and every checkout sets persist-credentials: false or states why it needs git credentials. It runs here because supply-chain is a required check, the same placement as MMCA.Store.
  • Template policy (deploy.yml:807-822) compiles both templates to ARM JSON and runs scripts/security/check-template-policy.ps1 (deploy.yml:822), which fails on a storage account or blob container open to anonymous reads that it does not record as intended, a Key Vault without RBAC authorization, or a SQL firewall rule spanning the whole IPv4 range; and, evaluated with every parameter at its default (N-ADC-pipeline-16), on Shared Key allowed on a storage account, a TLS floor below 1.2 (or missing), or Service Bus or Redis local authentication written on (deploy.yml:809-815). The defaults matter because they are what a deploy gets when an optional variable is unset, so a template that is only secure with the right parameters supplied is caught here.

Then the two dependency gates:

  • Vulnerability audit (deploy.yml:840-846) fails on any vulnerable-package row except advisories accepted via NuGetAuditSuppress in Directory.Build.props. It is no longer a copy of Common's gate: it calls the shared composite action ivanball/MMCA.Common/.github/actions/nuget-vulnerability-audit, pinned to an MMCA.Common release commit SHA (deploy.yml:845), the implementation Common's ci.yml runs by path, so the fail-closed exit-code and report-header checks and the narrow <NuGetAuditSuppress ... Include="GHSA-..." accept-list reading described in the Common section above apply here unchanged. The comment (deploy.yml:840-844) gives the reason: one implementation for the framework and its consumers instead of a copy per repository that drifts (ADR-038). ADC passes report-path: supply-chain/vulnerable.txt, so the raw report still lands in the artifact uploaded on the pull request. NuGetAudit at restore already gates the build; this makes the job a deploy-gating belt-and-suspenders check.

  • CycloneDX SBOM (deploy.yml:862-866) must exist and contain components, and it is generated on the pull request only. It calls the shared cyclonedx-sbom action, pinned the same way (deploy.yml:862), with name: MMCA.ADC.CI and filename: adc-sbom.json; the action fails unless the file exists and jq '.components | length' is greater than zero (MMCA.Common/.github/actions/cyclonedx-sbom/action.yml:72-75), because a zero-component skeleton passes a plain file-size check, which is exactly how an empty SBOM once went unnoticed. The comment (deploy.yml:856-861) records three further choices: the action normalises the .slnf itself; every MMCA.Common action is pinned to a release commit SHA, so a change merged to Common main reaches this pipeline only through an ADC pull request (the monthly github-actions Dependabot group bumps the pins together); and the step is PR-only because branch protection requires an up-to-date branch, so the PR's SBOM describes the exact lock files that merge. On a push the job adds only what can be new, the restore and the audit, which catch an advisory published after the PR ran (deploy.yml:757-760).

The vulnerability report and the SBOM upload as the supply-chain-reports artifact with a 14-day retention, on the pull request only (deploy.yml:869-878).

A .slnf records Windows-style project paths, and on the Linux runner a backslash is an ordinary filename character, so a tool that opens those paths directly resolves zero projects. dotnet list is unaffected because MSBuild normalizes separators, but CycloneDX once emitted an empty SBOM this way. That is why the job passes the original MMCA.ADC.CI.slnf to the SBOM action (deploy.yml:864) and leaves the forward-slash normalization to the action itself (MMCA.Common/.github/actions/cyclonedx-sbom/action.yml:62-65), and why --set-name MMCA.ADC.CI lives inside that action too, driven by the name: MMCA.ADC.CI input (deploy.yml:865, applied at action.yml:69): it pins the BOM metadata component to a stable name.

One scope limit is worth naming here, because a separate workflow exists to cover it: this job audits MMCA.ADC.CI.slnf, which deliberately excludes the MAUI head, so the largest dependency graph in the repo is invisible to it. That gap is closed weekly by maui-audit.yml, covered in the repository automation section below.

The transferable lesson is the one the empty SBOM taught: a supply-chain artifact that is generated but never asserted on is indistinguishable from one that was never generated.

[Rubric §32, Dependency & Supply-Chain] is served, now as a gate rather than a report: a non-suppressed vulnerable package blocks the production deploy, and a component-less SBOM blocks the merge, so every merged tree carries a machine-readable inventory of what it ships.

Job: static-security-scan, Semgrep

static-security-scan (deploy.yml:901-907, PR-only, 15-minute timeout, contents: read) runs Semgrep over the deployed code. Semgrep parses some current C# syntax only partially (about a fifth of Source/ logs PartialParsing), so the comment is explicit that it widens coverage beside the five analyzers and code review and does not replace them; tests are not deployed, so they sit outside the gate (deploy.yml:894-898). The workflow lint does not run here: it runs in the required supply-chain job (deploy.yml:899-900), where it turns the hardening conventions at the top of this chapter from a review habit into a merge-blocking check. This job is not a required check yet (deploy.yml:898-899).

[Rubric Section 11, Security] assesses whether security analysis is automated rather than left to review. This job adds a second static engine beside the analyzers; the action-pinning and template-injection rules every workflow here relies on are enforced by the lint in supply-chain.

Job: integration-tests

This job is pull-request-only (deploy.yml:935,941), and deploy does not list it:

needs: changes
if: github.event_name == 'pull_request'

It runs the per-service WebApplicationFactory integration tests against a real SQL Server, covering roughly 420 test methods across the four projects MMCA.ADC.Integration.slnf lists: Identity, Conference, Engagement and Notification (MMCA.ADC.Integration.slnf:5-8).

How it protects production is worth being precise about, because the mechanism is not the one you would guess. This job never runs on the push to main, and it is absent from deploy's needs list (deploy.yml:1613); the only job that consumes it is coverage (deploy.yml:1128). The protection comes from branch protection instead: admins are enforced and main requires branches to be up to date, so the PR check runs against the exact merge tree that will land (deploy.yml:1614-1616). The practical consequence is that a workflow_dispatch run of deploy.yml does not re-run the integration tier at all, and that no deploy-path job re-runs the PR's test tiers: the PR checks are the test gate, with e2e-gate adding the browser tier on a UI diff.

SQL Server as a guarded step, not a services: block (deploy.yml:951-961):

- name: Start SQL Server
  if: needs.changes.outputs.code == 'true'
  run: |
    docker run -d --name sqlserver \
      -e ACCEPT_EULA=Y \
      -e MSSQL_SA_PASSWORD="$MSSQL_SA_PASSWORD" \
      -e MSSQL_PID=Developer \
      -p 1433:1433 \
      mcr.microsoft.com/mssql/server:2022-latest

An ephemeral SQL Server Developer Edition container is started by an explicit docker run, and the placement is the design detail: a job-level services: block starts before the first step and cannot be conditioned, so a docs-only PR would pay to pull and boot SQL Server for nothing. As a guarded step it is skipped with everything else while the job still runs and posts its required status green (deploy.yml:936-940). MMCA.Common's Helpdesk canary now uses the identical pattern for its migration apply (MMCA.Common/.github/workflows/ci.yml:764-775).

The password lives in the job's env: (deploy.yml:944-945) because it is a throwaway SA credential for an ephemeral container, not a production secret, and not stored in GitHub Secrets. The comment states it explicitly (deploy.yml:939-940): "Throwaway SA password, not a secret."

Wait-for-SQL-Server gate (deploy.yml:987-999): a 30-iteration poll loop (5-second sleep each) using sqlcmd (installed by the step at deploy.yml:971-985) to execute SELECT 1. SQL Server takes 10 to 20 seconds to initialize in a fresh container; proceeding immediately would fail the restore or build with a connection error. The loop exits early on success rather than running the full 150-second maximum, and exits 1 if the server never answers, so a container that failed to boot is a job failure rather than a confusing downstream test error.

Integration test run (command at deploy.yml:1122): like the unit tier, the test command is wrapped in dotnet-coverage collect (emitting the coverage.integration.cobertura.xml artifact at deploy.yml:1096-1104):

env:
  ADC_TEST_SQL_BASE: "Server=localhost,1433;User Id=sa;Password=${{ env.MSSQL_SA_PASSWORD }};TrustServerCertificate=True;Encrypt=False;"
run: dotnet test --solution MMCA.ADC.Integration.slnf --no-build -c Release --minimum-expected-tests 650

The ADC_TEST_SQL_BASE connection string is consumed by IntegrationTestBase to provision per-test databases (each test gets a fresh database, reset between tests). MMCA.ADC.Integration.slnf is a separate solution filter that includes only the four integration test projects; the restore and build steps immediately before (deploy.yml:1001-1009) target the same filter, restore in --locked-mode like build-and-test. The run floors at 650 discovered tests, the filter's measured total of 687 rounded down to the nearest 50 (deploy.yml:1117-1118), and the same job enforces its own coverage floor: 42.5% line coverage over the Infrastructure and API assemblies, read from the integration report (deploy.yml:1092), failing as well when that report covers fewer than six assemblies (deploy.yml:1087-1090), so a filter that matches nothing cannot pass.

[Rubric §14, Testability & Test Strategy] is served at a higher tier than the unit tests: these tests exercise real EF migrations, real HTTP middleware, real domain logic through a real SQL Server engine. A bug that only manifests under an actual database connection (e.g. a LINQ translation error, a migration column type mismatch) is caught here before it reaches production.

Job: coverage, report-only by design

This job (deploy.yml:1108-1144) downloads both coverage-* artifacts, merges the unit/architecture/bUnit and integration cobertura tiers with ReportGenerator over +MMCA.*;-*.Tests, writes the summary to the run's Step Summary (deploy.yml:1132-1144); it generates an HTML report too but uploads no artifact.

Two conditions are worth reading together. needs: [changes, build-and-test, integration-tests] with if: always() && github.event_name == 'pull_request' (deploy.yml:1109-1110) means it runs after both test jobs regardless of their outcome, so a failing run still yields its partial coverage picture. And it is not in deploy's needs (deploy.yml:1613), which is the deliberate part: this job never blocks anything. That is precisely why ADC's coverage floors live in the required test jobs instead: line and branch in build-and-test (deploy.yml:508, :544, above) and the Infrastructure+API integration line floor in integration-tests (deploy.yml:1092). Splitting them this way keeps the enforcement on a required check and the merged report where it is useful, on the pull request.

[Rubric §14, Testability & Test Strategy] is served in two tiers here: the floors are the gate, the merged report is the visibility.

Job: coverage-risk, the ratchet plus untested entry points

The ADC counterpart of the framework's ratchet (deploy.yml:1153), PR-only and non-required. It fails only on new risk against committed baselines that only shrink, in two lists: crap, a method not in .github/coverage-baselines/crap.txt above CRAP 30 (unit and integration merged, best line rate per method) or a baselined method whose CRAP rose; and entrypoints, a controller action, gRPC service method or integration-event handler with 0% coverage in the integration report that is not in entrypoints.txt. Stale baseline entries only warn. It sits in neither the required coverage job's needs nor deploy's, for the same skipped-required-check reason as the framework's coverage-risk.

Job: cost-guard, a scheduled check promoted to a deploy gate

# deploy.yml:1202-1220 (comments elided)
cost-guard:
  needs: changes
  if: github.event_name != 'pull_request' && needs.changes.outputs.code == 'true'
  permissions:
    id-token: write
    contents: read
  uses: ./.github/workflows/cost-guard.yml
  with:
    deploy_gate: true
  secrets:
    AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
    AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
    AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

The FinOps surge-drift check gets its own section further down as a standalone workflow. What matters here is the short job that makes it a gate: deploy.yml calls cost-guard.yml as a reusable workflow and lists it in deploy's needs (deploy.yml:1613, required success at :1646), so a production deploy cannot proceed while a conference-day scale-up is still un-reverted (cost-guard.yml:16-18). Two lines of the job are there for reasons that are easy to strip by accident. The explicit permissions block (deploy.yml:1205-1209) exists because a reusable workflow can never hold more than its caller grants, and the called workflow runs azure/login, so without id-token: write the gate could not authenticate at all. And deploy_gate: true (deploy.yml:1211-1214) is what lets a surge left over from an expired conference window through: that deploy is the revert, so blocking it would make the surge impossible to remove through the pipeline. The secrets are an explicit three-value map, not secrets: inherit (deploy.yml:1215-1220): the called workflow receives only what its azure/login step reads, never the rest of the repository secrets.

It is skipped on pull requests because there is no production OIDC there, and deploy is PR-skipped anyway. The cost of the gate is under a minute of read-only az queries, which is what makes reusing the daily cron's own workflow the cheap option rather than a duplicated inline check.

[Rubric §31, Cost Efficiency / FinOps] is served in the strongest available form: an un-reverted surge does not merely raise an alert, it stops the next deploy until someone reverts it.

Job: e2e-gate, one chromium leg against the full Aspire stack

# deploy.yml:1230-1244 (comments elided)
e2e-gate:
  needs: changes
  if: github.event_name != 'pull_request' && needs.changes.outputs.ui == 'true'
  uses: ./.github/workflows/e2e.yml
  with:
    browsers: '["chromium"]'

The same reusable-workflow shape as cost-guard, pointed at e2e.yml, except that it passes no secrets at all (deploy.yml:1245-1248): e2e.yml reads only the automatic GITHUB_TOKEN, which a called workflow always receives. This is the §28 merge-gate promotion of 2026-07-02 (deploy.yml:1222-1229): the Playwright suite runs against the full Aspire stack (SQL Server, Redis, RabbitMQ, four services, Gateway, UI) before a deploy is allowed to roll.

Three scoping decisions carry it, and each is a cost or a correctness trade made explicit:

  • Chromium only. The gate runs one engine instead of three (2026-07-18), and firefox plus webkit cross-browser coverage stays on e2e.yml's own schedule. One engine still catches the regression class that matters on the deploy path; three paid triple for information that changes on the scale of a release.
  • Gated on ui, not code (deploy.yml:1232-1234). At roughly 20 minutes this is the most expensive gate in the pipeline, and an infra-only, script-only or backend-only deploy cannot change what the browser sees. The comment says why the deploy that skips it is not untested (deploy.yml:1236-1240): the PR's build-and-test (the CI.slnf unit, architecture and bUnit tiers) is the test gate, because branch protection enforces admins and requires an up-to-date branch, so that run covers the exact tree that merges; and the post-deploy smoke gate probes Conference, Engagement and Notification through the Gateway and auto-rolls-back behind it. It also names the revert, change ui back to code, which is the right thing for a cost optimization to document.
  • success or skipped. In deploy's condition the unconditional gates must all be success, but e2e-gate may also be skipped (deploy.yml:1650). That exception is the whole reason deploy uses always() plus explicit per-need results instead of default success() semantics, covered under the deploy job below.

The advice in the comment is worth keeping (deploy.yml:1228-1229): if a genuine contention flake blocks a deploy, re-run the job and read its trace artifact before demoting the gate over a single red.

[Rubric §28, Front-End Testing & Quality] is served: a browser-level regression in a UI-affecting change cannot reach production.

Job: freshness (steps dr-freshness, load-freshness, cross-service-freshness, cross-browser-freshness)

One job, four near-identical steps, one idea: a deploy blocks on the age of out-of-band verification, not only on the tests that are green in this run. Each step asks the Actions API for the newest qualifying run of one scheduled workflow and fails when that proof is older than its window, or when there is no qualifying run at all. Each step's name and id is the gate's name, so a red step reads exactly as the gate it is (deploy.yml:1250-1257).

Step Proof it demands Producing workflow Window
dr-freshness (deploy.yml:1271) a real PITR restore drill with its RTO timing, and no unrecovered failed drill of any database dr-drill.yml 8 days (deploy.yml:1283)
load-freshness (deploy.yml:1294) the k6 capacity run at the observed peak load-test.yml 35 days (deploy.yml:1303)
cross-service-freshness (deploy.yml:1315) the Testcontainers outbox to broker to consumer round-trip and the Service Bus emulator parity smoke cross-service-tests.yml 5 days (deploy.yml:1328)
cross-browser-freshness (deploy.yml:1354) a successful firefox and webkit leg of the Playwright suite e2e.yml 10 days (deploy.yml:1367)

Every step calls the shared composite action ivanball/MMCA.Common/.github/actions/freshness-gate, pinned to an MMCA.Common release commit SHA (deploy.yml:1279, :1299, :1322, :1362), one implementation for every consumer (ADR-038). The action lists a workflow's runs unfiltered and filters them client-side, paging as needed, because the server-side status=completed and status=success listings have served stale pages that hid the newest runs (the action's description in MMCA.Common/.github/actions/freshness-gate/action.yml). The job runs only on a code push or dispatch, if: github.event_name != 'pull_request' && needs.changes.outputs.code == 'true' (deploy.yml:1260), with a five-minute timeout and only two read privileges, actions: read plus contents: read (deploy.yml:1262-1265): it reads run history and runs nothing, no restore, no k6, no Docker daemon. Steps two to four carry if: ${{ !cancelled() }} (deploy.yml:1296, :1317, :1356), so one stale proof never hides the state of the others, and the job fails when any step fails. And freshness sits in deploy's needs list (deploy.yml:1613), which is the entire point: a stale proof blocks the production deploy.

dr-freshness adds a second condition through the action's failure-key-job-prefix input (deploy.yml:1276-1285, input at MMCA.Common/.github/actions/freshness-gate/action.yml:71). dr-drill.yml names its drill job drill (<database>), and with the prefix drill ( the action walks the newest completed runs and fails when a job of that name concluded failure or timed out with no success of the same job name in a newer run. A failed drill of one database therefore keeps the gate red until that database drills green again; a later green run of another database, from the weekly rotation or a default dispatch, cannot clear it.

That needs edge is what separates a gate from a report. A scheduled workflow nobody watches can sit unrun or red for weeks while deploys ship daily, and the recovery-objective evidence still technically "exists". Making recency a dependency prices the verification correctly too: the expensive run stays on its cron, the deploy pays for a lookup. Each window is the producing cadence plus slack (weekly drill and an 8-day window, monthly k6 and a 35-day window, alternating weekly browser crons and a 10-day window), so an on-schedule producer never trips the gate.

cross-browser-freshness closes a hole the cost reduction opened. The deploy-gating e2e-gate runs chromium only, so firefox and webkit coverage lives on e2e.yml's alternating weekly crons; this step makes that coverage mandatory again without putting either engine back on the roughly 20-minute per-deploy critical path, which is exactly how the step's own comment states it (deploy.yml:1338-1342).

Like cross-service-freshness, it refuses to trust a run's conclusion, and here it resolves each engine separately (required-jobs-mode: per-job, deploy.yml:1372): it walks the last 40 completed e2e.yml runs and, for each engine, takes the newest run in which the job named E2E (<engine>) itself concluded success, so the two proofs normally come from two different runs and either one missing or stale fails the step (deploy.yml:1366-1373). The comment gives the reason the run conclusion is a lying proxy (deploy.yml:1349-1353): the matrix is fail-fast: false with the non-chromium legs continue-on-error on the schedule, so a run's conclusion says nothing about whether a given engine actually passed; and e2e.yml's own should-run guard can make a run conclude success with every leg skipped. Asking the jobs API which leg passed is the only question whose answer means what the gate needs it to mean.

The 10-day window is the per-engine weekly cadence (Monday firefox, Thursday webkit) plus slack for a skipped or re-run night (deploy.yml:1344-1347, :1366-1367), and the break-glass is the same as for the other three steps, described below.

[Rubric §28, Front-End Testing & Quality] assesses whether browser-level tests catch rendering and functional regressions. This gate is how cross-engine coverage (which the workflow labels rubric §22) stays enforceable while only one engine runs per deploy: the proof still has to exist and still has to be recent, it just does not have to be produced by this run.

cross-service-freshness is the one worth reading closely, because it does not trust the run's conclusion, and because what it demands was widened on 2026-08-31 (TD-17). It walks the last 25 completed runs of cross-service-tests.yml (any conclusion) and counts a run only when both the cross-service job (the Testcontainers RabbitMQ outbox to broker to consumer round-trip) and the servicebus-emulator-smoke job (Azure Service Bus emulator topology plus AMQP round-trip) concluded success in that same run (required-jobs-mode: same-run, deploy.yml:1330-1333).

That second job used to be advisory (continue-on-error), which meant broker parity against the transport production actually runs was measured nightly and then thrown away, since a red there blocked nothing (cross-service-tests.yml:128-134). Making it authoritative is what turns "the outbox reaches a broker" into "the outbox reaches both the test broker and the production transport's emulator".

The run conclusion is not a usable proxy, and the step's comment says why (deploy.yml:1318-1321): the skip-if-unchanged guard can make a run conclude success with the test jobs skipped, so no round-trip executed, and keying off the run would accept a proof that never happened. Counting any completed run works in the other direction too: a run cancelled after both broker jobs passed still holds a genuine, recent proof, and it counts. The per-job check is honest both ways because it counts a run only when both named jobs actually ran and passed. And the workflow's own comment states the counterpart rule for whoever finds this red (cross-service-tests.yml:136-138): fix it or dispatch a green run, do not re-add continue-on-error to unblock a deploy. The sanctioned escape hatch is the break-glass below, which forces a written justification into the run summary.

Its window was widened from 3 to 5 days on 2026-07-18 (deploy.yml:1326-1328) when cross-service-tests.yml moved to weekdays plus the skip-if-unchanged guard: the last successful nightly can legitimately be about four days old across a weekend or a holiday. A window narrower than the producing cadence is a gate that fails for calendar reasons, and a gate that fails for calendar reasons trains people to reach for the break-glass.

Break-glass is two workflow_dispatch inputs, skip_freshness_gates and skip_justification (deploy.yml:13-20), passed to every step as skip and skip-justification (deploy.yml:1286-1287, :1305-1306, :1335-1336, :1374-1375). Inside the action the skip takes effect only together with a non-empty justification, which is recorded in the step summary and as a warning (MMCA.Common/.github/actions/freshness-gate/action.yml:118-132), and a justified skip exits success (deploy.yml:1634-1635). Three properties make it a sound escape hatch rather than a hole: it is unreachable on a push (the inputs exist only on a dispatch), one flag covers all four steps so an operator in a hurry does not disable them one at a time, and its cost is a permanent attributable record in the run summary instead of a quiet edit to a needs: list. Note the interaction with deploy's condition (deploy.yml:1647): a broken-glass step still reports success, which is what lets the deploy condition demand success from freshness without special-casing.

MMCA.Store runs the same single job with the same four steps (MMCA.Store/.github/workflows/deploy.yml:1045, steps at :1059, :1082, :1101, :1132), and its deploy needs list matches (MMCA.Store/.github/workflows/deploy.yml:1381), minus ai-eval-gate, which is an ADC addition.

ADR-064 is the decision record. [Rubric §29, Resilience, Reliability & Business Continuity] is served by dr-freshness: the ADR-009 recovery objectives are only real if the drill that measures them is recent. [Rubric §12, Performance & Scalability] is served by load-freshness for the same reason applied to the capacity baseline. [Rubric §6, CQRS & Event-Driven Design] is served by cross-service-freshness: the outbox-to-broker delivery path has no in-process test that can falsify it, so its recency is the only continuous evidence the event pipeline still works end to end, now across both the RabbitMQ round-trip and the Service Bus emulator that mirrors the production transport.

Job: foundation, Phase 1

# deploy.yml:1385-1405
foundation:
  needs: changes
  if: github.event_name != 'pull_request' && needs.changes.outputs.code == 'true'
  environment: production
  outputs:
    acrName: ${{ steps.foundation.outputs.acrName }}
    acrLoginServer: ${{ steps.foundation.outputs.acrLoginServer }}
    logAnalyticsName: ${{ steps.foundation.outputs.logAnalyticsName }}

infra/foundation.bicep (deploy.yml:1418-1424) provisions the durable resources that must exist before a container image can be pushed at all: the Log Analytics workspace (infra/foundation.bicep:33-34) and the Basic-tier Azure Container Registry (infra/foundation.bicep:62-68), whose admin user is disabled because both the apps (AcrPull) and the deploy (AcrPush) authenticate as managed identities (infra/foundation.bicep:70-72). It was split out of deploy on 2026-07-21 so image builds can run concurrently with the roughly 20-minute e2e-gate instead of serially after it (deploy.yml:1377-1384).

The workspace (PerGB2018, 30-day retention, infra/foundation.bicep:38-41) carries a daily ingestion cap, dailyQuotaGb, defaulting to 5 GB (infra/foundation.bicep:15, applied at :53-55). The parameter description is explicit that this is a runaway-cost guard, not a budget (infra/foundation.bicep:14): once the cap is hit Azure stops ingesting for the rest of the UTC day, which blinds every log-based alert in main.bicep, so the ceiling sits at roughly 10x the expected daily volume. The comment records why it was raised from a hard-coded 1 GB on 2026-09-07 (infra/foundation.bicep:42-52): a ceiling only about 2.5x above baseline was an attack surface, since an error loop could push past it and leave the actual incident unlogged, and no individual table can be exempted from a workspace cap. Reaching the cap is itself alerted on, from the cap-exempt _LogOperation table (infra/foundation.bicep:51-52).

A third resource rides along, and it is the reason the registry does not grow without bound: a scheduled ACR task named purge-old-images (infra/foundation.bicep:153-155) that runs daily at 05:00 UTC (infra/foundation.bicep:169-175). Basic-tier ACR has no retention-policy feature, that is Premium only, so image garbage collection has to be a task rather than a setting (infra/foundation.bicep:108-109). Its encoded YAML runs acr-cli three times (infra/foundation.bicep:139-151): the first step ages out tags untouched for 3 days in the six mmca-adc-* image repositories while keeping the 3 most recent per repository, which is enough because a rollback only ever reaches the previous revision; the second step (IAC-7, 2026-12-02) deletes buildcache tags unused for 30 days, which the first step used to sweep by accident (infra/foundation.bicep:129-138); the third step, added 2026-09-02, targets the buildcache repository specifically with --ago 1h --keep 10 --untagged. The comment records what forced the third step (infra/foundation.bicep:118-128): mode=max cache exports write one tag per image, refreshed on every deploy and therefore never old enough for the 3-day rule, behind a large tree of untagged layer manifests that nothing swept. That backlog had reached about 111 GB and carried registry storage to 74 GB against the 10 GB the Basic tier includes. --keep 10 is deliberately larger than the six live cache tags, so the step can never delete a tag the next build is about to read.

[Rubric §31, Cost Efficiency / FinOps] is served in the form that matters for a registry: the expensive thing is not the images you can see, it is the manifests nothing references and nothing deletes.

The safety argument for running infrastructure before the gates is stated in the same comment and is worth internalizing: foundation.bicep provisions no container apps, no SQL and no traffic-facing resource, so applying it early cannot affect the live app, and it is an idempotent incremental deploy that is a no-op on every run after the first. "Runs before the gates" is only acceptable because "cannot change what users see" is a property of the template, not a hope.

Its three outputs are promoted to job outputs (deploy.yml:1402-1405) for a concrete reason: acrName is derived inside Bicep from uniqueString(resourceGroup().id, environmentName) and therefore cannot be recomputed by a later job. A downstream job either receives it or guesses wrong.

environment: production is load-bearing here, and not for approvals (deploy.yml:1390-1396). The federated identity credential's subject is repo:ivanball/ADC:environment:production. A job without an environment: presents repo:ivanball/ADC:ref:refs/heads/main instead, and azure/login fails with AADSTS700213, "No matching federated identity record". Every job that runs azure/login needs the declaration. The comment even cites the run that proved it on MMCA.Store. This is the single most transferable OIDC gotcha in the repository.

Job: build-images, Phase 2

Six images are built and pushed, one per matrix leg (deploy.yml:1459-1480): mmca-adc-gateway, mmca-adc-ui, mmca-adc-conference, mmca-adc-identity, mmca-adc-engagement, mmca-adc-notification. The Gateway and UI Dockerfiles live under Source/Hosts/ (Source/Hosts/MMCA.ADC.Gateway/Dockerfile at deploy.yml:1464, Source/Hosts/UI/MMCA.ADC.UI.Web/Dockerfile at :1467); the four back-end services live under Source/Services/ (:1469-1480). fail-fast: false (deploy.yml:1460) so one image's failure does not cancel the other five.

These were previously six sequential docker build steps inside deploy, measured at 928 seconds on one run (deploy.yml:1427-1428). One matrix leg per image makes the phase cost roughly the slowest image (about 4 minutes) rather than their sum, and because the job no longer sits behind e2e-gate the whole phase hides underneath that gate and leaves the critical path entirely.

Each leg is now individually gated on whether its image is dirty. The matrix carries a changed column fed from the changes job's img_* map (deploy.yml:1463-1480), and the build-and-push step only runs when it is 'true' (deploy.yml:1505-1506). A clean leg takes the other branch and re-tags instead (deploy.yml:1546-1567):

The re-tag branch does one more thing, and it is a cost-control interaction worth knowing (deploy.yml:1568-1580). After minting the sha tag it re-imports that same sha back onto :latest. The daily purge-old-images ACR task keeps only the three most recently updated tags per repository and deletes anything older than three days, and importing a new sha tag does not touch :latest, so after a few deploys that leave an image clean the very tag this branch reads from would age out, get purged, and fail the next clean leg (which blocks the whole deploy, since deploy requires build-images to succeed). Re-importing the identical digest is a registry-side manifest copy: :latest keeps pointing at the same image and only its timestamp moves. The build-and-push branch already pushes :latest on every build, so both branches keep the tag alive.

az acr import \
  --name ${{ needs.foundation.outputs.acrName }} \
  --source ${{ needs.foundation.outputs.acrLoginServer }}/${{ matrix.image }}:latest \
  --image ${{ matrix.image }}:${{ github.sha }} \
  --force

Two things make that safe, and both are worth internalizing. main.bicep addresses every image by :${{ github.sha }}, so the tag has to exist whether or not anything was rebuilt; az acr import is a registry-side manifest copy, so no layer is pulled or pushed, and --force makes a re-run of the same sha idempotent. And the leg still concludes success rather than skipping, which is the load-bearing part: deploy gates on the job-level equality needs.build-images.result == 'success' (deploy.yml:1649), so gating with a job-level if (or letting a leg skip) would turn the whole job skipped and silently cancel the deploy (deploy.yml:1441-1445).

Nothing is rolled out here (deploy.yml:1431-1434). Images are tagged with both ${{ github.sha }} (the exact commit, immutable and traceable) and latest, and pushed to ACR (deploy.yml:1519-1527), but deploy still waits on every gate before main.bicep points any container app at them. A red gate therefore leaves an unreferenced image in ACR, which the scheduled purge task in foundation.bicep reaps. Building speculatively is only safe when publishing and referencing are separate acts.

The token is a BuildKit secret, not a build arg (deploy.yml:1533-1534, comment :1528-1529):

secrets: |
  github_token=${{ secrets.GITHUB_TOKEN }}

--build-arg bakes a value into the image layer where docker history can read it back; a BuildKit secret is mounted only for the RUN steps that need it (restore and publish) and never enters a layer. DOCKER_BUILDKIT=1 is set explicitly so the requirement fails loudly rather than silently degrading. The comment adds a detail worth keeping (deploy.yml:1529-1532): secret content is not part of the cache key (only the instruction text is), so rotating the token does not needlessly bust the restore layer, which is safe because the package set is pinned by the committed lock files and a Directory.Packages.props change lands in the same COPY layer and busts it anyway.

The layer cache is in ACR, not type=gha (deploy.yml:1543-1544), and the comment (deploy.yml:1535-1540) is a small masterclass in cache sizing. The GitHub Actions cache has a hard 10 GB per-repo quota with LRU eviction; six images exporting mode=max multi-stage SDK layers plus a large NuGet layer each would thrash it into a near-zero hit rate while still paying the export cost. The registry the job already authenticates to has no quota and costs pennies. mode=max rather than min is required because min caches only the final stage, which is exactly the one that is cheap: the expensive layers are restore and publish, inside the build stage. Buildx with the docker-container driver (deploy.yml:1499-1503) is what makes an external cache possible at all, since the default driver cannot import or export one.

[Rubric §17, DevOps & Deployment] is served: each image is uniquely identified by the commit SHA, making every deployment fully traceable to its source code. [Rubric §11, Security] is served by the BuildKit-secret handling: no credential is recoverable from a published layer.

Job: deploy

Runs only on push to main or workflow_dispatch, never on pull requests, and only when every gate above has reported. Its needs list is the pipeline in one line (deploy.yml:1613):

needs: [changes, supply-chain, cost-guard, freshness, e2e-gate, ai-eval-gate, foundation, build-images]

Note what is not there: build-and-test, integration-tests and coverage. Those are the required PR checks, and they are the test gate: branch protection enforces admins and requires an up-to-date branch, so the PR run covers the exact tree that merges and no post-merge job re-runs those tiers (deploy.yml:1614-1616). A docs-only push skips supply-chain, cost-guard and freshness along with the deploy itself (deploy.yml:1625-1626).

The condition itself (deploy.yml:1640-1651) is always() plus an explicit result check per dependency rather than the default success() semantics, and the comment records the incident that forced it (deploy.yml:1632-1635). Because e2e-gate is ui-scoped, it legitimately skips on a backend-only merge, and under success() a skipped dependency cascades into a skipped deploy: a run went fully green and shipped nothing. So every unconditional gate must be success (none of them skips on a code deploy, since the freshness break-glass exits success inside each step), while the two conditional gates may be success or skipped: e2e-gate (deploy.yml:1650), which runs on a UI diff, and ai-eval-gate (deploy.yml:1651), which runs on a scoring-code diff (deploy.yml:1637-1638). The post-deploy smoke gate is the post-rollout backstop behind both.

That is the general lesson: needs expresses ordering, but "did this dependency actually pass" and "did this dependency run" are different questions, and default success() semantics answer them together.

The job declares environment: production (deploy.yml:1652) and opens with a checkout and its own azure/login@v3 (deploy.yml:1658-1667), for the federated-credential reason described under foundation. Everything below is Phase 3 onward.

Phase 3, Deployment parameters file (deploy.yml:1672-1986):

Rather than passing key=value pairs inline to arm-deploy, the step builds a JSON parameters file from scratch using jq (there is no committed parameters template, see the IaC chapter's note that infra/main.parameters.json does not exist). The jq --arg flag properly JSON-escapes multiline values (critical for the RSA PEM keys, which contain newlines). The base parameter set is always present (deploy.yml:1761-1789), including the six SHA-tagged image references read from needs.foundation.outputs.acrLoginServer. Optional parameters (OAuth credentials, the AI provider key (AI_API_KEY, fed to the Bicep aiApiKey parameter), SMTP config, the synthetic-traffic key, managed-identity SQL settings) are conditionally appended only if their env vars are non-empty:

# deploy.yml:1803-1806
if [ -n "$OAUTH_GITHUB_CLIENT_ID" ]; then
  jq --arg k "$OAUTH_GITHUB_CLIENT_ID" '.parameters.githubOAuthClientId = {"value": $k}' ...
fi

This pattern means the deployment is not blocked if an optional secret has not been configured, it simply omits that parameter, and the Bicep template's @secure() param falls back to its default (typically an empty string, which disables the feature). Sign in with Apple is the clearest example: all four pieces (client id, team id, key id, private key PEM) are appended independently (deploy.yml:1822-1838), and the provider only activates when the template receives the full set.

Two parameters are deliberately not optional, and both are fail-fast. The step's first action is a check on an unset ALERT_EMAIL repo variable (deploy.yml:1728-1731), whose error message states the reasoning: alerts that notify nobody are silent failures, so infra/main.bicep requires alertEmailAddress and the deploy refuses to proceed rather than shipping SLO, outbox and availability alerts into the void. The second is the RSA key pair (deploy.yml:1733-1739): Identity signs RS256 and publishes /.well-known/jwks.json from those keys, there is no other signing path, and main.bicep declares both parameters without a default, so an unset JWT_RSA_PRIVATE_KEY_PEM or JWT_RSA_PUBLIC_KEY_PEM fails here rather than producing an Identity service that cannot mint a token. The keys are then appended unconditionally (deploy.yml:1791-1800). Catching both here turns an opaque Bicep validation error into an actionable one naming the variable or secret to set.

The synthetic-traffic key (deploy.yml:1868-1874) is a small but instructive optional parameter. It carries the shared secret the Gateway's edge rate limiter accepts as a bypass, and load-test.yml sends the same value as an X-Synthetic-Traffic-Key header, so the monthly k6 capacity proof measures backend capacity rather than the per-IP rate-limit window (ADR-088 amendment). Unset leaves the bypass off, which is the correct default: a rate-limit bypass that exists by default is not a rate limiter.

The managed-identity SQL parameters (deploy.yml:1889-1907) are the opposite case, optional and default-off by design: without the SQL_AAD_ADMIN_LOGIN, SQL_AAD_ADMIN_OID and USE_MANAGED_IDENTITY_SQL repo variables, main.bicep keeps its defaults (no Entra admin, password auth) and the deploy is unchanged. The comment stages the rollout and warns that flipping USE_MANAGED_IDENTITY_SQL=true before the per-database grants exist costs the apps their SQL connectivity (deploy.yml:1901-1903).

There is an important SQL location note in the Bicep parameters step (deploy.yml:1753-1758): Azure SQL is region-gated on the QiMata Sponsorship subscription, eastus2 (where acc-rg lives) does not allow Microsoft.Sql, so SQL Server and databases are deployed to westus2 while Container Apps remain in the RG's location. The SQL_LOCATION="westus2" line (deploy.yml:1758) hard-codes westus2, so a different subscription or region means editing that line rather than setting a repo variable.

Phase 3 (continued), Application infrastructure (deploy.yml:1988-1994):

- name: Deploy application infrastructure
  id: deploy
  uses: azure/arm-deploy@v2
  with:
    template: infra/main.bicep
    parameters: /tmp/deploy-params.json

main.bicep provisions the Container Apps Environment, six Container Apps (one per service + Gateway + UI), Azure Service Bus (Standard tier; its topics, queues and forwarding subscriptions are declared in the template and every service runs with MessageBus__ProvisionTopology=false, so the framework's native Service Bus transport creates nothing at runtime, infra/main.bicep:1580-1587, and the per-service SAS rules carry Send and Listen only, never Manage, infra/main.bicep:1716-1734), Azure SQL Server and four per-service databases, App Insights, SLO alerts, and the monthly cost budget. (See the IaC chapter for the full resource inventory, note Redis is not provisioned by main.bicep.) The environmentName=prod parameter selects the environment-specific naming convention.

Phase 4, Database migrations: there is no sqlcmd backstop (deploy.yml:1996-2009):

Phase 4 is a comment block, not a step. The deploy deliberately does not run an external sqlcmd migration step. Each service self-applies its own migrations at startup (ApplicationSettings__DatabaseInitStrategy=Migrate) as the sole migrator of its database. Every replica of a service migrates before it serves, and concurrent replicas are safe because EF Core serializes MigrateAsync with an sp_getapplock migrations lock, so minReplicas: 1 is a cost floor, not a race guard (deploy.yml:2005-2007). The comment (deploy.yml:1997-2004) records why the previous backstop was removed: a sqlcmd step here would race the container's startup Migrate() on a fresh per-service DB, both applying the same InitialCreate concurrently and non-atomically, leaving a table created without its __EFMigrationsHistory row (Msg 2714 "object already exists" on every retry, exactly what wedged MMCA.Store's first per-service deploy). The build-and-test model-drift gate still guarantees a migration exists for every model change, so removing the backstop does not weaken the schema-safety story.

[Rubric §8, Data Architecture] and [Rubric §17, DevOps & Deployment] are both served here: per-service, single-applier, idempotent-by-construction migration is the data-architecture discipline made operational without a racing dual-applier.

Phase 5, Revision-activation gate plus post-deploy smoke gate with automatic rollback (deploy.yml:2011-2192):

Phase 5 is two gates in one step, in a deliberate order, because they answer different questions (deploy.yml:2011-2032).

5a, the revision-activation gate (deploy.yml:2077-2109) is the newer half, and it exists because of a four-day production incident. For every app, the newest revision by createdTime must report healthState Healthy, runningState Running or RunningAtMaxScale, and trafficWeight 100. The predicate is factored into its own helper so the rollback below can reuse it (deploy.yml:2070-2075), and the poll is thirty attempts at twenty seconds, one ten-minute budget shared by the whole fleet with the apps iterated inside each pass (deploy.yml:2079-2105):

# deploy.yml:2062-2068
revision_status() {
  local app="$1" json
  json=$(az containerapp revision list -g "$RG" -n "$app" \
    --query "reverse(sort_by(@, &properties.createdTime))[0].[name, properties.healthState, properties.runningState, properties.trafficWeight]" \
    -o json 2>/dev/null || echo "null")
  printf '%s' "$json" | jq -r 'if type == "array" then map(if . == null then "" else . end) | @tsv else "" end' 2>/dev/null || echo ""
}

That proves the code just built is the code now serving, and the HTTP probes below cannot prove it. The comment names the incident that made the gap concrete (deploy.yml:2014-2023): every probe enters through the Gateway, and a healthy Gateway keeps serving from the previous backend revision when the new one never goes ready. So an untagged Aspire Redis health check running CLUSTER INFO against Azure Managed Redis made /health/ready throw on every probe, every backend revision reported ActivationFailed, the older revision kept 100% of the traffic, every probe answered 200 or 401 from the old code, and this step reported success on each deploy for four days (2026-08-29 to 2026-09-02).

The -o json plus jq shape is itself a fix, and the comment states the trap plainly (deploy.yml:2057-2061): a top-level JMESPath multiselect list rendered with -o tsv prints one element per line, not one tab-separated row. The positional read therefore captured the revision name and left health, running state and traffic weight empty, and the gate failed every app on a perfectly healthy fleet. Fetching JSON and letting jq join it (with nulls mapped to empty strings so the field count never collapses) is what makes the positional read honest. The transferable lesson is the one the outage taught: a smoke test that reaches your system through a load balancer verifies something is serving, not your new code is serving, and only the control plane can tell you which.

5b, the reachability probes (deploy.yml:2111-2122) are the older half, six endpoints covering every deployable:

probe "https://${GATEWAY_FQDN}/health"
probe "https://${GATEWAY_FQDN}/.well-known/jwks.json"
probe "https://${GATEWAY_FQDN}/Events"
probe "https://${GATEWAY_FQDN}/Bookmarks" 401
probe "https://${GATEWAY_FQDN}/Notifications/inbox" 401
probe "https://${UI_FQDN}/"

Each probe polls up to 12 times (10-second intervals, 15-second curl timeout, deploy.yml:2046-2055), two minutes total per endpoint. Together they exercise Container Apps routing (Gateway /health), Identity (JWKS, which must have reached its database and loaded its RSA keys), Conference (anonymous GET /Events), Engagement (/Bookmarks), Notification (/Notifications/inbox), and the Blazor UI host. The comment (deploy.yml:2025-2029) notes the probe set mirrors e2e.yml's warm-up URLs, which is what makes it the post-rollout backstop behind the PR's build-and-test and, on a UI diff, e2e-gate.

The two 401 expectations are the interesting part. probe takes an expected status defaulting to 200, and for the auth-gated Engagement and Notification endpoints the asserted status is exactly 401 (deploy.yml:2043-2045, :2117-2120). A 401 from the service is the healthy signal: it proves the request traversed Gateway to service to auth pipeline. A 5xx, a 404, or a 000 connection failure does not. Accepting "any non-2xx" would have made those two probes unfalsifiable, which is the failure mode a smoke test can least afford.

If either gate fails, the rollback path (deploy.yml:2138-2192) activates, and it now carries two guards that the original loop did not.

Guard 1 re-reads the app before rolling it back (deploy.yml:2147-2156). The rollback loop runs once for the whole fleet, but the smoke gate can fail for a reason that has nothing to do with a given app, so each iteration re-checks that app's newest revision through the same revision_serving predicate and skips it when it is already healthy, running and taking 100% of the traffic. Without that check, one failed probe would take five healthy apps down with it.

Guard 2 is in the query that picks the target revision (deploy.yml:2157-2168):

prev=$(az containerapp revision list -g "$RG" -n "$app" \
  --query "reverse(sort_by([?properties.provisioningState=='Provisioned' && properties.healthState=='Healthy' && properties.active==\`true\`], &properties.createdTime))[?name!='${newest}'] | [0].name" ...)
az containerapp revision copy -g "$RG" -n "$app" --from-revision "$prev" -o none

Three filters, each correcting a way the choice could go wrong. The original query took index [1] of all provisioned revisions, which is only correct when the newest revision is the broken one, and a revision that failed activation is still Provisioned, so healthState == 'Healthy' is what keeps the selection honest. Excluding the newest by name keeps it correct in the other case, where the newest is healthy and the probes failed for some other reason. And properties.active == true is what stops a deactivated old revision, which is exactly what a successful activation leaves behind, from being copied back; the incident this gate was written for had the old revision still active and healthy alongside the failed new one, which is why the earlier query looked correct.

The loop attempts every app before reporting, so one app's rollback failure does not abandon the other five (deploy.yml:2139-2141), but a partial rollback is then reported loudly: the names of the apps that failed to roll back are written to the Step Summary under "Smoke gate failed AND rollback incomplete" (deploy.yml:2183-2190). The comment states the principle directly, a fleet split across revisions needs immediate manual attention and must never look like a clean auto-revert. Every app also lands in exactly one of four counters (rolled back, skipped because its newest revision is already live, no candidate revision, rollback failed; deploy.yml:2145-2146), and one Rollback summary line printing all four always goes to the Step Summary (deploy.yml:2191): a probe failure on a fleet whose newest revisions all activated rolls nothing back, and the summary says so rather than claiming a revert. Either way the job exits 1 (deploy.yml:2192).

There is also an informational security-headers check (deploy.yml:2124-2131, labeled TD-09) that confirms the Gateway emits X-Content-Type-Options: nosniff. This check is explicitly non-gating (it cannot trip the rollback) because a missing header is a hardening gap, not a "revision not serving" condition.

[Rubric §29, Resilience, Reliability & Business Continuity] is directly embodied: the activation and smoke gates with automatic rollback mean a broken deploy is both detected and partially self-corrected within minutes. [Rubric §13, Observability & Operability] (assesses whether failures surface actionable signals) is served: the activation loop prints each app's newest revision with its health, running state and traffic weight on every attempt (deploy.yml:2093), the workflow fails loudly with the specific failing endpoint printed, and the rollback log names each app and its rollback revision.

Post-deploy, reclaiming BuildKit cache storage (deploy.yml:2194-2214):

The last step in the job is housekeeping, not a gate:

az acr run \
  --registry ${{ needs.foundation.outputs.acrName }} \
  --cmd "acr purge --filter 'buildcache:.*' --ago 1h --keep 10 --untagged" \
  /dev/null

It runs the same buildcache purge the scheduled ACR task in foundation.bicep runs daily, but right after the deploy that created the garbage. The comment gives the reason (deploy.yml:2194-2199): every cache-to=...,mode=max push orphans the previous deploy's untagged cache manifests, and reclaiming them within minutes rather than within a day is what keeps a Basic-tier registry under its 10 GB included storage instead of paying overage on a day's worth of them.

Two details are deliberate. It is continue-on-error: true (deploy.yml:2206) because it runs after the rollout and the smoke gate, so a throttled ACR task or a transient auth failure must never fail a deploy that has already shipped successfully. And the /dev/null argument is the build context, which az acr run requires positionally and this command does not use (deploy.yml:2203-2204).

[Rubric §31, Cost Efficiency / FinOps] is served by the pairing rather than by either half: the scheduled task is the floor that catches everything, and this step is the fast path for the garbage the deploy just produced.


MMCA.ADC, e2e.yml

File: MMCA.ADC/.github/workflows/e2e.yml

What it is

The full-stack Playwright E2E test workflow. It brings up the complete Aspire stack (SQL Server + Redis + RabbitMQ + four services + Gateway + UI) inside the CI runner, then runs the Playwright suite against it across a chromium/firefox/webkit matrix.

[Rubric §28, Front-End Testing & Quality] (assesses whether browser-level tests cover real user journeys in a production-like environment) is the primary category this workflow serves.

Triggers, three entry points including the deploy gate

# e2e.yml:27-55
on:
  workflow_dispatch:
    inputs:
      browsers:
        description: 'JSON array of Playwright engines to run (defaults to the full matrix)'
        required: false
        type: string
  workflow_call:
    inputs:
      browsers:
        description: 'JSON array of Playwright engines to run (defaults to the full matrix)'
        required: false
        type: string
  schedule:
    - cron: "0 7 * * 1"
    - cron: "0 7 * * 4"

Three ways in, and the engine set differs in each. workflow_call is the deploy gate: deploy.yml's e2e-gate job calls this workflow with browsers: '["chromium"]', the §28 merge-gate promotion of 2026-07-02 (e2e.yml:7-12). workflow_dispatch runs the full three-engine matrix by default so a manual run can reproduce anything, and takes the same optional browsers input (e2e.yml:29-33) so a manual run can also be narrowed to one engine. schedule runs one engine per night, alternating.

The alternating schedule is worth reading closely, because the mechanism is not obvious (e2e.yml:178-181):

browser: ${{ fromJson(inputs.browsers
  || (github.event.schedule == '0 7 * * 1' && '["firefox"]')
  || (github.event.schedule == '0 7 * * 4' && '["webkit"]')
  || '["chromium", "firefox", "webkit"]') }}

The two crons are written as separate entries rather than a combined 0 7 * * 1,4 precisely so the matrix can branch on github.event.schedule, which carries the exact cron string that fired. Monday runs firefox, Thursday runs webkit. The inputs context is empty on non-call events, so the fallback chain resolves for dispatch and schedule alike.

Each narrowing was a deliberate cost trade with its reasoning recorded (e2e.yml:42-53, :170-177). The schedule was cut from Mon-Fri to twice weekly on 2026-07-24: at five nights times about 25 minutes per leg it was the single largest billed line item in the repo, and twice a week still catches an engine-specific regression well inside a release cycle. Alternating engines followed on 2026-07-29, halving the nightly spend from roughly 100 to 50 minutes a week while still exercising each engine every week. And chromium is off the nightly entirely, because every push to main already runs a full chromium leg through e2e-gate, so a scheduled chromium leg would re-test an already-tested tree. What the nightly uniquely buys is the other two engines.

continue-on-error encodes the same split (e2e.yml:187):

continue-on-error: ${{ github.event_name == 'schedule' && matrix.browser != 'chromium' }}

Note the event_name clause. On the scheduled nightly, non-chromium legs stay advisory so a one-off engine flake alerts without blocking anything. In the deploy gate (where event_name is the caller's push or dispatch) every invoked engine can fail the gate, promoted 2026-07-16 after eight consecutive fully-green nightly matrices (e2e.yml:182-186). The same matrix leg is advisory or blocking depending on why it ran, which is exactly the distinction a single boolean would have flattened.

E2E_BROWSER is set from matrix.browser and consumed by MMCA.Common.Testing.E2E's PlaywrightFixture.

The concurrency block reads the same distinction one more time (e2e.yml:67-69). The group is keyed on github.event_name as well as the ref, and cancel-in-progress is true only for schedule and workflow_dispatch. A workflow_call from deploy.yml surfaces here as the caller's push or dispatch event, so a deploy-gating leg is never cancelled by a later nightly or a flake re-run, while cheap re-runs of the nightly still supersede each other (e2e.yml:64-66). Cancelling a gate that a production deploy is waiting on would not save minutes, it would fail the deploy.

Job: should-run, the skip-if-unchanged guard

A five-minute pre-job (e2e.yml:92-152) that keys the skip to the engine, not to the run. A scheduled night runs one engine (Monday firefox, Thursday webkit, e2e.yml:124-125), and a non-chromium leg is continue-on-error, so a run concludes success whether or not its leg passed. The guard therefore finds the newest completed run in which tonight's own E2E (<engine>) job concluded success and compares that run's head SHA with the default branch's (e2e.yml:97-102, :130): if they match there is nothing new to soak and the matrix is skipped, and anything the guard cannot resolve runs. Manual dispatch and the deploy gate always run (e2e.yml:92-95).

This guard is the reason deploy.yml's cross-service-freshness cannot trust a run conclusion: the sibling cross-service-tests.yml carries the same guard, and a skipped matrix still concludes success. It is also why this workflow needs actions: read (e2e.yml:60-62), and by extension why deploy.yml has to grant it too.

Job: e2e (120-minute timeout, cross-browser matrix)

The 120-minute timeout (e2e.yml:163) is a spend guard, not a pace budget, and the comment explains the raise from the previous 50 (e2e.yml:159-162): full-time tracing slows the suite, and a retry-heavy night burns one to two minutes per failed try, so a 2026-07-02 nightly hit a 70-minute cap mid-retry with 21 first-pass failures. A cap that cancels a run destroys the pass/fail count you needed; 120 lets even a bad night finish and report real numbers. The matrix is fail-fast: false (e2e.yml:166) so one engine's flake does not cancel the others.

Before the numbered steps, a Free runner disk step (e2e.yml:193-201) deletes toolchains the job never uses (Android, GHC, Swift, Boost, CodeQL, Julia) in the background. The comment records the incident: on 2026-10-25 the hosted runner's root volume filled about 17 minutes into the suite on both attempts, and a full disk kills the runner before any log or artifact uploads, so the failure left no evidence. Deleting in the background costs nothing, since the suite is about 25 minutes away.

Step 1, Trust the dev HTTPS certificate (e2e.yml:212-213):

dotnet dev-certs https --trust || dotnet dev-certs https

The --trust flag only succeeds on a runner that supports certificate trust stores (Linux runners may not). The || dotnet dev-certs https fallback generates the certificate without trusting it. Playwright probes use -k (skip verification) for the HTTPS UI endpoint, so the certificate does not need to be trusted for the test suite, the certificate only needs to exist so the Aspire AppHost can bind to HTTPS.

Step 2, Build (e2e.yml:224-247):

dotnet build Source/Hosting/MMCA.ADC.AppHost -c Release
dotnet build Tests/E2E/MMCA.ADC.E2E.Tests -c Release

Both project graphs are built directly (not via the .slnx) to avoid pulling in the MAUI UI project, which requires a maui-android workload not available on standard Ubuntu runners (e2e.yml:225-227 comment). GITHUB_TOKEN is passed for NuGet restore of MMCA.Common packages. The setup step above caches ~/.nuget/packages on the committed lock files (e2e.yml:207-210), which is worth the key precisely because this leg sits on the deploy critical path.

Step 3, Cache and install Playwright browsers (e2e.yml:301-325): The same cache-then-branch pattern as MMCA.Common/ci.yml's ui-e2e job, with the matrix browser engine. Binaries run 100 to 300 MB per engine, so PLAYWRIGHT_BROWSERS_PATH redirects the install into the workspace where actions/cache can carry it (e2e.yml:86-89), and the key includes the engine because each leg installs only its own. On a cache hit the step runs install-deps rather than install --with-deps (e2e.yml:319-325): the OS-level shared libraries live outside the cached directory, so a restored cache still needs the cheap half.

Step 4, Start the Aspire stack (e2e.yml:249-279):

openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out artifacts/jwt-priv.pem
openssl rsa -pubout -in artifacts/jwt-priv.pem -out artifacts/jwt-pub.pem
export E2E_JWT_PRIVATE_KEY_PEM="$(cat artifacts/jwt-priv.pem)"
export E2E_JWT_PUBLIC_KEY_PEM="$(cat artifacts/jwt-pub.pem)"
nohup dotnet run --project Source/Hosting/MMCA.ADC.AppHost -c Release --no-build \
  > artifacts/apphost.log 2>&1 &
echo "APPHOST_PID=$!" >> "$GITHUB_ENV"
rm -f artifacts/jwt-priv.pem artifacts/jwt-pub.pem

An ephemeral RSA keypair is generated at CI startup and exported as env vars. The AppHost forwards these to the Identity service, which needs an RSA key to sign RS256 tokens. Without this, Identity would fall back to HS256 (or refuse to start if configured to require RS256). The private key file is deleted immediately after being read into the env var, it is never written to an artifact or log.

The AppHost runs in the background (nohup ... &), and its stdout/stderr stream goes to artifacts/apphost.log (e2e.yml:276-277). There is no separate stop step: the stack ends with the job's runner. Diagnostics are failure-only: on a red run the workflow collects the service logs and uploads the AppHost log, the service logs and the probe output as one artifact (e2e.yml:550-578), so a green run pays nothing for them.

Two further env exports in the same step shape how the suite runs. E2E_LIFT_REGISTRATION_THROTTLE=true (e2e.yml:268) lifts Identity's BR-213 registration throttle, which would otherwise 401 the suite's many register-from-one-IP accounts past the default of 10 per hour. E2E_FORCE_SERVER=true (e2e.yml:275) pins the UI to InteractiveServer for the suite while production stays InteractiveAuto: under InteractiveAuto each test's second page load switches to the background-downloaded WASM bundle, whose runtime boot on a 2-core runner exceeds every suite wait. The comment (e2e.yml:261-267) is emphatic that the opposite fix, forcing WASM outright, was tried and is unviable in CI, because the Blazor readiness signal passes during prerender and the tests then interact with a dead DOM: no click lands, no error appears, and the suite stalls to the job cap with zero passes. It is a good reminder that a readiness signal which fires before the page is interactive is worse than no signal.

[Rubric §11, Security] is served: the ephemeral keypair is generated fresh per run (no long-lived key material in secrets), and the private key file is deleted before any subsequent step runs.

Step 5, Wait for the stack (per-service readiness gate) (e2e.yml:327-366):

probe() { curl -k -s -o /dev/null -w '%{http_code}' --max-time "$1" "$2"; }
ready() {
  local ui id conf d
  d=$(mktemp -d)
  probe 10 "$UI_URL/health" > "$d/ui" &
  probe 10 "$GATEWAY_URL/.well-known/jwks.json" > "$d/id" &
  probe 20 "$GATEWAY_URL/Events" > "$d/conf" &
  wait
  # ... read the three codes; all three must be 200 (elided)
}
# poll every 3 s against a 900 s deadline (elided)

This is not just a UI-health poll, though it does not probe every service either. It gates on three endpoints, each anonymous so a 200 means the service is up and its EF model + SQL pool are built: UI /health (the Blazor host), /.well-known/jwks.json through the Gateway (Identity, the login path), and /Events through the Gateway (Conference, the data path). Engagement and Notification are covered indirectly: the AppHost starts the UI only after every service reports alive (MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:390-393), and the warm-up step below touches their endpoints. The three probes run concurrently and the poll interval is 3 seconds, because a booting service often accepts a connection and then hangs, so serial probes each ran to their --max-time and noticed a ready stack up to about 50 seconds late (the comment at e2e.yml:336-342); the overall budget is a 900-second deadline. A half-warm backend is exactly what produced the historical login/data-page timeouts, so the suite does not start until all three are green (UI_URL/GATEWAY_URL are pinned to https://localhost:6002/6001 in the workflow env). The Playwright browser cache and install (e2e.yml:305-326) run after the stack has been started in the background, so they overlap its boot instead of delaying it; nothing in the stack needs the browsers (e2e.yml:295-300).

Step 6, Warm up services incl. the login path (e2e.yml:368-410): a best-effort step (never fails the job) that JITs each service's hot path before the timed suite, two passes over nine Gateway endpoints covering all four services (e2e.yml:376-388, where Engagement's /Bookmarks and Notification's /Notifications/inbox answer 401 and still warm their request pipeline), plus a real admin login POST to /Auth/login that exercises Identity's DB user-lookup + password-hash verify + RS256 signing (the dominant cold-start login-timeout culprit a UI-only warm-up never touched), and a prerender warm-up of the UI host's /, /login, /register. It closes by capturing a verbose Gateway-to-Conference probe into artifacts/conference-probe.txt for cross-referencing against the service logs (e2e.yml:403-409).

Step 7, Run E2E tests (e2e.yml:412-487):

env:
  E2E_BASE_URL: ${{ env.UI_URL }}
  E2E_HEADLESS: "true"
  E2E_BROWSER: ${{ matrix.browser }}
  WEB_VITALS_OUTPUT_DIR: ${{ github.workspace }}/artifacts
  E2E_TIMEOUT: "45000"
  E2E_AUTH_TIMEOUT: "60000"
  E2E_TRACE: ${{ github.workspace }}/artifacts/traces/
run: |
  ( while sleep 120; do ... df / du / largest files ... done ) &   # disk sampler (elided)
  sampler=$!
  set +e
  dotnet test --project Tests/E2E/MMCA.ADC.E2E.Tests/MMCA.ADC.E2E.Tests.csproj \n    -c Release --no-build \n    --retry-failed-tests 2 --retry-failed-tests-max-percentage 40 --minimum-expected-tests 223 2>&1 | tee artifacts/e2e-test-output.log
  rc=${PIPESTATUS[0]}
  kill "$sampler" 2>/dev/null
  df -h /
  exit $rc

E2E_BASE_URL points the Playwright tests at the live Aspire-hosted UI. E2E_TIMEOUT: 45000 (raised from 20000) absorbs residual first-navigation cold-start latency on a 2-core runner, and E2E_AUTH_TIMEOUT: 60000 gives the auth round-trip its own headroom (e2e.yml:424-434). --retry-failed-tests 2 --retry-failed-tests-max-percentage 40 (MTP's retry extension) re-runs only the failed tests up to twice, but skips retry when more than 40% of tests fail (a real breakage, not a contention spike). --minimum-expected-tests 223 fails the run when fewer tests execute (e2e.yml:454-463): 225 is the executed total on every engine in recent green runs, and the two of headroom are the two passkey tests that skip outside chromium. The console output is teed to artifacts/e2e-test-output.log so the report-only Report retried tests step (e2e.yml:489-526), which runs on always(), can list in the step summary every test that failed at least one attempt: a green run that passed only on retry still names its flaky tests. No coverage is collected here because the app runs out-of-process (the in-process integration tier in deploy.yml is the backend coverage signal, e2e.yml:412-416). A background disk sampler (e2e.yml:451-452, :467-473) prints disk usage, the largest directories and any file over 500 MB into the step log every 2 minutes, then the step returns the test exit code: if the volume fills again, the log names what grew instead of the runner dying silently (the companion to the Free runner disk step).

Two of those env vars are outputs rather than settings. WEB_VITALS_OUTPUT_DIR (e2e.yml:421-423) is where WebVitalsTests writes its client-side measurements, so the [Rubric §12, Performance & Scalability] budgets are enforced inside the deploy-gating chromium leg rather than only by the monthly k6 run. E2E_TRACE with its trailing slash selects directory mode, one <TestName>.zip per failed test (e2e.yml:435-440), which is what makes a red run diagnosable offline instead of by re-running it.

Steps 8 and 9, Collect service logs, upload diagnostics (e2e.yml:550-578): on failure() the job collects the Serilog rolling files of the four services and of the UI host into artifacts/service-logs (e2e.yml:559-566); nothing stops the AppHost, which ends with the runner. One glob, MMCAADC*.txt, matches both MMCAADC<Module>Service<date>.txt and MMCAADCUIWeb<date>.txt (e2e.yml:553-554, e2e.yml:562). The UI host log matters because the UI host runs the Blazor Server circuit the suite drives, so a circuit drop or a prerender failure shows up there and in no service log. The step searches the working tree, $HOME and /tmp and flattens every hit into one folder (e2e.yml:561-565), because the directory each file lands in depends on the working directory Aspire launches the process from, and the AppHost orchestrator log only carries orchestration chatter, never the processes' own logs (e2e.yml:555-558). The upload, however, is failure-only (if: failure(), e2e.yml:572) with a 3-day retention (e2e.yml:578): the bundle runs about 350 MB per browser, and a green run produces no per-test traces and needs no offline triage. Because the collect step runs on failure() too, a startup failure where no test ran at all is exactly the case that does get its artifact.

[Rubric §33, Developer Experience & Inner Loop] is served: the diagnostics upload makes CI failures diagnosable without local reproduction of the full Aspire stack.


MMCA.ADC, cost-guard.yml

File: MMCA.ADC/.github/workflows/cost-guard.yml

What it is

A read-only FinOps check that confirms the production Azure footprint is at its cost baseline. It detects a specific operational anti-pattern: a conference-day surge scale-up (SQL tier upgrade + higher Container App replica caps) that was never reverted after the event. It runs daily on a cron and as a reusable workflow called by deploy.yml's cost-guard job, so the same check is both a daily report and a production deploy gate.

[Rubric §31, Cost Efficiency / FinOps] (assesses whether cloud resource costs are governed and optimized, with visibility into spend) is the primary category this workflow serves. The workflow header comment (cost-guard.yml:3-10) states its purpose precisely: "a scheduled, READ-ONLY check that the production footprint is still at its cost baseline... It complements the cost budget in main.bicep (which alerts on $ spend) by flagging the configuration drift directly."

Why this workflow exists

The conference-day surge is declared in IaC: conferenceMode in main.bicep moves the attendee hot-path databases from Basic to S2 and raises the scaled Container Apps' replica cap from 2 to 4 (MMCA.ADC/infra/main.bicep:203, :214). One repository variable, CONFERENCE_MODE_UNTIL, switches it: every deploy on or before that date applies the surge and the first deploy after it reverts it (MMCA.ADC/infra/OPERATIONS.md:747-749). The cost-guard reads the same variable (MMCA.ADC/.github/workflows/cost-guard.yml:67-81): inside the window a surged footprint is expected; after it, a surge still live fails the scheduled run as the reminder but passes as the deploy gate, because that deploy IS the revert; with the variable unset, any surge is an out-of-band scale-up and blocks every production deploy (MMCA.ADC/infra/OPERATIONS.md:829-831). A plain re-run cannot clear that block, because the deploy job itself needs cost-guard to pass, so the runbook routes the revert through an expired conference window, the one state in which the gate lets a surged footprint through (MMCA.ADC/infra/OPERATIONS.md:829-837); the failing run's summary names that runbook entry (cost-guard.yml:130).

The cost-guard exists because a forgotten surge is not cheap: each surged database runs at S2 (50 DTU) instead of Basic (5 DTU) (MMCA.ADC/infra/main.bicep:203), around the clock until reverted.

Triggers

# cost-guard.yml:12-24 (comments elided)
on:
  schedule:
    - cron: "0 7 * * *" # Daily 07:00 UTC
  workflow_dispatch:
  workflow_call:
    inputs:
      deploy_gate:
        type: boolean
        default: false

Daily at 07:00 UTC (cost-guard.yml:14), so an expired conference window or an out-of-band scale-up is reported within a day; the operations runbook leans on exactly that run as the reminder that a revert deploy is still owed (MMCA.ADC/infra/OPERATIONS.md:810-813). A daily cadence costs little because the job is a handful of read-only az queries under a 10-minute cap (cost-guard.yml:49). workflow_dispatch allows a manual run at any time (e.g. to verify that a revert applied correctly). The workflow_call trigger (cost-guard.yml:16-24) is what promotes the check to a deploy gate, and the comment notes that being read-only is what makes it safe to run on the deploy path (:16-18). Its one input, the boolean deploy_gate (default false, :20-24), reaches the script as DEPLOY_GATE (:44). The scheduled run leaves it false; deploy.yml passes true, and that flag is the only difference between the two runs: it lets an expired-window surge pass the gate (cost-guard.yml:122-125) while the same surge still fails the scheduled run (:126-129).

Job: surge-drift

Environment: production (cost-guard.yml:50-51): this scopes the OIDC token to the same federated credential as deploy.yml, giving the read-only Azure CLI calls access to the production resource group without a separate credential. As with deploy.yml's own jobs, the declaration is required for the token subject to match, not merely for an approval gate.

Step, Check replica caps and SQL tiers (cost-guard.yml:60-133):

BASELINE_MAX_REPLICAS: "2"   # cost-guard.yml:27

for app in $(az containerapp list -g "$rg" --query "[?starts_with(name, 'adc-')].name" -o tsv); do
  max=$(az containerapp show ... --query "properties.template.scale.maxReplicas" -o tsv)
  if [ "${max:-0}" -gt "$BASELINE_MAX_REPLICAS" ]; then status="⚠️ DRIFT"; drift=1; fi
done

for server in $(az sql server list ...); do
  for db in $(az sql db list ...); do
    tier=$(az sql db show ... --query "sku.tier" -o tsv)
    if [ "$tier" != "Basic" ]; then status="⚠️ DRIFT"; drift=1; fi
  done
done

if [ "$drift" -ne 0 ]; then
  echo "❌ Surge drift detected, ... Reset to baseline ..."
  exit 1
fi

The baseline is defined directly in the workflow file:

  • BASELINE_MAX_REPLICAS: "2", maximum replicas per Container App at rest.
  • SQL tier must be "Basic", the lowest Azure SQL tier, sufficient for ADC's off-conference workload and priced at a few dollars per month.

Every adc-* Container App and every adc-* SQL server/database in the resource group is checked. The results are written to the GitHub Step Summary as a Markdown table, so the check result is visible in the GitHub Actions UI without opening the logs.

The workflow never mutates anything, it is read-only. On drift it fails and prints instructions (cost-guard.yml:126-131), but it does not attempt to downscale automatically. The operator must choose how to revert (typically by re-running deploy.yml, which re-applies the Bicep baseline). Since the same run is what deploy.yml's cost-guard job invokes, an un-reverted surge now also blocks the next production deploy until it is reset.

[Rubric §31, Cost Efficiency / FinOps] is directly embodied. [Rubric §34, Architecture Governance & Documentation] (assesses whether operational decisions are recorded and enforced) is also served: the cost guard is the enforcement mechanism for the "revert after event" policy, governance made executable.


MMCA.ADC, load-test.yml

File: MMCA.ADC/.github/workflows/load-test.yml

What it is

A k6 load test targeting the output-cached Conference read endpoints through the production Gateway. It establishes a repeatable performance baseline and alerts on threshold breaches via GitHub workflow failure.

[Rubric §12, Performance & Scalability] (assesses whether the system has been load-tested and has defined capacity thresholds) is the primary category served. The workflow header comment (load-test.yml:3-6) describes it as "a repeatable k6 load test against the public, output-cached Conference read endpoints through the Gateway. Read-only and safe against prod."

Measuring capacity, not the rate limiter

The header carries a second paragraph that is the most instructive thing in the file (load-test.yml:8-11). The run identifies itself to the Gateway's edge rate limiter with an X-Synthetic-Traffic-Key header, carrying SYNTHETIC_TRAFFIC_SECRET and matched against GatewayRateLimiting:SyntheticTrafficSecret (ADR-088 amendment). The reason is a measurement problem, not a policy one: a k6 run sends every request from one runner, so one IP, and without the bypass the number the test reports is the per-IP rate-limit window rather than backend capacity. The same secret is passed into main.bicep by deploy.yml (deploy.yml:1868-1872), so the bypass exists in production only when it has been configured deliberately. The bypass changes nothing else: the test stays read-only and never mutates.

Why only the Conference read endpoints?

The Conference module's read endpoints (events, sessions, speakers, rooms, categories) are output-cached with 5-minute TTL and tag-based invalidation. They are the highest-traffic paths under conference-day load, and they are read-only (safe to hammer in production). The Engagement write endpoints (bookmarks) and Identity endpoints (auth) have different performance profiles and carry real-write risk, they are not targeted by this load test.

Triggers

# load-test.yml:13-23
on:
  workflow_dispatch:
    inputs:
      peak_vus:
        description: "Peak concurrent virtual users"
        default: "67" # observed 2026 conference-day peak
      base_url:
        description: "Target base URL (blank = discover the prod Gateway)"
        default: ""
  schedule:
    - cron: "0 6 1 * *" # 06:00 UTC, 1st of each month (off-peak)

The two triggers run at two different loads. The monthly schedule runs at 06:00 UTC on the 1st, off-peak, and the header calls it modest load (load-test.yml:5): a scheduled run has no inputs, so it runs at the 40 VUs of the PEAK_VUS fallback (load-test.yml:101). A manual dispatch overrides the peak, and its default peak_vus is annotated as the observed 2026 conference-day peak (load-test.yml:16-18). The venue-scale test is a separate workflow, conference-day-load-test.yml, which writes synthetic attendees to production at a default of 400 VUs and stays separate so its expected baseline failure never feeds deploy.yml's load-freshness gate (conference-day-load-test.yml:3-10, :28-30).

Job: k6

Environment: production (load-test.yml:37): OIDC-scoped to the production federated credential so the Azure CLI step can discover the Gateway FQDN from the resource group.

Step, Resolve target URL (load-test.yml:50-84):

# env: BASE_URL_INPUT is ${{ inputs.base_url }}, LOAD_TEST_ALLOWED_HOSTS is ${{ vars.LOAD_TEST_ALLOWED_HOSTS }}
url="$BASE_URL_INPUT"
if [ -z "$url" ]; then
  fqdn=$(az containerapp list -g "$AZURE_RESOURCE_GROUP" \
    --query "[?contains(name, 'gateway')].properties.configuration.ingress.fqdn | [0]" -o tsv)
  url="https://$fqdn"
fi
echo "url=$url" >> "$GITHUB_OUTPUT"

If base_url is blank (the normal case), the step queries Azure for the Gateway's FQDN dynamically. This means the load test does not need to be updated when the resource group or environment name changes, it discovers the target at runtime. An unresolvable FQDN exits 1 rather than proceeding against an empty URL. The dispatch input reaches the script through env: (load-test.yml:57-58), never spliced into it. An explicit base_url must be https://<host>[/path] with no user info, port or query (load-test.yml:69-70), and its host must be either the resolved production Gateway or a host listed in the LOAD_TEST_ALLOWED_HOSTS repository variable (load-test.yml:74-79), because the run hands the rate-limit bypass key to whatever host it targets. A non-production target is therefore a variable change, not a workflow change. (The resolve step's validation is elided from the snippet above.)

Step, Run k6 (load-test.yml:86-116):

docker run --rm -i \
  -e BASE_URL="$BASE_URL" \
  -e PEAK_VUS="$PEAK_VUS" \
  -e SYNTHETIC_TRAFFIC_KEY="$SYNTHETIC_TRAFFIC_KEY" \
  -v "$PWD/Tests/Load/k6:/scripts" \
  grafana/k6@sha256:23f2279054c3e01535455c4d92914a625df12aeb631ea0e3ea7a43f96bcbc843 run /scripts/conference-read-load.js

k6 runs in Docker, and the image is pinned by digest rather than by name (load-test.yml:116): an unpinned grafana/k6 resolved :latest at run time, and this step is handed the synthetic-traffic key that skips both Gateway rate limiters, so the version comment above the command and the digest are bumped together (load-test.yml:87-89, :110). The script directory is mounted as a volume. BASE_URL, PEAK_VUS and SYNTHETIC_TRAFFIC_KEY reach the container as environment variables, each first declared in the step's own env: block and referenced as "$VAR" (load-test.yml:91-93, :99-102), so a secret containing a quote cannot break the command apart and no secret is part of the command line the runner logs. The last of the three is what the script sends as the X-Synthetic-Traffic-Key header described above. The k6 script is at Tests/Load/k6/conference-read-load.js. Note: the content of the k6 script (thresholds, ramping profile, endpoint list) is not determinable from the workflow file alone, it lives in the script.

The || '40' fallback in PEAK_VUS (load-test.yml:101) is what sets the scheduled load: inputs are only set on workflow_dispatch, so the monthly run takes 40 VUs. A dispatched value is free text, so the step validates it as an integer from 1 to 1000 before k6 sees it (load-test.yml:95-98, :104-109): a non-numeric value would run k6 with NaN, and a huge one a runaway VU count against production with the bypass key attached.

[Rubric §12, Performance & Scalability] is served: the monthly run keeps a modest baseline current within the defined thresholds, a dispatch can replay the observed conference-day peak, and the venue-scale rehearsal lives in its own workflow. [Rubric §29, Resilience, Reliability & Business Continuity] is also touched: a load test that catches a threshold regression before the next conference is a proactive resilience measure.


MMCA.ADC, secret-scan.yml

File: MMCA.ADC/.github/workflows/secret-scan.yml

What it is

A one-job workflow, gitleaks (secret-scan.yml:32-35, ubuntu, 10-minute timeout), that runs gitleaks over the commits a pull request adds and nothing else (secret-scan.yml:4-9). The workflow token is contents: read only (secret-scan.yml:24-25).

Trigger

# secret-scan.yml:21-23
on:
  pull_request:
    branches: [main]

Pull requests only, with a per-ref concurrency group that cancels in progress (secret-scan.yml:27-29), since the scan of a superseded head answers a question nobody is asking any more.

Job: gitleaks

Step 1, Checkout (secret-scan.yml:36-39) with fetch-depth: 0, because the scan range needs both the base and the head commit present.

Step 2, Install gitleaks (secret-scan.yml:46) calls MMCA.Common's shared gitleaks-install composite action, pinned to a release commit SHA, which downloads one versioned linux_x64 release tarball and verifies its SHA-256 before extracting it (MMCA.Common/.github/actions/gitleaks-install/action.yml:1-33). The header explains why this is a binary and not gitleaks-action (secret-scan.yml:15-17): the code that runs is exactly the reviewed release asset, the same reasoning as the SHA pinning described at the top of this chapter. The version and the hash live in that action, shared with MMCA.Store, and are bumped together there.

Step 3, Scan the pull request's commits (secret-scan.yml:48-61) runs gitleaks git . with --log-opts="${BASE_SHA}..${HEAD_SHA}", the repository's .gitleaks.toml, --redact (a finding does not reprint the secret into the job log) and --exit-code 1. Both SHAs arrive through the step's env: block, per the injection convention above.

What it gates, and why

Scope is the PR's own commits (secret-scan.yml:6-9): not the full history and not the working tree. A full-history scan would fail every PR on findings no PR author can fix; the question a PR check answers is "does THIS change add a secret". A leak found in history is a rotation task, not a merge blocker.

It blocks the merge, not the deploy (secret-scan.yml:11-13): gitleaks is a required check in branch protection (the record is MMCA.ADC/CONTRIBUTING.md:85-88), so a PR that adds a secret cannot merge. It is not in deploy.yml's needs: a push deploys only a tree whose PR already passed it.

[Rubric Section 11, Security] assesses whether secrets are kept out of source and checked mechanically. This workflow checks every pull request's added commits for credentials before review, and [Rubric Section 32, Dependency & Supply-Chain] is served by installing the scanner from a hash-verified release asset rather than a mutable action tag.


MMCA.ADC, nuget-audit.yml

File: MMCA.ADC/.github/workflows/nuget-audit.yml

What it is

A weekly vulnerability audit of the deployed NuGet graph. Its header names the hole it closes (nuget-audit.yml:4-9): deploy.yml's supply-chain job audits MMCA.ADC.CI.slnf, but only on a pull request or a code push, so an advisory published against a package already in production after the last merge stays invisible until the next change, however long that takes. Dependabot does not cover it either: dependabot.yml leaves NuGet out on purpose, because versions are centrally pinned and MMCA.Common moves only through /push-release (nuget-audit.yml:8-9).

Triggers

Wednesdays at 07:00 UTC plus workflow_dispatch (nuget-audit.yml:20-25). The slot is chosen to stay away from the weekday 06:00 cross-service run and from maui-audit.yml on Sundays, so an advisory is seen within a week and mid-week, when it can be acted on (nuget-audit.yml:22-23). Permissions are contents: read plus packages: read, the second only because the MMCA.Common feed in nuget.config is GitHub Packages (nuget-audit.yml:27-30).

Job: nuget-audit

One ubuntu job with a 15-minute timeout (nuget-audit.yml:44-46):

  • Checkout with persist-credentials: false (nuget-audit.yml:48-50), and Setup .NET installing both the 10.0 and 11.0 SDK lines, mirroring deploy.yml (nuget-audit.yml:36-41, :52-57).
  • Restore MMCA.ADC.CI.slnf --locked-mode (nuget-audit.yml:61-64). Locked, like every other restore of this graph, so the audit reads exactly what the committed lock files describe, which is what the last deploy shipped (nuget-audit.yml:59-60).
  • Audit through the shared, suppress-aware nuget-vulnerability-audit composite action from MMCA.Common, pinned to the same Common release commit as supply-chain (nuget-audit.yml:66-74). It fails on any vulnerable-package row, direct or transitive, except advisories accepted as a NuGetAuditSuppress item in Directory.Build.props.
  • Upload the report as nuget-audit-report with 14-day retention, under if: always() so a red run still leaves the evidence (nuget-audit.yml:76-83).

What it gates, and why

Nothing. It is detection only (nuget-audit.yml:11-15): a finding turns the run red and nothing else happens. There is no auto-fix, no issue and no pull request; the owner reads the red run and decides whether to bump the pin or accept the advisory as a NuGetAuditSuppress item with its reason. It is not a deploy gate and not a required check, so it never blocks a merge: an advisory against a package already in production is not made safer by refusing the next deploy, which may well be the fix. The MAUI head is outside CI.slnf, so maui-audit.yml audits that graph on its own schedule (nuget-audit.yml:17). [Rubric section 32, Dependency & Supply-Chain] assesses whether known-vulnerable dependencies are detected and acted on; this workflow makes detection independent of change cadence, so a quiet repository is still audited every week.


Repository automation: the MAUI audit

File: MMCA.ADC/.github/workflows/maui-audit.yml

This workflow never tests or deploys anything, and nothing gates on it. It exists to cover two gaps the pipelines above structurally cannot reach: the MAUI head's dependency graph is never audited, and the MAUI head itself is never compiled.

maui-audit.yml, the weekly scan of the graph CI cannot see

The last workflow closes a real supply-chain hole, and its header states it plainly (MMCA.ADC/.github/workflows/maui-audit.yml:3-36). deploy.yml's gating supply-chain job audits MMCA.ADC.CI.slnf, and the MAUI head (Source/Hosts/UI/MMCA.ADC.UI) is deliberately excluded from that filter because restoring it needs the MAUI workloads and a multi-TFM restore far too slow for the per-PR path. The consequence was that the largest and least-refreshed dependency graph in the repository, the Microsoft.Maui.* packages, the Android bindings and everything they drag in transitively, had never been scanned for advisories. The mobile app ships from that graph, so "not deploy-gating" is not the same as "not our problem".

The fix is a cadence change, not a cost increase (maui-audit.yml:14-16): the audit runs on a schedule instead of per PR, so a missed advisory is caught within seven days and no pull request ever pays for a workload install. The cron is Sundays 06:00 UTC (maui-audit.yml:39-43), and the comment explains even that choice: the weekday 06:00 slot already belongs to cross-service-tests.yml, and a slow workload install has no reason to compete with the nightly Testcontainers tier for runner capacity.

Its scope limit is stated rather than hidden (maui-audit.yml:26-32). On ubuntu-latest only net11.0-android can resolve, because net11.0-ios and net11.0-maccatalyst need macOS. dotnet list package takes no MSBuild -p: properties, so the TFM is pinned in two places instead: -p:TargetFrameworks on the restore (maui-audit.yml:112) and --framework on the audit read of the resulting assets file (maui-audit.yml:146-147). The comment argues the coverage is close to full, since the managed MMCA/Maui/BlazorWebView package set is shared across every head and only the small platform-binding tail is Apple-only, and that a macos-latest runner would close that tail at ten times the per-minute cost for a weekly advisory sweep.

Three details in the restore step repay reading (maui-audit.yml:88-128):

  • Try the plain restore first. Hosted images ship a moving set of preinstalled workloads, so on many runs maui-android is already there and dotnet workload install is pure waste. The step attempts the restore, and only pays for the install if it fails.
  • Only for a missing-workload failure. If the restore log carries no NETSDK1147, NETSDK1139 or workload diagnostic, the step errors out rather than installing a workload (maui-audit.yml:122-125). Installing something on an unrelated failure would mask the real error, which is the same fail-closed instinct as the expand/contract guard's missing || true.
  • The lock file is redirected for this restore, never disabled (maui-audit.yml:96-105, :111-114). Directory.Build.props turns lock files on repo-wide, and a single-TFM restore would otherwise rewrite the MAUI project's packages.lock.json (and those of every project it references) into an android-only shape. Harmless on a throwaway runner, but this job doubles as the local reproduction recipe, and committing that truncated lock would be a genuine regression. Passing RestorePackagesWithLockFile=false is not an option: NuGet raises NU1005, a hard error, whenever that property is false and a packages.lock.json already exists, which is every project in this graph, so that flag failed every run of this workflow. The restore instead points NuGetLockFilePath into the gitignored obj/ folder and sets RestoreLockedMode=false, the same mechanism Directory.Build.props uses for local source mode: the committed locks are neither read nor written.

The audit step itself is the same contract as deploy.yml's: fail on any vulnerable-package row except an advisory accepted via NuGetAuditSuppress in Directory.Build.props, re-applying that list by hand because dotnet list --vulnerable ignores it (maui-audit.yml:130-190). It carries the same two fail-closed properties as that copy (maui-audit.yml:142-156): it keeps the tool's exit code instead of swallowing it, and it demands a recognized result header before trusting the report, so a feed timeout or an MSBuild evaluation error cannot pass the gate with an empty match set; and its accept-list is scraped only from real <NuGetAuditSuppress ... Include="..." elements, in either the bare GHSA-... form or the https://github.com/advisories/GHSA-... URL form, with the same regex as MMCA.Common's nuget-vulnerability-audit action (maui-audit.yml:157-162). Only the URL form is also honored by NuGet restore itself, so a URL entry satisfies restore and the scrape while a bare id satisfies the scrape only (MMCA.Common/.github/actions/nuget-vulnerability-audit/action.yml:74-77). --no-restore is required rather than an optimization (maui-audit.yml:137-138): without it dotnet list re-runs an unscoped restore and drags the Apple TFMs back in, which cannot resolve on Linux. Both outcomes write a Step Summary block (maui-audit.yml:170-189), the clean one repeating the macOS scope note so a green result is never mistaken for full coverage. The audit uploads no report artifact: its result lives in the Step Summary and the job status.

The build half compiles the head that MMCA.ADC.CI.slnf excludes (maui-audit.yml:192-215). The same run builds Source/Hosts/UI/MMCA.ADC.UI for net11.0-android in Release with the repo's analyzers and TreatWarningsAsErrors exactly as configured (maui-audit.yml:18-24), so a compile break or an analyzer error in MAUI-only code (Platforms/, MauiProgram, the device pages) surfaces within a week instead of at the next store release. Three choices in the step repay reading:

  • It runs whenever the restore succeeded, even if the audit failed (maui-audit.yml:193, :201, keyed on the restore step's id: restore at :89). The two are independent findings, and a red audit should not hide a broken build, or the reverse.
  • The TFM is narrowed through -p:MauiOnlyTargetFramework (maui-audit.yml:207), a property only the head reads, not through -p:TargetFrameworks. That global property also reaches every referenced net10.0 project, which then cannot build (maui-audit.yml:194-197); the restore above can use it only because the audit reads nothing but the head's assets file.
  • Only signing is relaxed. -p:AndroidKeyStore=false (maui-audit.yml:210) falls back to the debug key, because the release keystore and ADC_ANDROID_SIGNING_PASSWORD exist only on the release workstation (maui-audit.yml:198-200). Nothing loosens the analyzers, the produced package is discarded, and the same lock-file redirect as the restore keeps the committed locks untouched (:208-209).

It detects rather than gates: it stays off the per-PR path and out of deploy.yml's needs on purpose (maui-audit.yml:22-23). The job cap is 60 minutes because a cold workload install plus the Release android build are each several minutes on their own; the cap is a spend guard against a hung install or build, not a pace budget (maui-audit.yml:72-75).

[Rubric §32, Dependency & Supply-Chain] is the primary category: a graph that ships to users and is never scanned is exactly the shape a supply-chain incident takes. [Rubric §31, Cost Efficiency / FinOps] is served by how the gap was closed, weekly rather than per PR, with an install that is skipped whenever the runner already has the workload.


Cross-workflow summary

Workflow Trigger Gates production Mutates Azure
MMCA.Common/ci.yml PR → main (no push trigger) No (framework gate) No
MMCA.Common/release.yml v* tag No (publish gate) No (GitHub Packages + nuget.org)
MMCA.ADC/deploy.yml push → main / PR → main / dispatch Yes Yes (push and dispatch only)
MMCA.ADC/e2e.yml Mon + Thu 07:00 UTC / dispatch / workflow_call from deploy.yml Yes, twice: directly as the chromium e2e-gate, and indirectly via the cross-browser-freshness recency gate No
MMCA.ADC/cost-guard.yml Daily 07:00 UTC / dispatch / workflow_call from deploy.yml Yes, directly, as the cost-guard gate No (read-only)
MMCA.ADC/load-test.yml monthly / dispatch Indirectly, via the load-freshness recency gate No (read-only)
MMCA.ADC/dr-drill.yml Monday 06:00 UTC / dispatch Indirectly, via the dr-freshness recency gate No (restores a throwaway copy, then deletes it)
MMCA.ADC/cross-service-tests.yml weeknights 06:00 UTC (Mon to Fri) / dispatch Indirectly, via the cross-service-freshness recency gate No
MMCA.ADC/maui-audit.yml Sunday 06:00 UTC / dispatch No (weekly advisory sweep and android Release build of the head CI cannot see) No
MMCA.ADC/secret-scan.yml PR to main No (a required merge check, not in deploy.yml's needs) No
MMCA.ADC/apphost-tests.yml Tuesday 07:00 UTC / dispatch (apphost-tests.yml:15-24) No (the opt-in dependency-outage tier) No
MMCA.ADC/conference-day-load-test.yml dispatch only No Writes synthetic attendees to production; serializes on prod-azure (conference-day-load-test.yml:43-45)

(dr-drill.yml is the ADR-009 §29 restore drill: it PITR-restores a copy of a chosen database, times the restore for the RTO record, verifies it comes back Online, then deletes the copy, the live databases are never touched (dr-drill.yml:3-5, Monday 06:00 UTC cron at dr-drill.yml:37-39). A scheduled run picks its target by rotating across the four live per-service databases by ISO week number, so each one gets a recovery proof roughly monthly (dr-drill.yml:7-10, selection at dr-drill.yml:84-91); a dispatch names the database explicitly through a choice input (dr-drill.yml:24-32), which the select job re-checks against the same four names, along with a 1-to-5-digit restore point (dr-drill.yml:74-98). One drill a week that always restored the same database would prove the procedure, not the fleet. The workflow is two jobs (dr-drill.yml:15-20): select (dr-drill.yml:55-101) picks and validates the target and holds no credentials, and drill is named drill (<database>) from its output (dr-drill.yml:103-107), so every run's job name records which database it proved, which is what the dr-freshness failure key reads. Only the drill job can mint an Azure token (dr-drill.yml:41-44), and it declares environment: production (dr-drill.yml:116-119). It runs under a 90-minute cap (dr-drill.yml:115), and the comment above it (dr-drill.yml:109-114) says why: the restore is platform time on Azure SQL, it has grown from 2-4 minutes to 25-59 minutes since 2026-09-28, and the 2026-11-30 drill of ADC_Conference took 58.7 minutes, too close to a 60-minute cap. The cap is load-bearing beyond the drill itself: dr-freshness consumes this workflow's last success, so a drill that times out does not merely lose one run, it moves the deploy toward a hard block. cross-service-tests.yml (cross-service-tests.yml:6-10) is the Testcontainers tier that boots the three REST hosts in one process against a real SQL Server and a real RabbitMQ, exercising the genuine outbox to broker to consumer round-trip and the real Conference to Engagement gRPC read. It must never enter deploy.needs, and the reason is mechanical rather than stylistic: Testcontainers needs a Docker daemon that the gating integration-tests job does not have (cross-service-tests.yml:12-22). Its second job, servicebus-emulator-smoke, has been authoritative since 2026-08-31 and is one of the two jobs the freshness gate requires (cross-service-tests.yml:122-132). The workflow has three jobs, the should-run guard, cross-service and servicebus-emulator-smoke (cross-service-tests.yml:55, :83, :154), and no AppHost job of its own: the full Aspire composition is booted by e2e.yml, which starts the consumer AppHost for every Playwright run (e2e.yml:276-277), ADC's dependency-outage tier boots it in the separate weekly apphost-tests.yml (apphost-outage job, apphost-tests.yml:44), and the framework's own AppHost tier is the non-required apphost-testing job in MMCA.Common's ci.yml (MMCA.Common/.github/workflows/ci.yml:1432), covered above. Neither workflow is given its own section above, but both are part of the workflow set.)

The drill also cleans up when it does not finish. The script deletes its restored copy in a finally block, but a job cancelled at timeout-minutes never reaches it, and the weekly rotation means the next run targets a different database, so its stale-name check would not remove the leftover either; the comment (dr-drill.yml:153-157) records the 2026-09-14 scheduled run that left ADC_Engagement-drill at Basic-tier cost for five days. The Remove leftover drill copies step (dr-drill.yml:158-169) runs under if: always(), so on cancel and on failure too, finds the adc-prod-sql-* server (warning and exiting cleanly when there is none) and deletes every database on it whose name ends in -drill, not just this run's. [Rubric section 31, Cost/FinOps] assesses whether spend is bounded by design rather than by vigilance; this step makes an interrupted drill self-correcting instead of a silent standing charge.

deploy.yml on push or dispatch holds the prod-azure concurrency group with cancel-in-progress: false, so a deploy is never interrupted mid-migration, and its comment records the standing rule that any other workflow mutating production Azure state joins the same group (deploy.yml:54-62). dr-drill.yml does, in both apps: it creates and deletes a database on the production server, so it takes the same never-cancelled group (dr-drill.yml:46-52, MMCA.Store/.github/workflows/dr-drill.yml:44), and so does ADC's conference-day-load-test.yml, which writes synthetic attendees to production (conference-day-load-test.yml:43-45). deploy.yml's pull-request runs use a separate per-branch group that does cancel. All Azure access uses OIDC federated identity (no static client secrets), and every job that logs in declares environment: production because the federated credential's subject is scoped to it. The .slnf/.slnx test runs pass --minimum-expected-tests to prevent empty or silently-truncated test suites from passing: ADC's unit run floors at 6800 (deploy.yml:507, and :686 for the net10.0 leg), its integration run at 650 (deploy.yml:1122) and its Playwright run at 223 (e2e.yml:488), while MMCA.Common's build-and-test legs floor at 11250 per framework against about 12,579 (MMCA.Common/.github/workflows/ci.yml:185), its release run at 22500 for both frameworks together, and its Helpdesk canary at 40 against roughly 91, so a discovery regression that drops thousands of tests fails instead of reporting green. ADC adds coverage floors on top: 55.5% line on its own assemblies and 77.5% branch on the four Application-layer assemblies in build-and-test (deploy.yml:508, :544), and 42.5% integration line coverage on Infrastructure and API in integration-tests (deploy.yml:1092).

The "Gates production" column splits three ways, and the distinction is the most portable idea in this chapter. Two workflows gate directly, by being called as reusable workflows from deploy.yml itself (e2e.yml, cost-guard.yml). Four gate indirectly: dr-drill.yml, load-test.yml, cross-service-tests.yml and the firefox/webkit legs of the scheduled e2e.yml matrix never touch the deploy path, but the age of their latest successful run is a deploy precondition through dr-freshness, load-freshness, cross-service-freshness and cross-browser-freshness (ADR-064). And one gates nothing at all by design: maui-audit.yml notifies rather than blocks, because a weekly advisory sweep is useful precisely when it is not on the critical path. A scheduled workflow only governs anything once something in the delivery path depends either on it having run, or on it having run recently.


Rubric category index for this chapter

Category Where primarily embodied
§8 Data Architecture deploy.yml build-time EF model-drift gate (migrations applied by services at startup, not by deploy.yml); the expand/contract migration guard in build-and-test (ADR-057); the real dotnet ef database update plus schema assertions in ci.yml's Helpdesk canary
§11 Security OIDC in deploy.yml/load-test.yml/cost-guard.yml, each job scoped by environment: production to match the federated credential subject; the GitHub token as a BuildKit secret (never a layer) in build-images; ephemeral RSA key in e2e.yml; least-privilege tokens in release.yml; read-only permissions plus SHA-pinned actions in both repositories' Claude workflows
§12 Performance & Scalability load-test.yml k6 baseline (40 VUs monthly, the observed peak on dispatch) with the synthetic-traffic bypass so it measures backend capacity rather than the rate limiter, kept current by the load-freshness deploy gate (35 days); client-side Web Vitals budgets measured by WebVitalsTests inside the deploy-gating chromium e2e-gate
§13 Observability & Operability Revision-activation polling output, six-endpoint smoke-gate output and rollback log (including the partial-rollback step summary) in deploy.yml; AppHost log and per-failed-test traces in e2e.yml
§14 Testability & Test Strategy --minimum-expected-tests floors in all test steps (11250 per framework leg for MMCA.Common's suite, 40 for the Helpdesk canary, 6800 for ADC's unit and architecture run); the 68.3% unit coverage floor in ci.yml coverage, ADC's 55.5% line floor and 77.5% Application-layer branch floor in deploy.yml build-and-test; the PR's required build-and-test as the test gate for every deploy, since branch protection enforces admins and strict up-to-date checks so the PR run covers the exact merged tree; the golden replay and prompt-contract tiers in that PR pass, plus the paid live judge of ai-eval-gate on a scoring-code deploy, for the AI session scorer, whose behavior can move with no code change; architecture fitness functions in build-and-test
§17 DevOps & Deployment The full workflow set collectively; SHA-tagged images with per-image dirty gating and registry-side re-tagging; the foundation/build-images/deploy phase split that hides image builds under the e2e gate; revision-activation gate plus smoke and rollback; the four proof-of-recency gates in deploy.needs and their justification-required break-glass (ADR-064)
§21 Accessibility ci.yml ui-e2e axe-core WCAG 2.1 AA gate on every MMCA.Common pull request, across all three browser engines
§28 Front-End Testing & Quality ci.yml ui-e2e render smoke; e2e.yml full Playwright suite, deploy-gating on chromium via deploy.yml's e2e-gate, with the firefox/webkit legs of the alternating weekly matrix made mandatory by the cross-browser-freshness recency gate
§29 Resilience & Business Continuity prod-azure concurrency group; the revision-activation gate that proves the new code is actually serving, plus the two-guard rollback in deploy.yml (never undo a healthy activation, never copy back a deactivated revision), kept viable by the expand/contract migration guard (revision rollback does not revert schema); dr-drill.yml PITR restore drill (ADR-009 objectives) rotating across the four live databases and enforced fresh within 8 days by dr-freshness
§30 Compliance & Privacy SBOM generation in release.yml (both the ubuntu and windows pack jobs) and, as a component-count-asserting gate, in deploy.yml's supply-chain on the pull request
§31 Cost / FinOps cost-guard.yml surge-drift detection: daily notifications plus a blocking deploy.yml gate; the docs-only, ui-scoped and per-image short-circuits in the changes job; ACR-hosted layer cache in build-images, paired with the daily purge-old-images ACR task in foundation.bicep and the post-deploy buildcache purge that reclaims the manifests each deploy orphans; maui-audit.yml as a weekly sweep rather than a per-PR workload install
§32 Dependency & Supply-Chain Lock files + source mapping in MMCA.Common; --locked-mode restores against ADC's committed lock files; suppress-aware vulnerability audit in ci.yml, as a deploy gate in ADC's supply-chain, and weekly over the MAUI graph in maui-audit.yml; SBOM artifacts; SHA-pinned actions and env-passed shell inputs across both repositories
§33 Developer Experience Playwright trace upload on failure in ci.yml and e2e.yml; AppHost + service logs in e2e.yml; step summaries in cost-guard.yml, maui-audit.yml and the freshness gates; the same-name-branch canary convention that lets a breaking framework change land with its consumer adaptation
§34 Architecture Governance cost-guard.yml as executable governance for the surge-revert policy; concurrency group as deployment-ordering governance