42 lines
8.1 KiB
Markdown
42 lines
8.1 KiB
Markdown
# Functional preservation and verification plan
|
||
|
||
Prepared 2026-10-14. **Architecture A baseline: 299 automated cases passed in the B-local reference. Architecture B behaviour remains not verified until its adapted tests run.** This establishes reference evidence, not clinical validation. This register is a preservation plan. [Acceptance register](acceptance-register.md) carries all 146 common/US-01–US-15 criterion IDs/outcomes from the target traceability table; outline cases are retained. During implementation map each entry to exact executable test methods, expanded examples and results.
|
||
|
||
| Requirement | Original suites / evidence | Preserve and verify |
|
||
| --- | --- | --- |
|
||
| Common | History, context-filtered history, insight, trend and overview tests | Inclusive/equal/reversed periods for all four operations; UTC offset-free semantics independent of machine timezone; AND/Unknown selections; complete history; role/ownership restrictions across all operations |
|
||
| US-01 | `CreatePatientTests`, `PatientAuthenticationTests` | Required fields, generated distinct IDs, trusted account, initial/duplicate/retry/concurrent creation, interrupted rollback, durable unique association and `/me` recovery |
|
||
| US-02 | `CreatePatientTests`, professional access tests | Saved ID/name/birth/contact; permitted missing-data and non-disclosing unauthorized result |
|
||
| US-03 | `UpdatePatientTests` | Correct contact/name, preserve ID/birth/association/original time, no insertion for missing row, atomic rejection and restart |
|
||
| US-04 | `RecordObservationTests`, `RecordMeasurementContextTests` | Timestamp/positive values, existing authorized profile, IDs/restart, full/partial/absent context, valid after-activity, invalid category rejection, original narrative preservation |
|
||
| US-05 | `ViewObservationContextTests`, recording/auth/professional tests | Actual owner and complete current saved context/values/timestamp; Unknown and historical prose; missing/forbidden without disclosure |
|
||
| US-06 | `LatestObservationTests` | Measurement/original-recording/greatest UUID-byte precedence, immutable original time after edit, current context, no substitution for suitability and no-observation result |
|
||
| US-07 | `ObservationHistoryTests`, `ContextFilteredHistoryTests` | Ascending patient-only inclusive history; independent/combined/Unknown selections and applied headers; empty array; invalid periods/categories; restart |
|
||
| US-08 | `UpdateObservationTests`, `PatchObservationTests` | Full numerical PUT and partial PATCH; omitted/set/null/clear distinction, preserved identity/time/unmentioned fields; empty/unsupported/invalid input atomically rejected; current selection membership |
|
||
| US-09 | `DeleteObservationTests`, `DeleteContextualisedObservationTests` | 204 success, missing/repeated 404, row/context removal from all later reads/results, unaffected other observations/profile; denied deletion no writes |
|
||
| US-10 | `HealthInsightTests`, `ContextSelectedInsightTests` | Exact decimal means/final half-up/no intermediate rounding, BP extrema, one/zero results, count/basis/context explanations, current corrections/deletions and selection/period/patient scope |
|
||
| US-11 | `HealthTrendTests` | Three distinct metric/unit results; unchanged full-period formula, equal-time grouping, reversals/raw excursions, insufficiency and order independence; current selection/data/context; reviewed metric-specific reference/claims and narrative limits |
|
||
| US-12 | `HealthOverviewTests` | Profile plus latest overall plus selected-period insight only; separate bases/context/count/absence explanations; nullable parts and no trend; current data/authorization; coherent target snapshot |
|
||
| US-13 | `PatientAuthenticationTests`, `AuthenticationIntegrationTests` | Generic credential failures, no-profile login/create, all endpoint authentication/access failures, expiry/tampering/restart, caller identity spoof rejection and normalized replacement provider |
|
||
| US-14 | `ProfessionalAccessTests`, story-specific professional cases | Many-to-many predefined assignments, own empty/populated list, assigned reads and missing data, unassigned denial, every write forbidden, patient professional-only denial; fresh configuration after restart |
|
||
| US-15 | `MeasurementGuidanceTests`, record tests | Public sourced ordered existing guidance, home applicability/unknown label, clinic/other unavailable, pulse/context limits, no writes/certification/submission gate, DB-independent public endpoint |
|
||
| Revised US-16 | `InstallationTests`, `BootstrapTests`; proposal revision | Approval needed for changed topology. New app PID/unit/HTTPS/config/DB/roles/dependency install/certificate trust/no-overwrite and stop/restart/workflow proof; remote verified DB TLS, no local PostgreSQL installation |
|
||
|
||
## Test preservation and adaptation rules
|
||
|
||
Preserve unchanged original tests as pinned baseline evidence in B after approval; do not execute them from the source repository. In final test projects replace only architecture-dependent fixture/wiring and explicitly approved topology/status assertions. Fixture uses one real HTTP application host and isolated PostgreSQL database with both module-owned schemas. Independent response contracts, functional assertions and failure/no-write intent remain. Test internals may seed state through explicitly scoped test support without exporting production repositories.
|
||
|
||
Original fixtures create random separate databases, migrate twice, start Kestrel hosts and support stopping individual services. Their service-stop, direct-backend/service-key and five-unit assertions cannot apply literally to B. Record replacements per method: internal key/header bypass tests become rejection of forged identity headers and absence of internal routes; upstream-stop tests become DB/transaction/deadline failure injection with non-disclosure/no-write/no-false-absence; independent feature installation tests become approved single-app/local-or-remote DB verification. These changes need Q1 approval and must not be hidden as ordinary rewiring.
|
||
|
||
Baseline schema-upgrade context tests become explicit old-row/snapshot migration tests: preserve unknown defaults and legacy text, do not infer categories. Legacy profiles with null accounts cannot be automatically inserted into the stricter target; Q4 determines import scope/mapping. Preserve baseline deployment assertions as historical evidence even where target supersedes them.
|
||
|
||
Additional necessary architecture checks: transaction/owner consistency, concurrent disjoint and same-field patches, rollback and ambiguous commit, selected series captured once, transaction closed before computation/JSON, controlled FK/check constraints, runtime DDL denial, private module persistence/dependencies, protected response caching/log redaction, public guidance during DB outage, persistent tokens across restart, bounded pool/admission/deadlines and full untruncated results. Prefer deterministic interleaving/barriers over timing-dependent concurrency tests.
|
||
|
||
## Verification execution and limits
|
||
|
||
Run isolated baseline reference tests first after SDK/DB provisioning, then affected suites at each stage and full Release build/tests/publish at completion. Store command, environment prerequisites, expanded test counts, failures and reasoned coverage for each criterion. Native deployment on the supported Linux host and verified remote PostgreSQL is separate evidence from loopback process tests or mocked package managers. No test PostgreSQL administrator connection is assumed available; never use a production DB.
|
||
|
||
Clinical reference/content review is separate from numerical/API tests; a passing string assertion does not prove clinical support. Existing sources/review dates are provenance, not a new review performed here. Finite conflict detection does not prove arbitrary text comprehension. Seek approval before necessary clinical classification changes. No source behavioural mismatch is silently accepted over authoritative requirements.
|
||
|
||
Final outcome classifications: **verified** (executed supporting checks and criterion assertions), **partially verified** (some evidence but explicit gaps, such as native/clinical review), **not verified** (unexecuted/no adequate evidence). No current test-pass, deployment-pass, strict-equivalence or energy-efficiency claim.
|