Appearance
ADR-2642: CTMS Core Topology, Scoped Isolation, and Stateful Site Activation
- Status: Accepted
- Date: 2026-11-20
- Authors: @fderuiter
- Deciders: @fderuiter
- Requirements: @req:PRD-SYS-192, @req:PRD-SYS-046
1. Context & Problem Statement
The CTMS service (apps/ctms) already serves operational endpoints for Startup Greenlight evaluation and certification, Site Milestones, Monitoring Visits, and Delegation of Authority (DoA) logs, while Execution (apps/execution) serves RTSM kit accountability, autologous chain-of-custody, randomization schemes, and site activation. However, ctms remained marked Core: false in ServiceTopology, omitted from OpenAPI TypeScript code generation, lacked uniform FORBIDDEN_SCOPE study/site scope narrowing on several endpoints, and hid its real API workspaces in non-demo web builds. In addition, SiteComplianceCache recorded eTMF document compliance without persisting whether a site had actually been activated, causing SiteActivationPanel to forget activation state across page reloads.
2. Decision Drivers & Constraints
- Core clinical availability: Non-demo deployments require Startup Greenlight, Milestones, Monitoring Visits, Delegation Logs, and Investigational Supply workspaces backed by live
.NETendpoints. - Fail-closed study and site isolation (ADR-2516, ADR-2548): Every CTMS endpoint must evaluate caller study and site scope via
Cadence.Security.Rbac.ClinicalScopeGuardandCtmsScopeGuard, returning HTTP403(FORBIDDEN_SCOPE) outside assigned scope. - Separation of duties:
site_compliance:activateandctms_greenlight:certifyremain restricted toROLE_SYSADMINandROLE_SPONSOR_DM, whilectms_doa:sign_offremains restricted toROLE_SYSADMINandROLE_INVESTIGATOR. - Stateful Part 11 site activation: Site activation must persist
IsActivated,ActivatedAt, andActivatedByonSiteComplianceCachewhile preservingETMF_COMPLIANCE_UPDATEandBLOCKED_ACTIVATIONaudit invariants.
3. Options Considered
Option 1: Keep CTMS Optional and Derive Activation Only in Client State
- Overview: Leave
ctmsas an optional profile service and track site activation transiently in Vue component refs. - Pros:
- ✅ Requires no database migration or topology update.
- Cons:
- ❌ Reloading
/ctmsor Clinical Canvas forgets site activation and invites duplicate activation attempts. - ❌ Core
dotnet run --project apps/apphost/srcomitsctms, leaving/api/v1/ctms/*unreachable in default stacks.
- ❌ Reloading
Option 2: Promote CTMS to Core, Delegate CTMS Scope Isolation to ClinicalScopeGuard, and Persist Activation State (Selected)
- Overview: Promote
ctmstoCore: trueinServiceTopologyand AppHost, generatesrc/api/generated/ctms.tswrapped byctmsApi.ts(ADR-2610), enforce CTMS study/site scope viaCtmsScopeGuarddelegating toCadence.Security.Rbac.ClinicalScopeGuard(ADR-2548), and persistIsActivated,ActivatedAt, andActivatedByonSiteComplianceCache. - Pros:
- ✅ Default AppHost stacks boot
ctmsalongsideexecution, and OpenAPI contract drift fails at build time. - ✅ Reuses
ClinicalScopeGuardwithout duplicating scope evaluation logic across services, and makes site activation idempotent and auditable across reloads while read-only roles see status without mutation controls.
- ✅ Default AppHost stacks boot
- Cons:
- ❌ Adds three columns and an EF Core migration to
execution.site_compliance_caches.
- ❌ Adds three columns and an EF Core migration to
4. Decision Outcome
- Chosen Option: Option 2
- Justification: Promoting
ctmsto core topology, delegatingCtmsScopeGuardtoClinicalScopeGuard, and persisting activation state onSiteComplianceCachedelivers end-to-end GxP traceability, separation of duties, and zero-mock clinical operations outside demo builds while keeping unbacked grant financials, CRA allocation, recruitment mutations, and adaptive dose escalation gated behind#4829.
5. Consequences & Trade-offs
- Positive Impact: Clinical Canvas (
StartandConduct) and/ctms//ssuexpose real Startup Readiness, Site Milestones, Monitoring Visits, Delegation Log, and Investigational Supply workflows with UX-9 scope guidance on HTTP403(FORBIDDEN_SCOPE). - Negative Impact / Technical Debt: Grant financials, CRA allocation, recruitment target edits, and oncology dose escalation remain deferred to
#4829. - Mitigation Strategy: Explicit non-demo scope banners link users to
/plans(ADR-2547) while engineering tracking remains under#4829, preventing unbacked client-only mutations.
6. Implementation & Verification
- Affected Repositories / Services:
packages/topology,packages/security,apps/apphost,apps/ctms,apps/execution,apps/web,docs/openapi,docs/schema. - Verification Plan: Verified via xUnit scope/RBAC/idempotency suites in
Cadence.UnitTests,Cadence.ArchitectureTests,cadence checksentinels, and Vitest suites inapps/web.