Files
HealthAppRepositoryB/ImplementationPlan/functional-equivalence.md
T

10 KiB
Raw Blame History

Functional preservation and verification plan

Prepared 2026-10-14. Architecture A baseline: 299 automated cases passed. Architecture B final solution: 283 cases passed, no failures/skips, plus actual native local/remote installation evidence. This establishes reference evidence, not clinical validation. This register records the implemented preservation and its verification limits. Acceptance register carries all 146 common/US-01–US-15 criterion IDs/outcomes from the target traceability table; outline cases are retained. Each entry now links concrete executed methods; theory expansions are recorded in TRX.

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.

Final outcomes

Release build/publish passed without warnings/errors. Functional/conformance suite: 276 passed; provisioning/adapter suite: 7 passed. Original source assertions remain, with architecture-dependent fixture/status replacements precisely recorded in test-adaptations.md. Both native Debian 12 local and verified-TLS remote placements passed representative workflows and independent app restart. Final command/artifact/hash evidence is in evidence/final-verification.json.

All 146 common/US-01–US-15 entries have concrete method mappings: 140 verified functional entries and 6 partially verified entries whose deterministic outputs/provenance pass but independent clinical support is not established. This distinction implements Q3; no clinical classification was silently disabled or changed. General narrative understanding, universal platform support, production/clinical certification, live historical import and strict byte-for-byte response equivalence are not claimed. Revised US-16 is verified at its approved app/database granularity on the identified native environment.

2026-10-20 operational correction

The owner superseded admission-generated 503s and the blanket deadline. The six adopted failure tests in HealthInsightTests, HealthTrendTests, HealthOverviewTests, RecordObservationTests, PatientAuthenticationTests and ProfessionalAccessTests now assert the original BadGateway (502), retaining no-write/no-false-absence checks. The two B-only tests that encoded deadline/rejection policy were replaced, not original A assertions: cancellation still rolls back writes; 5/26/40 held requests all enter and succeed; guidance/login remain available; a full provider pool waits and cancellation/recovery does not leak connections. Installer regression prevents reintroduction of these defaults. Results: 282 acceptance + 7 deployment cases. A copied old implementation fails the new five-request regression. Native HTTPS verified 639 successful requests across insights/trends/overview at 5, 26 and 40 concurrency, with obsolete installed keys retained to verify they are inert. Retired internal HTTP transport faults do not literally exist in B; the tests verify the preserved public contracts, not every possible environmental failure. The testserver still needs the newly published release deployed.