8000 fix(cbio): grant the device harness its BLE permissions in the evidence run by shroominic · Pull Request #202 · shroominic/OpenGlucose · GitHub
[go: up one dir, main page]

Skip to content

fix(cbio): grant the device harness its BLE permissions in the evidence run - #202

Closed
shroominic wants to merge 1 commit into
feature/cbio-gs1-evidence-artifactfrom
fix/cbio-gs1-evidence-permissions
Closed

shroominic wants to merge 1 commit into
feature/cbio-gs1-evidence-artifactfrom
fix/cbio-gs1-evidence-permissions

Conversation

@shroominic
Copy link
Copy Markdown
Owner

Closes #199.

flutter test -d <device> installs com.openglucose.app.debug for each run and uninstalls it again afterwards, so every GS1 evidence run starts from an app that has never been granted its runtime permissions. On an app without BLUETOOTH_SCAN a filtered scan returns nothing at all, and the app's own permission dialog parks the test until the testWidgets timeout — so the run ends with no verdict and no artifact.

Measured on the Pixel 6 on 2026-09-18: the run-1 install at 12:20 raised the LOCATION / NEARBY_DEVICES dialog, which was not answered until 12:41. Both morning runs died on TimeoutException after 0:08:00 without printing a single harness line, and the recorder reported no CBIO-EVIDENCE line ... the harness did not reach a verdict. With those four permissions granted the same harness completes a full authenticated session from a clean install in ~65 s.

scripts/cbio-gs1-evidence.sh now grants the harness app BLUETOOTH_SCAN, BLUETOOTH_CONNECT, ACCESS_FINE_LOCATION, and ACCESS_COARSE_LOCATION for the length of the run, re-applying them because each run reinstalls the app. adb is resolved from ANDROID_HOME when it is not on PATH, and a re-recorded log still needs no device. Nothing else on the device is read or changed.

Verified end to end from a state where the package was not installed at all:

make cbio-gs1-evidence DEVICE_ID=<serial>
-> evidence/gs1-session-20260918T055737-cbio_glucose_authenticated_test.json
   outcome=completed gattReleased=true notifications=126 glucose=1848 raw=1504
   writes=auth 1, clock 1, glucose 1, raw 1  errors=none  unitStatus=unverified

Stack position: this is the first of three; #200 and #201 stack on it.

…ce run

`flutter test -d <device>` installs the debug app for each run and uninstalls it
again afterwards, so every harness run starts from an app that has never been
granted its runtime permissions. On that app a scan filter reports no results at
all and a connect never completes, and the app's own permission dialog parks the
test until the 8-minute `testWidgets` timeout: the run ends with no verdict and
no artifact.

Observed on the Pixel 6 on 2026-09-18: after the run-1 install at 12:20 the
`GrantPermissionsViewModel` dialog for LOCATION and NEARBY_DEVICES was not
answered until 12:41, and both of that morning's runs died on the test timeout
without printing a single harness line. With the permissions granted the same
harness completes a full authenticated session, so this was the difference
between a silent timeout and a device session.

The run script now grants the harness app its four BLE permissions for the
length of the run. It touches nothing else on the device: no frame is written,
no sensor field is read, and the grants are re-applied because each run
reinstalls the app.

Refs #199
@shroominic
Copy link
Copy Markdown
Owner Author

Not absorbed by the GS1 consolidation (#209, feature/cbio-gs1). Left open on purpose: scripts/cbio-gs1-evidence.sh in the consolidated tree has no permission-granting path (no pm grant, no grant budget), so a device evidence run still starts on an app that has never been granted its BLE permissions. Owner: device-evidence lane.

@shroominic
Copy link
Copy Markdown
Owner Author

Carried into #209 (head be9b47a) as 2175407 — the same change, applied to the consolidated branch.

This is not cosmetic: flutter test -d <device> installs a fresh debug app per run and uninstalls it afterwards, so a run against an app that has never been granted its BLE permissions parks in the permission dialog until the testWidgets timeout and produces no verdict and no artifact. Without the grant loop and the ANDROID_HOME-resolved adb, nobody can reproduce the evidence artifacts from this branch, which breaks gate G11.

Closing as carried. Carrying PR: #209.

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