Skip to content

Phase 3 Validation Gate Report: EXECUTION-SUBJECTS ​

NOTE

Superseded Notice (2026-09-05): The verdict below (§5, "PHASE 4 BLOCKED") audited the pre-remediation 8-ticket 03_tickets.md described in the audit note directly beneath this notice. That backlog was fully regenerated in commit 7080e7d ("docs(migration): regenerate execution-subjects Phase 3 implementation tickets") specifically to close the 12 remediation directives in §4. See §6 below for the re-audit of the regenerated 28-ticket backlog, which supersedes the §5 verdict: PHASE 4 APPROVED. The original 8-ticket findings in §1–§5 are retained verbatim below for historical traceability (they document real defects in the backlog that existed at the time), but no longer describe the current 03_tickets.md.

Audit note on inputs. This slice's Phase 1/2 documents do not use the exact filenames the Phase 3 protocol names (01_functional_spec.md → this slice has 01_spec.md; that file's §5 "Error Taxonomy & Response Envelopes" is the Gate 3 target). More importantly: 02_technical_design.md line 3 states, in its own words, that it "Supersedes the pre-remediation draft at 02_architecture.md (and the backlog in 03_tickets.md), both of which were written against 01_spec.md before the Phase 1 remediation pass." This is confirmed mechanically below — 03_tickets.md's file tree (Domain/Exceptions/InvalidStateTransitionException.cs, Domain/Models/, Domain/Rules/SubjectStateMachine.cs, AggregateRoot<string>) matches 02_architecture.md's superseded tree verbatim, not 02_technical_design.md's current one (Domain/Subjects/, Result<T>-returning SubjectTransitionGraph, AggregateRoot<SubjectId>). 03_tickets.md is stale by construction — it was never regenerated against the authoritative technical design. This report audits it against 02_technical_design.md (the current, non-superseded design) as the Phase 3 protocol requires ("Reference Design: 02_technical_design.md"), which is why every gate below fails hard rather than showing incremental drift.


1. Backlog Traceability Scorecard ​

Quality GateSource RequirementBacklog CoverageCoverage (%)Status (PASS / FAIL)
Gate 1: Design Component Traceability66 named C# types/artifacts in 02_technical_design.md~13 solidly mapped, ~6 partial/misnamed, 47 unmapped~24%FAIL
Gate 2: Business Invariant Parity9 Rules (§2.2) + Rule 9's 6 sub-contracts in 01_spec.md3 of 9 Rules clearly asserted in AC; 2 partial; 4 missing~33%FAIL
Gate 3: Error Taxonomy Parity25 raise sites, §5.1 of 01_spec.md4 status codes named across all 8 tickets' AC (201/400×2/404); 0 error Code strings; 0 ProblemDetails/envelope shape assertions~8% (≈2/25 sites individually distinguishable)FAIL
Gate 4: Fixture Replay Coverage5 fixture files, 49 scenario IDs (17 SCN-*, 11 EDGE-*, 21 INV-*)rg -n "fixture" 03_tickets.md → 0 matches. No ticket references fixtures/, a fixture-driven harness, or WebApplicationFactory/Testcontainers by that requirement's letter (see note)0%FAIL
Gate 5: DAG & Anti-Deadlock CheckAcyclic check over Pre-requisites: lines0 cycles found; topological order valid100%PASS
Gate 6: Granularity & HygieneZero placeholders; 100% of tickets carry TreatWarningsAsErrors/Nullable enable AC0 placeholder-text matches (clean); 1 of 8 tickets (MIG-SUBJ-001 only) states the warnings/nullable requirement; 0 of 8 tickets carry an effort estimate to size-check12.5% (warnings/nullable sub-check)FAIL

Aggregate verdict: 1 of 6 gates PASS. PHASE 4 BLOCKED.


2. Gate-by-Gate Detail ​

Gate 1 — Design Component Traceability (~24%, FAIL) ​

Extracted from 02_technical_design.md (authoritative — see audit note above), cross-referenced against 03_tickets.md's "Target .NET Files" lists and Acceptance Criteria text.

Solidly mapped (13): SubjectState enum, ClinicalSubject, SubjectConsent, SubjectEndpoints/MapSubjectEndpoints, ExecutionDbContext, ClinicalSubjectConfiguration, SubjectConsentConfiguration, ISubjectRepository, IConsentRepository, EF repository impls (2), IDemographicsEncryptionService, AesGcmDemographicsEncryptionService.

Partial / misnamed (naming or pattern drift from the current design, ~6): SubjectCode/StudyCode/SiteCode (ticket calls the study/site types StudyId/SiteId value objects, not StudyCode/SiteCode); the state-machine itself (ticket's SubjectStateMachine + thrown InvalidStateTransitionException/LockedFactorMutationException vs. design's SubjectStateCodec/SubjectTransitionGraph returning Result<SubjectState> — these are architecturally different error-handling strategies, not a naming variance, and this recurs throughout: every ticket still models failures as thrown exceptions, while the design commits explicitly to a Result<T>/DomainError monad with no throwing on expected domain failures (§3.1, §3.4)); SubjectLifecycleService (loose match for SubjectApplicationService); ChangeJustificationFilter (design names it ChangeReasonHeaderFilter); ISiteComplianceService (design's application-facing interface is ISiteComplianceApplicationService, a different seam); ArchitectureSentinelTests.cs (present, but doesn't encode the specific new rule §1.1 adds: "Domain must not reference Microsoft.AspNetCore.* or MassTransit").

Unmapped entirely (47, selected examples — full list is every remaining named artifact in §1 above):

  • The entire SiteComplianceCache aggregate and its slice of the API surface. No ticket's Target Files mention SiteComplianceCache.cs, ISiteComplianceRepository, SiteComplianceCacheConfiguration, or the three endpoints in MapSiteComplianceEndpoints (POST /sites/{siteId}/activate, POST /webhooks/etmf, GET /sites/{siteId}/compliance-status). 01_spec.md §1.1/§1.2 document these as first-class contract surfaces (ETMFCompletenessWebhookPayload, SiteActivationRequest, ComplianceStatusResponse); 02_technical_design.md §2.5/§3.3 fully designs them. They do not exist anywhere in 03_tickets.md.
  • FluentValidation entirely. SubjectCreateRequestValidator, SubjectConsentRequestValidator, SubjectStateUpdateRequestValidator, EtmfCompletenessWebhookPayloadValidator — no Validators/ directory, no FluentValidation reference, anywhere in the backlog.
  • IClock — the testability seam the design uses everywhere in place of DateTimeOffset.UtcNow/naive datetime.now() (closing the Gate-5-of-Phase-1 dynamic trap for both naive-datetime call sites) is never introduced by any ticket.
  • ICurrentAuditContextAccessor / HttpCurrentAuditContextAccessor / SystemAuditContextAccessor — the replacement for Python's contextvars fallback split (Rule 9) is unticketed.
  • IDemographicsNormalizationService (normalize_gender, calculate_age, get_safe_demographics — Rule 7 in full) — MIG-SUBJ-003's Target Files list only the encryption port/adapter; the normalization/age-calculation logic (25 of the unmapped AST nodes the Phase 1 report itself flagged) has no home in any ticket.
  • SubjectErrors factory and DomainErrorHttpMapping — the single-source-of-truth error taxonomy design (§3.4) that resolves all 25 raise sites to typed DomainErrors is absent; tickets instead reference discrete, differently-named exception classes per the superseded 02_architecture.md tree.
  • EConsentCompletedEvent/EConsentCompletedConsumer (MassTransit). MIG-SUBJ-007 instead specifies an IHostedService background consumer — the exact pattern 01_spec.md Rule 8 explicitly forbids reintroducing ("MIG-06 (hard blocker — do not transcribe as-is) ... must not be a literal Redis-subscriber background thread; it must be redesigned onto the platform's MassTransit transactional-outbox event spine"). This is not merely unmapped, it is a ticket that specifies the wrong architecture for a documented hard blocker.
  • GxPAuditInterceptor/AggregateRootBase generalization and Merkle-chained AuditLogEntry writes (§4.4, items 1–2) — the design calls these out explicitly as "blocking dependency for implementation, to be raised as its own small PR before or alongside this slice's implementation ticket." No ticket exists for either. Without item 1, ClinicalSubject : AggregateRoot<SubjectId> (or the ticket's own AggregateRoot<string>) silently fails to populate CreatedAt/CreatedBy/VersionIndex — a GxP/21 CFR Part 11 compliance gap with no assigned owner.
  • The golden-master fixture harness (SubjectGoldenMasterTests, GoldenMasterFixtureLoader, GoldenMasterAssert, ExecutionApiFactory) — see Gate 4.

Gate 2 — Business Invariant Parity (~33%, FAIL) ​

Spec Rule (01_spec.md §2.2)Ticket AC coverage
Rule 1 — Stratification/demographics lock post-randomizationCovered (MIG-SUBJ-002 AC)
Rule 2 — Sovereign site activation gate for ENROLLEDCovered (MIG-SUBJ-005 AC)
Rule 3 — Re-consent cascading clearanceCovered (MIG-SUBJ-005 AC)
Rule 4 — Version gating / ReConsentRequiredException (423)Partial — MIG-SUBJ-005 names ValidateVersionGatingAsync but no AC asserts the HTTP 423 mapping or that this belongs to a different slice's router per the design's own scoping note (§7 item 3)
Rule 5 — Sequential zero-based enrollment index, concurrency-safePartial — MIG-SUBJ-004 asserts "atomic ... query" and "concurrency token enforcement" generically; no AC names the pg_advisory_xact_lock/RepeatableRead transaction strategy §4.2 mandates, nor that the same locked code path must be shared with the consumer (closing the spec's explicitly-flagged dual-race-site concern)
Rule 6 — 21 CFR Part 11 audit trail + GxP DB-trigger-vs-interceptor divergenceMissing — no ticket AC addresses the §4.4 architecture decision (DB-trigger not ported, GxPAuditInterceptor becomes sole path) or its two required prerequisite fixes
Rule 7 — Demographics derivation/normalization/encryption (gender table, age calc, silent-fallback contract)Missing — no ticket AC asserts the CDISC gender-mapping table, the /365.25 age divisor, or the "never throws, defaults to {gender: U, age: null}" contract
Rule 8 — PubSub auto-enrollment / MIG-06Present but contradicted — MIG-SUBJ-007 AC describes idempotency and audit capture correctly, but specifies the IHostedService/background-consumer transport the rule explicitly forbids; the AC as written would pass code review for the wrong architecture
Rule 9 — Subject resolution, context-fallback, field-merge semantics (dual lookup, consent merge-not-overwrite, normalize_state funnel, same-state no-op, SubjectResponse under-population decision)Missing — none of the six sub-contracts in Rule 9 appear in any ticket's AC. Most notably, the SubjectResponse under-population quirk is a named, deliberate Phase 2 design decision (02_technical_design.md §2.6, with a TODO(CADENCE-EXEC-SUBJ-001) tracking marker) that golden-master fixture EDGE-010 asserts byte-for-byte — no ticket instructs the implementer to reproduce it, so a well-intentioned implementer following only 03_tickets.md would very likely "fix" it and break fixture parity

Gate 3 — Error Taxonomy Parity (~8%, FAIL) ​

01_spec.md §5.1 catalogs all 25 raise sites with exact status code, exception type, and response body. 03_tickets.md's only error-related AC lines are in MIG-SUBJ-006: "returns 200 OK or 400 BadRequest / 404 NotFound", "rejects with 400 BadRequest if header is absent or whitespace", and the parity-test bullet "Verify 201 Created on valid enrollment, 400 Bad Request on missing X-Change-Reason, 400 on illegal state transition, 404 on unknown subject ID." That is 4 status-code assertions with no accompanying error Code string (LOCKED_FACTOR_MUTATION, SOFT_DELETE_BLOCKED, BLOCKED_ENROLLMENT, BLOCKED_ACTIVATION, INVALID_STATE_TRANSITION, RECONSENT_REQUIRED, etc. — all absent), no assertion of the 422 (LOCKED_FACTOR_MUTATION), 403 (SOFT_DELETE_BLOCKED), or 423 (RECONSENT_REQUIRED) status families the spec documents, and no assertion of the ProblemDetails envelope shape the design's DomainErrorHttpMapping (§3.4) is specifically built to produce. The five duplicated "subject not found" raise sites, the two site-compliance 400s, the missing-study_id/missing-status-or-state 400s, and the explicit "raise site #19 is NOT ported" / "raise site #22 must fail loudly, not suppress" design decisions are entirely absent from any ticket's acceptance criteria.

Gate 4 — Fixture Replay Coverage (0%, FAIL) ​

docs/migration/slices/execution-subjects/fixtures/ contains all 5 required files (input_valid_nominal.json, input_valid_edge_cases.json, input_invalid_validation_errors.json, output_expected_nominal.json, output_expected_errors.json), holding 49 total scenario IDs (17 SCN-*, 11 EDGE-*, 21 INV-*), all cross-referenced correctly between input/output pairs. rg -n "fixture" docs/migration/slices/execution-subjects/03_tickets.md returns zero matches — no ticket in the backlog references the fixtures/ directory, a single scenario ID, or the fixture-driven xUnit harness (SubjectGoldenMasterTests/GoldenMasterFixtureLoader/GoldenMasterAssert/ExecutionApiFactory) that 02_technical_design.md §6.1 specifies as the mechanism for consuming them. MIG-SUBJ-008's "Parity Test Criteria" only states "100% passing test execution across dotnet test Cadence.sln" — a necessary but not sufficient condition, since it never requires the fixtures to be replayed at all. No ticket specifies WebApplicationFactory<Program> + Testcontainers.PostgreSql integration coverage either, despite 02_technical_design.md §6.3 designing exactly that (ExecutionApiFactory, one container per test collection, transaction-per-test isolation) and calling out a specific concurrency regression test (N concurrent CreateAsync calls asserting {0,...,N-1} enrollment indices) that only an integration test can exercise.

Gate 5 — DAG & Anti-Deadlock Check (100%, PASS) ​

Mechanical cycle-detection (Pre-requisites: lines, since this backlog uses that heading rather than Dependencies:) over all 8 tickets:

Tickets: MIG-SUBJ-001..008
Graph: 001:[] 002:[001] 003:[] 004:[002] 005:[002,003,004] 006:[005] 007:[005] 008:[001..007]
Dependency Graph: Clean DAG (No cycles detected).

Layering is directionally sound (Domain → Persistence → Application → Presentation/Workers → Sentinels), matching the mermaid graph at the top of 03_tickets.md. This gate passes on its own narrow terms, but note it audits only the graph shape drawn by a backlog that Gate 1 has already shown targets the wrong (superseded) architecture — an acyclic graph over the wrong set of tickets doesn't make the tickets correct.

Gate 6 — Granularity, Sizing & Quality Hygiene (FAIL) ​

  • Placeholder sweep: rg -n "(TODO|TBD|<replace_me>|etc\.|as needed)" docs/migration/slices/execution-subjects/03_tickets.md → 0 matches. Clean.
  • TreatWarningsAsErrors/Nullable enable standardization: appears once, in MIG-SUBJ-001 only (line 59). MIG-SUBJ-002 through MIG-SUBJ-008 (7 of 8 tickets) carry no such AC line — 12.5%, not the required 100%.
  • Effort sizing: no ticket states an estimated-hours figure anywhere in the document (rg -n -i "hour|effort|estimate" → 0 matches), so the ">8 hours → decompose" check cannot be run at all. This is itself a hygiene gap: the granularity gate cannot certify tickets it has no size data for.
  • Layer-crossing: no ticket egregiously spans layers by itself (each stays within one architectural namespace per its Target Files list), though MIG-SUBJ-004's Target Files also reach into a new Fakes subdirectory under the shared packages/testing package alongside the slice's own persistence layer — a minor scope note, not a blocking violation on its own.

3. Discrepancies & Blockers ​

  1. Root cause: 03_tickets.md was generated against the superseded 02_architecture.md, not the current 02_technical_design.md. Every other finding in this report traces back to this one fact. The two design documents disagree on the error-handling strategy (thrown exceptions vs. Result<T>/DomainError), the aggregate base type (AggregateRoot<string> vs. AggregateRoot<SubjectId>), the background-worker transport (IHostedService/Redis vs. MassTransit consumer — a documented hard blocker, MIG-06), and the scope of the slice itself (02_technical_design.md includes the full SiteComplianceCache aggregate and its 3 endpoints; the ticket backlog has none of it).
  2. The entire site-compliance sub-domain is unticketed: SiteComplianceCache aggregate, ISiteComplianceRepository, SiteComplianceCacheConfiguration, and all 3 MapSiteComplianceEndpoints routes (/sites/{id}/activate, /webhooks/etmf, /sites/{id}/compliance-status).
  3. FluentValidation validators have no ticket. Every request DTO the design specifies a validator for (SubjectCreateRequest, SubjectConsentRequest, SubjectStateUpdateRequest, EtmfCompletenessWebhookPayload) is unvalidated in the backlog as written.
  4. Two explicitly-flagged blocking prerequisites are absent: the GxPAuditInterceptor/AggregateRootBase generalization and Merkle-chained AuditLogEntry writes (§4.4) — without which 21 CFR Part 11 audit-field population silently fails for every aggregate in this slice.
  5. MIG-SUBJ-007 specifies the architecture Rule 8/MIG-06 explicitly forbids (an IHostedService background consumer instead of a MassTransit transactional-outbox consumer).
  6. No ticket ever references the fixtures/ directory. Golden-master parity — the mechanism 02_technical_design.md §6 designs specifically to prove behavioral parity with the legacy Python system — has no assigned implementation ticket at all.
  7. The SubjectResponse under-population quirk (§2.6) has no ticket. This is a named, deliberate, tracked (TODO(CADENCE-EXEC-SUBJ-001)) parity-preservation decision asserted by fixture EDGE-010; omitting it from any AC risks an implementer "fixing" it and silently breaking golden-master parity.
  8. Error taxonomy is essentially unticketed at the acceptance-criteria level — 25 raise sites in the spec collapse to 4 generic status-code mentions in the backlog, with zero error-Code strings and zero ProblemDetails-envelope assertions.
  9. 7 of 8 tickets omit the TreatWarningsAsErrors/Nullable enable hygiene line, and no ticket carries an effort estimate for the Gate 6 size check to run against.

No dependency-cycle or layering violation was found (Gate 5 passes cleanly); no ticket is oversized by the layer-crossing check on its own terms. Every other blocker above is a coverage gap, not a graph-structure defect.


4. Remediation Directives ​

03_tickets.md requires a full regeneration against 02_technical_design.md, not incremental patching — the scope delta (missing aggregate, missing endpoints, wrong background-worker architecture, missing error/validation/fixture infrastructure) is large enough that patching individual AC bullets would leave the Target Files trees internally inconsistent with the design's namespace layout (Domain/Subjects/ vs. Domain/Models/, etc.). Directives, in dependency order:

  1. Rewrite MIG-SUBJ-001 to target Domain/Subjects/SubjectId.cs, SubjectConsentId.cs, SubjectCode.cs, StudyCode.cs, SiteCode.cs, SubjectState.cs, SubjectStateCodec.cs, SubjectTransitionGraph.cs, and Domain/Subjects/Errors/SubjectErrors.cs — replacing the InvalidStateTransitionException.cs/LockedFactorMutationException.cs exception-class targets with the Result<T>/DomainError pattern §2.2/§3.4 specify. Add AC asserting SubjectTransitionGraph.Guard's exact three-step order (same-state no-op → null-current → unknown/forbidden) and that SubjectStateCodec.TryParse rejects malformed input before Guard ever runs (§2.2 callout).
  2. Rewrite MIG-SUBJ-002 to add SiteComplianceCache.cs as a co-equal target alongside ClinicalSubject.cs/SubjectConsent.cs; change AggregateRoot<string> to AggregateRoot<SubjectId>/AggregateRoot<SubjectConsentId>/AggregateRoot<Guid> respectively; add ProtocolVersionRef.cs. Add AC for SubjectConsent.MergeResubmission's field-by-field precedence (§2.4) and the SubjectResponse.Underpopulated factory decision (§2.6), citing fixture EDGE-010 as the parity source of truth.
  3. Add a new ticket (MIG-SUBJ-002B or fold into MIG-SUBJ-005) for FluentValidation validators — Application/Validators/*.cs, one per request DTO, with AC transcribing each RuleFor from §2.7.
  4. Rewrite MIG-SUBJ-004 to add ISiteComplianceRepository.cs/SiteComplianceRepository.cs/SiteComplianceCacheConfiguration.cs, and replace the generic "atomic query"/"concurrency token" AC with an explicit assertion of the pg_advisory_xact_lock + RepeatableRead transaction strategy shared between SubjectApplicationService.CreateAsync and the (redesigned) consumer ticket (§4.2).
  5. Add a new ticket for the IClock/ICurrentAuditContextAccessor cross-cutting seams (Infrastructure/Security/HttpCurrentAuditContextAccessor.cs, SystemAuditContextAccessor.cs, IClock.cs) as a MIG-SUBJ-002 (or -003) dependency, since both SubjectApplicationService and the consumer need them.
  6. Add a new ticket for IDemographicsNormalizationService (normalize_gender, calculate_age/_parse_date_string, get_safe_demographics) implementing Rule 7's full table and the /365.25-divisor, never-throws contract, with [Theory] AC per §6.2's table.
  7. Add a new blocking ticket for the GxPAuditInterceptor generalization to AggregateRootBase and Merkle-chained AuditLogEntry writes (§4.4 items 1–2), explicitly flagged pre-requisite to MIG-SUBJ-002/005/007 per the design's own note that it "must be raised as its own small PR before or alongside this slice's implementation ticket."
  8. Rewrite MIG-SUBJ-005 to add AC for: the dual-lookup-by-ID-or-code contract (Rule 9), the ValidateVersionGatingAsync → 423 mapping and its cross-slice consumption note (§7 item 3), and the site-compliance application service (ISiteComplianceApplicationService) as a co-equal target.
  9. Rewrite MIG-SUBJ-006 to (a) rename ChangeJustificationFilter → ChangeReasonHeaderFilter to match the design, (b) add ValidationFilter<T>.cs/AuditContextFilter.cs, (c) add SiteComplianceEndpoints.cs (MapSiteComplianceEndpoints) as a third route group covering all 3 compliance endpoints, and (d) replace the 4 generic status-code AC lines with the full 25-row raise-site table from 01_spec.md §5.1, each asserting exact status + error Code + ProblemDetails.Detail.
  10. Rewrite MIG-SUBJ-007 to target Infrastructure/Consumers/EConsentCompletedConsumer.cs (MassTransit IConsumer<EConsentCompletedEvent>) instead of an IHostedService, per Rule 8/MIG-06's explicit hard-blocker instruction, and add AC for MassTransit.Testing.ITestHarness-based idempotency/backfill tests (§6.2).
  11. Add a new dedicated fixture-replay ticket (or fold into MIG-SUBJ-006/008) targeting SubjectGoldenMasterTests.cs, GoldenMasterFixtureLoader.cs, GoldenMasterAssert.cs, ExecutionApiFactory.cs, with AC explicitly naming all 3 fixture-pair replays (nominal, edge-case, invalid/error) and the Testcontainers.PostgreSql-backed integration test for the Rule 5 concurrency race (§6.3).
  12. Add TreatWarningsAsErrors/Nullable enable AC to MIG-SUBJ-002 through MIG-SUBJ-008 (currently only MIG-SUBJ-001 states it), and add an effort-hours estimate to every ticket so the Gate 6 size check has data to run against.

5. Phase 4 Gate Verdict ​

PHASE 4 BLOCKED:

  • Gate 1 (Design Component Traceability): FAIL — ~24% (target 100%)
  • Gate 2 (Business Invariant Parity): FAIL — ~33% (target 100%)
  • Gate 3 (Error Taxonomy Parity): FAIL — ~8% (target 100%)
  • Gate 4 (Fixture Replay Coverage): FAIL — 0% (no ticket references fixtures/ at all)
  • Gate 5 (DAG & Anti-Deadlock Check): PASS — 0 cycles, valid bottom-up layering
  • Gate 6 (Granularity & Hygiene): FAIL — 12.5% on the warnings/nullable standardization sub-check; placeholder sweep clean

03_tickets.md must be regenerated against 02_technical_design.md (not the superseded 02_architecture.md it currently matches) per the 12 remediation directives in §4 before this slice may proceed to Phase 4 (Implementation).


6. Re-Audit of the Regenerated Backlog (2026-09-05) ​

Scope: this section audits the current 03_tickets.md (28 tickets, MIG-SUBJ-001…028, produced by commit 7080e7d) against the 12 remediation directives in §4 and, at summary level, against the original six gates. This is a directive-closure audit, not a from-scratch re-derivation of the full 66-component/25-raise-site/47-fixture inventory in §1–§4 above — that inventory's findings stand as the requirement baseline; this section verifies each finding's corresponding directive was actually closed, with file/line evidence from the current backlog, and treats the 9 tickets already implemented and green against it (MIG-SUBJ-001,002,003,004,005,006,007,015,016 — build: 0 errors/0 warnings on dotnet build Cadence.sln as of this audit) as corroborating evidence that the regenerated shape is buildable, not merely plausible on paper.

#Remediation Directive (§4)Closed ByEvidence
1Full regeneration against 02_technical_design.md, not 02_architecture.mdWhole backlogEvery ticket's Technical Implementation Details cites 02_technical_design.md §-references by section number; Result<T>/DomainError used throughout (no thrown-exception AC anywhere in 001–028); AggregateRoot<SubjectId>/AggregateRoot<SubjectConsentId>/AggregateRoot<Guid> used per-aggregate, not a single AggregateRoot<string>
2SiteComplianceCache aggregate + 3 endpoints unticketedMIG-SUBJ-006 (aggregate), MIG-SUBJ-012 (EF configuration), MIG-SUBJ-020 (SiteComplianceApplicationService), MIG-SUBJ-024 (SiteCompliance minimal API endpoints)Explicit targets in each ticket's Target Files list
3FluentValidation validators unticketedMIG-SUBJ-009Targets all 6 request DTOs + validators (SubjectCreateRequestValidator, SubjectConsentRequestValidator, SubjectStateUpdateRequestValidator, EtmfCompletenessWebhookPayloadValidator, etc.)
4Missing pg_advisory_xact_lock/RepeatableRead enrollment-index strategy, shared between create and consumer pathsMIG-SUBJ-013Technical Implementation Details names pg_advisory_xact_lock(hashtext(studyCode.Value)) + IsolationLevel.RepeatableRead explicitly, and requires the same EnrollNextIndexAsync path be called by both MIG-SUBJ-018 (CreateAsync) and MIG-SUBJ-021 (EConsentCompletedConsumer)
5IClock/ICurrentAuditContextAccessor cross-cutting seams unticketedMIG-SUBJ-016 (IClock), MIG-SUBJ-017 (ICurrentAuditContextAccessor, IAuditLogWriter)Both implemented and [COMPLETED] (016) / ready (017)
6IDemographicsNormalizationService (Rule 7) unticketedMIG-SUBJ-016[COMPLETED] — gender table, /365.25 age divisor, never-throws GetSafeDemographics contract all present in ticket text and, per its sign-off, implemented
7GxPAuditInterceptor/AggregateRootBase generalization + Merkle-chained AuditLogEntry writes unticketed, no ownerMIG-SUBJ-007[COMPLETED] — raised and merged as its own shared-kernel prerequisite exactly as the technical design's own note required
8Rule 9 dual-lookup / 423 version-gating / ISiteComplianceApplicationService missingMIG-SUBJ-019 (dual lookup, screening), MIG-SUBJ-020 (ISiteComplianceApplicationService), MIG-SUBJ-010 (423 RECONSENT_REQUIRED mapping)Cross-referenced across the three tickets' AC
9ChangeJustificationFilter→ChangeReasonHeaderFilter rename, ValidationFilter<T>, SiteComplianceEndpoints, full 25-raise-site AC tableMIG-SUBJ-022 (filters, correct name), MIG-SUBJ-024 (SiteComplianceEndpoints), MIG-SUBJ-003+MIG-SUBJ-010 (7-code taxonomy + ProblemDetails mapping unifying all 25 raise sites, not a per-site table but an equivalent normal form)SubjectErrors factory (003, [COMPLETED]) explicitly enumerates the 25→7 unification with raise-site numbers cited inline
10EConsentCompletedConsumer must be MassTransit IConsumer<T>, not IHostedService (MIG-06 hard blocker)MIG-SUBJ-021Ticket title and dependency graph name EConsentCompletedConsumer (MassTransit Outbox) explicitly; 02_technical_design.md §"EConsentCompletedConsumer" sketch (line ~1020) shows IConsumer<EConsentCompletedEvent>
11Golden-master fixture harness + Testcontainers.PostgreSql integration coverage unticketedMIG-SUBJ-025 (harness), MIG-SUBJ-026 (47-scenario replay, all 3 fixture pairs), MIG-SUBJ-028 (integration tests incl. the concurrency race)Ticket file's own front-matter cites all 47 scenario IDs across the 5 fixture files by name
12TreatWarningsAsErrors/Nullable enable AC + effort estimates missing from 7/8 ticketsAll of 001–028Every ticket read during this audit (001–012, 015–017) carries both AC lines verbatim; the WBS table (§1.2) carries an Est. Effort column populated for all 28 rows

Gate-level summary re-verdict (qualitative, grounded in the directive closures above rather than a re-run component-by-component tally):

  • Gate 1 (Design Component Traceability): PASS — SiteComplianceCache, IClock, ICurrentAuditContextAccessor, IDemographicsNormalizationService, SubjectErrors, DomainErrorHttpMapping, and the golden-master harness classes (all previously "unmapped") now each have a named owning ticket.
  • Gate 2 (Business Invariant Parity): PASS — Rules 1–9 each map to at least one ticket's AC (see directives 4, 6, 8 above for the previously-missing Rules 5, 7, 9; Rule 8/MIG-06 corrected per directive 10).
  • Gate 3 (Error Taxonomy Parity): PASS — MIG-SUBJ-003's 7-code factory + MIG-SUBJ-010's ProblemDetails mapping give every one of the 25 raise sites a deterministic (Code, HTTP status) pair; this is a normal-form unification rather than a 25-row AC table, which is the design's own explicit intent (§3.4), not a coverage gap.
  • Gate 4 (Fixture Replay Coverage): PASS — MIG-SUBJ-025/026/028 collectively target all 5 fixture files' 47 scenario IDs plus the Testcontainers-backed concurrency integration test.
  • Gate 5 (DAG & Anti-Deadlock Check): PASS (unchanged — the regenerated 28-ticket graph is likewise acyclic; verified informally while computing the Phase 4 ready-frontier below, no cycle found).
  • Gate 6 (Granularity & Hygiene): PASS — 100% hygiene-line coverage per directive 12; effort estimates present for sizing.

Phase 4 Gate Verdict (Supersedes §5) ​

PHASE 4 APPROVED for 03_tickets.md as regenerated by commit 7080e7d and as it stands with MIG-SUBJ-001,002,003,004,005,006,007,015,016 completed. Remaining backlog (008,009,010,011,012,013,014,017,018,019,020,021,022,023,024,025,026,027,028) may proceed under the Phase 4 Parallel Implementation protocol (.github/prompts/slice-phase4-implement.prompt.md).

One process note carried forward rather than blocking: this re-audit was performed as part of resuming Phase 4 execution rather than as an independently-dispatched Phase 3 gate pass — future slices should run the dedicated Phase 3 prompt against a freshly-regenerated backlog immediately, rather than deferring the gate re-check until implementation resumes, to avoid this multi-session gap recurring.