Repository navigation
fix(cbio): give the device harnesses a real verdict (#155) - #185
shroominic wants to merge 1 commit into
Conversation
The two device-backed GS1 harnesses printed evidence lines and asserted nothing, so a regression in the authenticated read path could only be caught by re-reading stdout. Both now build a CbioSessionEvidence record per run, assert its invariants, and fail loudly when the session does not reach its verdict. - New pure, host-tested model in packages/cgm_cbio: outcome, write-kind classification, closed error taxonomy, record counts/ranges, timing, and app/harness identity. It cannot carry an address, credential bytes, vendor material, or a physical unit. - Writes are classified before they are transmitted and must be inside each harness's allow-list, so an unlisted command cannot be sent unnoticed. - The query harness cross-checks its own 0A decode against the production parser and fails on a raw glucose disagreement. - `make test-e2e` now reports the deferral loudly and names every skipped device-backed harness instead of reporting a generic deferral.
395232e to
6ec7ff2
Compare
…lane Merges fix/cbio-device-harness-assertions (#185). The branch forked at 4702025, before the app-live lane's injected-credential adoption, so its harness files call the pre-redaction API. Resolutions: - packages/cgm_cbio/lib/cgm_cbio.dart: union of both exports. - scripts/flutter-workspace.sh: union. device_integration_files() keeps the aggregate's device lane; device_backed_harnesses() feeds the new test-e2e deferral report. - openhealth/integration_test/cbio_glucose_query_test.dart: take the branch's file. It is a strict superset of the aggregate's (formatting only). - openhealth/integration_test/cbio_glucose_authenticated_test.dart: take the branch's instrumented file and re-apply the aggregate's injected-credential boundary: _credentials from the environment/defines, a noted vendor_material_missing abort, and key:/material: arguments on every builder and unmask call.
|
Merge-order note for this stack, from the evidence lane (2026-09-18). #185 should land first, then #166 rebases onto it. Neither order is conflict-free —
Landing #185 first leaves #166 a mechanical re-application — add the guarded credential block, then thread the required One ordering constraint that does not depend on this: #166 removes a default parameter from If the security fix has to land sooner than #185 can be reviewed, #166 can go first — that is a deliberate trade of a larger rebase in #185 for earlier removal of the committed vendor material, not a correctness problem. |
|
Carried by the GS1 consolidation in PR #209 (branch feature/cbio-gs1, head 3eca4f4). This PR is contained in the consolidated line; the merge that carries it is c85f827. Closing as subsumed by the consolidation - not as won't fix. The per-defect evidence stays in this thread, and the carrying commit above is where the change now lives. |
Closes #155.
The two device-backed harnesses on this lane recorded evidence and asserted
nothing, so a regression in the authenticated read path could only be caught by
re-reading stdout. Both now produce a verdict.
What actually asserts
packages/cgm_cbio/lib/src/cbio_session_evidence.dartis a pure, host-testedrecord: outcome, per-kind write counts, record counts and index ranges, raw
value range, bounded timing, closed error taxonomy, and app/harness identity.
invariantViolations()is the verdict.Query harness (
cbio_glucose_query_test.dart):{device_information_read, glucose_read}; an unlisted frame fails before itis sent;
completed;0Aglucose batch;parseCbioGlucoseBatchfrom the production package, and a raw-value disagreement fails the run.
Authenticated harness (
cbio_glucose_authenticated_test.dart):{authentication, clock_set, glucose_read, raw_history_read};completed(no target, missing characteristics and a failedauthentication all produce a named non-completed outcome and a failure);
Both harnesses emit
CBIO-EVIDENCE <json>before the assertions run, so afailed session still leaves a machine-readable record behind. #156 consumes
that line into a durable artifact.
Deferral
make test-e2enow says the device lane was deferred, that nothing ran, andnames every skipped harness:
Verification
packages/cgm_cbio:dart analyze --fatal-infosclean, 66/66 tests pass(six new evidence tests).
openhealth:flutter analyze --no-pub --fatal-infosclean.dart format --output=none --set-exit-if-changed integration_testclean(this also clears the chore(cbio): format the lane integration harness #152 formatting drift in these two files).
make test-e2eprints the deferral above.Notes:
cbio_glucose_authenticated_test.dart(auth materialinjection). Whichever lands second needs a small reconciliation there.
cbio_live_capture_test 8000 .dartalready had six assertions and is unchanged.