# Implementation log ## 2026-10-14 — Preparation - Read complete current `AGENT.md`; inspected functional requirements, target specification/ADRs, editable diagram labels/relationships, as-built descriptions and original source/tests/deployment. Classified documentation authority; inventoried historical images/backups without elevating superseded structure. - Verified original repository identity and clean status at `2117236366130775214d9fd2611984d4348f2b79`. B and target revision are `3426236c6cfcece36e94642ae84d1843288f86d5`. - Recorded pre-existing modified `AGENT.md` and untracked `AGENTOldOutdated.md`; did not modify them. - Created preparation documentation only in `ImplementationPlan/`: plan, inventories, SHA-256 input manifest, approval questions, provisional conformance/functional registers and this log. - Identified .NET 10 requirement versus locally installed .NET 9, and unavailable default PostgreSQL socket. No application build/test/installer or live migration executed. No empirical energy claims. - Approval status: pending. Implementation commits: none. No application code copied or changed. Original inputs/source remain unchanged. After approval, each entry must record stage/story/ADR, reused source paths and original hash, changed files, necessary architectural reason, test adaptations and preserved assertions, executed commands/results, commit ID where applicable, remaining risks and approved deviations. ## 2026-10-14 — Approval and Stage 0 start Read authoritative approval completely. Q1–Q5 resolved; Q5 overrides Ubuntu-only proposal with portable distribution-aware systemd installation. Q3 requires preserving clinical classifications and thresholds, not silently replacing unsupported labels. Q4 excludes any A database access/import. Current B HEAD at approval: `20ab461c0194b3098504eabc96e9852a61356953`; pinned source unchanged/clean. No new architecture approval needed for authorized stages. ### Stage 0 checkpoint — passed - Downloaded official pinned .NET SDK 10.0.100 into `/tmp/healthapp-b-dotnet`; restored dependencies into `/tmp/healthapp-b-nuget`. - Git archive copied 142 tracked reference files to `Reference/ArchitectureA`; manifest hashes in `reference-files.json`. No original repository writes. - `dotnet build HealthApp.slnx -c Release --no-restore` in B-local reference: passed, zero warnings/errors. - `dotnet test HealthApp.slnx -c Release --no-build --logger trx`: 299 passed, 0 failed/skipped (Profile 29; Observation 236; Deployment 34). TRX evidence in `ImplementationPlan/evidence/baseline-trx/`. - Tests used a newly created disposable PostgreSQL 18.6 container, generated secret and random loopback port; removed after tests. No Architecture A database accessed. Container is test infrastructure only, not the application's native deployment. - Environment: Manjaro Linux x86_64, SDK 10.0.100; package/network/socket operations required sandbox escalation. Stage 0 establishes executable behavioural evidence, not clinical validity or native systemd proof. ### Stage 1 checkpoint — passed Single ASP.NET host, Contracts and Guidance projects; framework login/accounts/assignments and identical guidance content relocated. No business HTTP clients, service-key authentication or extra listeners. Original guidance suite: only host namespace changed; functional assertions unchanged, existing upstream traps still prove zero calls. Added framework login/generic failure/no-store/service-key rejection check. 10/10 cases passed; TRX `stage1-trx` records initial configuration timing failure followed by successful correction. Commit Stage 0: `cee98e7`. ### Stage 2 — Profile checkpoint Profile facade/owned schema/immutable DTOs; account unique/non-null, durable atomic insert and locked updates. Shared request transaction uses repeatable-read for reads and read-committed for locked writes. Runtime DB role restricted to DML, no runtime migration. Module-owned versioned SQL migration (applied twice) implements schema lifecycle; EF Core retains data access. Original create/update tests copied with namespace adaptation only; relative Location regression fixed in production controller, not assertions. Added concurrent create/retry/restart/persistent-ticket and runtime DDL-denial tests. 29/29 cases passed. Remaining all-endpoint authorization and Observation schema checks proceed with Stage 3. Stage 1 commit `523cfbf`. ### Stage 3 checkpoint — passed Observation module owns its private EF context/entities and versioned schema SQL; patient FK restricted, positive/category/rest checks, patient/time/original/UUID index. Typed Profile existence query inside write transaction. API resolves actual observation owner, authorizes, and uses owner-scoped read/locked patch/delete. Original patch application retained; omitted/clear semantics unchanged. Original US-04–09 suites run with one HTTP host/one DB and namespaces updated. Q1 lookup failure test uses DB outage and 503 instead of service stop/502; no-write assertion unchanged. Empty-404 regression fixed in production adapters. 138/138 tests passed including controlled two-patch row-lock barrier and orphan FK rejection; zero build warnings/errors. Private types exposed only to test assembly via InternalsVisibleTo. Stage 2 commit `bfe6ebf`. ### Stage 4 checkpoint — passed SummaryPolicy, TrendPolicy, ClinicalPolicy and Guidance-owned versioned ReferenceCatalog extracted without changing formulas/rounding/thresholds/labels/explanations. Analytics captures one immutable series and releases the shared snapshot before calculation. All original numerical/trend tests retained, with shared namespaces and explicit catalog constructor injection; HTTP dependency failure expectations alone changed 502→503 under Q1. 207/207 tests passed, zero build warnings/errors. `src/TRENDS.md` preserves reproducible method details; `clinical-provenance.md` records unverified cautious inferences and narrative limits without altering outputs. ### Stage 5 checkpoint — passed Overview composes typed Profile, Observation and Analytics queries; profile/latest/selected series share repeatable-read from authorization. Analytics releases capture before calculation. Deterministic interleaving commits Profile and Observation changes after Profile capture: in-flight overview stays old/coherent; next sees new values; selected query called once; transaction inactive before Analytics returns. All adopted Overview, patient and professional suites pass: 266/266 cases, zero warnings/errors. Ownership now checks route metadata before model validation to preserve denied empty-404 behaviour. Stage 4 commit `cab10c5`. ### Stage 6 checkpoint — passed Bounded pooled DB source, configurable health/assessment admission and deadlines, cancellation/rollback, release-before-result filter, sanitized dependency errors/no-store, authenticated liveness/readiness and fail-closed remote VerifyFull requirement. Deterministic locked-write deadline leaves profile unchanged; exhausted assessment budget returns 503+Retry-After while public guidance works; DB outage readiness is 503 while guidance/login remain usable. Restored original replacement-handler same-normalized-identity own/other assertions using real B profiles rather than obsolete HTTP stub. Fresh-schema context-default test retains all original value/text/Unknown assertions, with explicit synthetic associated patient for FK and no live migration. Module conformance checks pass. 276/276 tests passed; zero warnings/errors. Stage 5 commit `cc7f871`. Native deployment verification remains pending.