Skip to content

05. Orphan Audit Gate — Zero-Orphan Verification ​

Document ID: PHASE0-NET10-05 Status: Forensic verification report. Every number in this document is mechanically reproducible from the commands shown — nothing here is asserted without the command that produces it.


1. Method ​

The prior Phase 0 effort in this repository (docs/migration/Migration_Phase0_Readiness_Audit.md, AUD-NET10-002) found that an earlier discovery pass had certified "100% coverage" using only markdown-lint scripts (validate_adrs.py, validate_markdown.py) as its verification evidence — i.e., it never actually counted files. This document exists specifically to not repeat that failure: the Zero-Orphan Rule below is checked by direct filesystem enumeration, and the commands are reproducible by anyone with shell access to the repository, not asserted from memory or from a prior document's summary.

bash
find . -type f -name "*.py" \
  -not -path "./.venv/*" -not -path "*/node_modules/*" \
  -not -path "*/.git/*" -not -path "*/__pycache__/*" \
  | sed 's|^\./||' | sort

This returned 1,675 files on 2026-09-03, saved to a scratch census file and re-verified twice during this baseline's production (once for the initial per-directory bucket count in 01_system_topology.md §0, once independently while writing this document) — both runs returned the identical count and the identical per-directory breakdown below.


2. Directory Census (ground truth) ​

awk -F/ '{ if ($1=="apps" || $1=="packages") print $1"/"$2; else print $1 }' <census> | sort | uniq -c
BucketFilesBucketFiles
apps/execution330packages/engine_core59
apps/designer169packages/security36
apps/etmf115packages/cli24
apps/interop110packages/ddf21
scripts (root)104packages/deid16
apps/safety73packages/storage15
apps/econsent67packages/database15
apps/ctms65packages/compliance14
apps/quality54tests (root)15
apps/fileshare49packages/testing7
apps/tickets47packages/hexagonal5
apps/eisf43apps/web5
apps/knowledge39packages/tooling_core4
apps/ai_gateway31packages/sentinels4
apps/payments30packages/core-models1
apps/notifications29apps/__init__.py1
apps/gateway29apps/conftest.py1
apps/imaging23packages/__init__.py1
apps/org22packages/conftest.py1
verification (root)1

Sum of all buckets: 1,675 — matches the raw find | wc -l count exactly. apps/subject-portal contributes 0 .py files (confirmed Vue/Vite-only, no Python backend) and does not appear as a bucket for that reason, not because it was skipped.


3. Zero-Orphan Rule: bucket-to-context assignment ​

Every bucket above resolves to exactly one row in 02_bounded_contexts.md §1 (bounded context) or §3 (shared kernel / cross-cutting), with no bucket left unassigned:

Bucket(s)Assigned toCategory
apps/executionExecution (EDC/RTSM)Bounded context
apps/designerDesigner (USDM/MDR)Bounded context
apps/etmfeTMFBounded context
apps/interopInteropBounded context
apps/safetySafety (PV)Bounded context
apps/econsentEconsentBounded context
apps/ctmsCTMSBounded context
apps/qualityQuality (CAPA/CSM)Bounded context
apps/fileshareFileshareBounded context
apps/ticketsTicketsBounded context
apps/eisfeISFBounded context
apps/knowledgeKnowledgeBounded context
apps/ai_gatewayAiGatewayBounded context
apps/paymentsPaymentsBounded context
apps/notificationsNotificationsBounded context
apps/gatewayGatewayBounded context
apps/imagingImagingBounded context
apps/orgOrgBounded context
apps/webWeb SPA edgeBounded context (non-Python edge, catalogued not migrated)
apps/__init__.py, apps/conftest.pyCross-cutting test fixture rootShared Kernel / Cross-Cutting — pytest root config, not a business domain
packages/engine_coreCadence.Core.DomainShared Kernel
packages/securityCadence.SecurityShared Kernel (flagged non-leaf, MIG-02)
packages/databaseCadence.DatabaseShared Kernel
packages/contracts — (0 .py files; TypeScript/schema-only per repo layout — no bucket row, consistent with 0-file buckets being omitted, same as subject-portal)Cadence.ContractsShared Kernel
packages/testingCadence.TestingShared Kernel
packages/cliCadence.CliShared Kernel
packages/deidCadence.DeidShared Kernel
packages/storageCadence.StorageShared Kernel
packages/ddfCadence.DdfShared Kernel
packages/complianceCadence.ComplianceShared Kernel
packages/hexagonalScaffolding templates (scripts/scaffold_service.py support)Shared Kernel / tooling
packages/tooling_coreShared CLI tooling handlersShared Kernel / tooling
packages/sentinelsArchitecture-drift sentinel definitionsShared Kernel / tooling
packages/core-modelsPlaceholderShared Kernel
packages/__init__.py, packages/conftest.pyCross-cutting test fixture rootShared Kernel / Cross-Cutting
scripts (104 files)Operational/CI toolingCross-Cutting, explicitly not migrated (see 01_system_topology.md §2.5) — retired alongside the Python codebase except where a named .NET-side CI equivalent is created
tests (root, 15 files)Cross-service integration test fixturesCross-Cutting — not a bounded context, confirmed by the coupling-DAG research pass as the only location where genuine cross-app Python imports occur (production code has zero cross-app imports)
verification (1 file, verify_lookup.py)Standalone verification utility with an accompanying static HTML/PNG pair, unrelated to any service's runtimeCross-Cutting, out of migration scope — a one-off tool, not part of any bounded context's deployable surface

Verification check performed: packages/contracts was confirmed to have zero .py files (it is schema/DTO source used by the .NET Cadence.Contracts project directly, plus TypeScript client-generation artifacts) via find packages/contracts -name "*.py" returning empty — its absence from the bucket table in §2 is therefore correct, not an omission.

Result: 100% of the 1,675 .py files in the repository are accounted for. Zero orphans found. This is a structural (directory-level) guarantee, not a claim that every individual file's content was read — see the limits section in 01_system_topology.md §6 for what was and was not verified at the content level.


4. Scaffold execution & build-verification status ​

Per the task's Step 5, 04_scaffold_solution.sh was executed in this environment. The actual, unedited result:

$ bash docs/migration/phase0/04_scaffold_solution.sh
[1/6] Verifying .NET 10 SDK on PATH...
  [ERROR] dotnet SDK not found on PATH.
  This repo pins SDK 10.0.100 in global.json with rollForward=latestFeature.
  Install it, or run this script inside docker/Dockerfile.dotnet, then re-run.
$ echo $?
1

The .NET 10 SDK could not be installed in this sandboxed environment to run the remainder of the script:

  • apt-get install -y dotnet-sdk-10.0 resolved a candidate (10.0.104-0ubuntu1~24.04.1) but every constituent package (dotnet-host-10.0, dotnet-hostfxr-10.0, dotnet-runtime-10.0, aspnetcore-runtime-10.0, dotnet-sdk-10.0, etc.) returned 404 Not Found from both archive.ubuntu.com and security.ubuntu.com — the package index is stale relative to what's actually hosted.
  • curl https://dot.net/v1/dotnet-install.sh (the official Microsoft install script) failed with CONNECT tunnel failed, response 403 — dot.net is not on this environment's outbound-proxy allowlist.

Consequence for this baseline's claims: 04_scaffold_solution.sh was authored, code-reviewed by hand against the two already-working scaffold scripts in this repository (scripts/scaffold_dotnet_solution.sh, and the script embedded in docs/migration/PHASE0_DOMAIN_DECOMPOSITION_AND_SCAFFOLD.md, both of which follow the identical dotnet new/dotnet sln add/dotnet add reference|package idiom), and confirmed to fail cleanly and immediately at its own SDK guard rather than partway through with an inconsistent solution state. It was not run to completion, and dotnet build Cadence.sln was not executed in this session. No claim of "zero warnings, zero errors" is made anywhere in this Phase 0 baseline, because it was not observed.

This is stated explicitly, rather than silently omitted or asserted optimistically, because the most recent commit in this repository's own history (docs/migration/Migration_Phase0_Readiness_Audit.md, AUD-NET10-002) is a forensic finding that a prior Phase 0 pass certified remediations as complete on the basis of a markdown linter, not a functional check — repeating that pattern here (asserting a build result that was never produced) would be the same defect this baseline exists to not repeat.

Required follow-up before Phase 1 kickoff relies on this scaffold: run docs/migration/phase0/04_scaffold_solution.sh in an environment with the .NET 10 SDK actually available (docker/Dockerfile.dotnet in this repository is built for exactly this purpose — it should be usable in a CI runner or a developer's machine even where it isn't usable in this particular sandboxed session), and confirm dotnet build Cadence.sln --no-incremental returns zero warnings and zero errors under the repository's TreatWarningsAsErrors=true policy (Directory.Build.props). Until that run happens and is recorded, treat the .NET solution scaffold as authored and reasoned about, not build-verified.


5. What already existed vs. what this scaffold adds ​

Independent of the build-verification gap above, the repository already contains a partial scaffold from prior Phase 0 work, confirmed present on disk:

Already presentAdded/completed by 04_scaffold_solution.sh
Cadence.sln, Directory.Build.props, Directory.Packages.props, global.json, .editorconfig(verified, not overwritten)
Cadence.Core.Domain, Cadence.Security, Cadence.Database, Cadence.Contracts, Cadence.Testing, Cadence.Cli (6 of 9 Tier 0 packages)Cadence.Deid, Cadence.Storage, Cadence.Ddf (3 remaining Tier 0 packages)
Cadence.Apps.Execution, Cadence.Apps.Designer, Cadence.Apps.Gateway (3 of 18 app services), each with a minimal Program.csRemaining 15 app-service skeletons: Org, Quality, Payments, Ctms, Etmf, Safety, Econsent, Eisf, Tickets, Notifications, AiGateway, Fileshare, Imaging, Knowledge, Interop
tests/Cadence.UnitTests.csproj, tests/Cadence.ArchitectureTests.csproj with hand-written ArchitectureSentinelTests.cs/SecurityAndDomainTests.cs(verified present, not overwritten)

15 .cs files exist in the repository today (Program.cs x3 for the scaffolded apps, plus one file each for Cadence.Cli, IExecutionApiClient, GxPAuditInterceptor, AggregateRoot, AuditLogEntry, IGxPAuditable, Result, HmacSigner, GxPRequirementAttribute, InMemoryRepository, and the two test files) — these are tracer-bullet skeletons, not feature-complete transcriptions, consistent with this task's Step 0 instruction to not write application domain code during Phase 0.


6. Executive Summary ​

  • Total Python files cataloged: 1,675, all 100% accounted for against exactly one bounded context or cross-cutting bucket (§2-3 above).
  • Total bounded contexts identified: 18 Python-backed FastAPI services + 2 non-Python SPA edges (Web, Subject-Portal) = 20 catalogued contexts, plus a 14-package Shared Kernel / Cross-Cutting layer (02_bounded_contexts.md §3).
  • Recommended Slice 01 for immediate Phase 1 execution: Cadence.Apps.Execution — already the tracer-bullet slice in progress (has the most complete existing .cs skeleton of any app service), the highest fan-in/fan-out of any context in the platform, and the load-bearing dependency every Tier 3 orchestrator (Quality, Ctms, Etmf, Safety, Eisf) is sequenced behind. It carries the heaviest blocker list of any slice (MIG-03, MIG-04, MIG-05 — see 03_migration_plan.md §3) precisely because it is the highest-leverage slice to de-risk first; deferring it would leave every downstream Tier 3/4 slice's contract un-frozen. Cadence.Apps.Gateway and Cadence.Apps.Designer should be staffed in parallel with it (both already have skeletons and both sit in the same wave), with Gateway's MIG-07 (OpenAPI HTTP-discovery replacement) prioritized early since it is a correctness blocker for every other slice's documentation the moment any second service goes live in .NET.