Repository navigation
fix(session): bound automatic reconnect and stop retrying a refused credential - #182
Conversation
…edential API Merges fix/bounded-automatic-reconnect (#182). The branch forked at 17db5b4, so its session conflict re-introduced the compiled credential provider that #166 removed. Resolution keeps the aggregate's injected-credential API and ports only the new logic: - cbio_FailureAllowsAutomaticReconnect is added; the provider classes stay out. - The session's reconnect-allowed field, metadata marker, and _fail gate apply unchanged. - app_controller.dart and the persistence test are unions: the aggregate's sync-stage deadline tracking and the wedged-scan test both stay. No credential, address, or vendor material is added by this merge.
|
Rebase reminder (comment only, no edits to this branch). The lane head is now
Rebase onto |
c397761 to
70fa679
Compare
|
Rebased onto |
70fa679 to
e2f6c7a
Compare
e2f6c7a to
ae593e7
Compare
Closes #181.
The defect
_scheduleReconnectre-armed a flat_reconnectDelaywith no counter, and thecbio session published no terminal-failure marker, so the host could not tell
the two columns apart.
RED
Both runs are against
17db5b4, the base this branch forks.GREEN
Same two commands on this branch:
exit 0,+1: All tests passed!each.The fix
Host (
CgmAppController)_maxAutomaticReconnectAttempts = 5with doubling backoff - 3, 6, 12, 24,48 s on the default delay, about 93 s of trying - instead of 3 s repeated
without limit.
BleFailure(deviceDisconnected, connect, cgm.session.reconnectExhausted)plus
cgmAutoma 8000 ticReconnectAllowedMetadataKey: 'false'. That is the sameshape the existing recovery path already renders, so the connect screen
offers Try again / Choose another sensor with the existing copy:
"The sensor disconnected. Keep the phone close and try again."
_reconnectAttemptsresets only when the link reachesCgmSyncStage.ready- the same boundary the host already uses to promote averified selection. Resetting on any lower stage would count the
connectingsnapshot of each attempt as a success and make the budget unreachable.
Driver (
CbioGlucoseSession)cbioFailureAllowsAutomaticReconnect(code)names the codes that arereproduced byte for byte:
cbio.auth.material,cbio.auth.rejected,cbio.topology(a missing or unavailable notify/write characteristic - afirmware that does not present the GS1 link surface this build expects).
_failrecords that verdict and_emitpublishescgmAutomaticReconnectAllowedMetadataKey: 'false', the marker Libre 2 andYuwell already use. A timeout, a dropped link and a connection failure keep
the default retryable state.
Tests added
a sensor that keeps dropping exhausts the retry budget- twelve rounds ofdrop-and-reconnect stop at six connects, then assert the terminal stage, the
marker,
connectionRequiresUserAction, and the diagnostic code.a refused credential is not worth an automatic retry.a link that never came up stays worth a retry- the guard in the otherdirection, so the marker cannot become unconditional.
Verification
cd openhealth && flutter test- exit 0,+481: All tests passed!cd packages/cgm_cbio && flutter test- exit 0,+77: All tests passed!flutter analyze-No issues found!in both packagesdart formaton every line this branch adds - no changeFormatter note:
lib/src/app_controller.dart,test/app_controller_persistence_test.dartand
packages/cgm_cbio/test/cbio_glucose_session_test.dartalready carriedunrelated formatter drift at
17db5b4(verified against a clean archive of thebase commit). A whole-file
dart formatwould fold that drift into this defectPR, so only the added lines are required to be format-stable here; both
formatter lanes own the rest.