8000 feat(cbio): record a durable redacted GS1 evidence artifact (#156) by shroominic · Pull Request #189 · shroominic/OpenGlucose · GitHub
[go: up one dir, main page]

Skip to content

feat(cbio): record a durable redacted GS1 evidence artifact (#156) - #189

Closed
shroominic wants to merge 1 commit into
fix/cbio-device-harness-assertionsfrom
feature/cbio-gs1-evidence-artifact
Closed

shroominic wants to merge 1 commit into
fix/cbio-device-harness-assertionsfrom
feature/cbio-gs1-evidence-artifact

Conversation

@shroominic
Copy link
Copy Markdown
Owner

Closes #156.

A GS1 session left nothing behind: the harnesses printed lines, the app kept the
last 250 entries in memory, and the only durable record of a hardware run was
whatever a human had saved by hand.

Command

make cbio-gs1-evidence DEVICE_ID=<adb serial>
CBIO_EVIDENCE_LOG=<captured log> make cbio-gs1-evidence   # re-record, no device

HARNESS=, EVIDENCE_DIR=, CBIO_STREAM_SECONDS= and CBIO_APP_PACKAGE= are
optional. The default output directory is ../evidence next to the repository.

Artifact

One file per run, gs1-session-<utc>-<harness>.json, plus an INDEX.md row:
schema id, identity (harness path/revision, app package/revision, platform),
outcome, write counts per classified command kind, record counts plus first/last
index and raw value range, notification count, session timing, and counts per
closed error reason. unitStatus is always unverified.

cbioSessionEvidenceArtifactViolations rejects an artifact with a broken
schema, an unknown outcome/write kind/error reason, a record range or raw value
outside the observed envelope, a non-forward clock, a claimed unit, or an
identity leak (a Bluetooth address in colon or dash form, or a long hex run).
The model has no field that can hold an address or credential material, and the
harness never logs the authentication plaintext.

Stacked on #185 (the assertion-bearing harnesses) because this consumes their
CBIO-EVIDENCE line.

Verification

  • packages/cgm_cbio: dart analyze --fatal-infos clean, 67/67 tests pass
    (artifact validation and leak-path tests are new).
  • make cbio-gs1-evidence CBIO_EVIDENCE_LOG=<real device log> wrote artifacts
    into /Users/fungus/dev/openhealth/evidence/ from real Pixel 6 runs, and the
    command returned the harness's non-zero status after writing them.

A GS1 session left nothing behind: the harnesses printed lines, the app kept the
last 250 entries in memory, and the only durable record of a hardware run was a
screenshot someone saved by hand.

- `cbioSessionEvidenceArtifactViolations` validates a recorded artifact:
  schema shape, closed outcome/write/error vocabularies, record ranges inside
  the observed envelope, forward-moving timing, and identity redaction (no
  Bluetooth address, no long hex run).
- `packages/cgm_cbio/tool/record_gs1_evidence.dart` extracts the harness's
  CBIO-EVIDENCE line, validates it, and writes one artifact plus an INDEX.md
  row into the evidence directory.
- `make cbio-gs1-evidence DEVICE_ID=<serial>` runs one assertion-bearing
  harness on a device and records it; `CBIO_EVIDENCE_LOG=<file>` re-records an
  existing run without hardware. The command fails loudly after writing the
  artifact when the harness fails.
- docs/testing/cbio-gs1-evidence.md documents the command, the artifact, the
  redaction rules, and the safety envelope.
@shroominic
Copy link
Copy Markdown
Owner Author

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.

@shroominic shroominic closed this Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0