8000 Prepare OpenGlucose 0.1 stable release by shroominic · Pull Request #50 · shroominic/OpenGlucose · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ expectations are defined in [docs/compatibility.md](docs/compatibility.md).

## [Unreleased]

## [0.1.2] - 2026-08-15

### Changed

- During the sensor's initial 60-minute warmup, the dashboard now hides
Expand All @@ -19,6 +21,10 @@ expectations are defined in [docs/compatibility.md](docs/compatibility.md).

### Fixed

- Android sensor setup now stops active Bluetooth scanning before every
connection attempt, refreshes already-paired GATT sessions before discovery,
and avoids an unused Service Changed subscription that could interrupt setup
on stricter Android Bluetooth stacks.
- Android live notifications and iOS Live Activities can again show ongoing
post-warmup glucose updates after the user explicitly opts in from current
sensor settings; the default remains redacted and disabling fails closed.
Expand Down Expand Up @@ -127,7 +133,8 @@ The historical Git tag is named `v0.0.1+10`, while the tagged
`openhealth/pubspec.yaml` declares `version: 0.0.1+9`. The tag is retained as
published history; do not infer an app artifact build number of 10 from the tag.

[Unreleased]: https://github.com/shroominic/OpenGlucose/compare/v0.1.1...HEAD
[Unreleased]: https://github.com/shroominic/OpenGlucose/compare/v0.1.2...HEAD
[0.1.2]: https://github.com/shroominic/OpenGlucose/releases/tag/v0.1.2
[0.1.1]: https://github.com/shroominic/OpenGlucose/releases/tag/v0.1.1
[0.1.0]: https://github.com/shroominic/OpenGlucose/releases/tag/v0.1.0
[0.0.1+10]: https://github.com/shroominic/OpenGlucose/releases/tag/v0.0.1%2B10
32 changes: 32 additions & 0 deletions docs/release-notes/v0.1.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# OpenGlucose 0.1

OpenGlucose 0.1 is the first stable 0.1 release of the local-first CGM wellness
app for Android and iPhone.

## What's new

- More reliable Android sensor setup, including phones that require pairing or
a fresh Bluetooth connection before service discovery.
- A clearer 60-minute sensor warmup experience. Early warmup values stay out
of the dashboard, wellness summaries, Apple Health, and live glucose
surfaces.
- Warmup countdowns in Android notifications and iOS Live Activities.
- Optional post-warmup glucose values in live notifications and Live
Activities. Sensitive values remain hidden by default.
- Clearer Bluetooth-off, scan, pairing, range, and disconnect recovery without
exposing native error details.
- Safer retry behavior that does not automatically unpair or reset an active
sensor.

## Pairing note

An AiDEX transmitter can be paired to only one phone at a time. Keep other
phones and the official sensor app disconnected while moving an active sensor
to OpenGlucose. Do not unpair or reset a working sensor unless a reviewed
recovery procedure specifically asks for it.

OpenGlucose is wellness/reference software, not a medical device. Do not use it
for diagnosis, medication or insulin dosing, treatment decisions, or emergency
monitoring.

App version: `0.1.2` (build `22`)
6 changes: 3 additions & 3 deletions openhealth/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ TESTFLIGHT_GROUP="External Testers"
# so concurrent official runs contend on one claim. A lone attempt is an
# incident: preserve it and cut a new build number. Notify-only mode requires
# both mode-400 records and revalidates their exact binding.
TESTFLIGHT_UPLOAD_PROVENANCE_PATH="/secure/openglucose/releases/0.1.1+19-upload-provenance.json"
TESTFLIGHT_UPLOAD_PROVENANCE_PATH="/secure/openglucose/releases/0.1.2+22-upload-provenance.json"

# Durable one-shot claim and receipt for the exact build notification. Create
# its parent directory with mode 700 outside the repository. The lane writes a
# pending claim before the request and atomically marks it complete only after a
# confirmed response. Never run concurrently or retry a pending claim.
TESTFLIGHT_NOTIFICATION_RECEIPT_PATH="/secure/openglucose/releases/0.1.1+19-notification.json"
TESTFLIGHT_NOTIFICATION_RECEIPT_PATH="/secure/openglucose/releases/0.1.2+22-notification.json"

# Immutable source identity; both values must match the clean worktree.
RELEASE_VERSION="0.1.1+19"
RELEASE_VERSION="0.1.2+22"
RELEASE_COMMIT="full-40-character-git-commit"

# Release approval and audience gates are fail-closed. External mode requires
Expand Down
37 changes: 31 additions & 6 deletions openhealth/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import 'package:openglucose/src/session_presentation.dart';
import 'package:openglucose/src/weekly_recap/weekly_recap_screen.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:intl/intl.dart';
import 'package:share_plus/share_plus.dart';
import 'package:shared_preferences/shared_preferences.dart';
Expand Down Expand Up @@ -661,9 +662,7 @@ class _ScanView extends StatelessWidget {
if (controller.sensors.isNotEmpty &&
!controller.scanning &&
controller.scanFailure != null)
SliverToBoxAdapter(
child: _ScanFailureBanner(controller: controller),
),
SliverToBoxAdapter(child: _ScanFailureBanner(controller: controller)),
if (controller.sensors.isEmpty &&
!controller.scanning &&
controller.scanFailure != null)
Expand Down Expand Up @@ -1242,6 +1241,16 @@ class _DashboardHeroCard extends StatefulWidget {
class _DashboardHeroCardState extends State<_DashboardHeroCard> {
Timer? _ticker;

Future<void> _copySupportCode(String supportCode) async {
await Clipboard.setData(ClipboardData(text: supportCode));
if (!mounted) {
return;
}
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('Support code copied')));
}

@override
void initState() {
super.initState();
Expand All @@ -1268,6 +1277,10 @@ class _DashboardHeroCardState extends State<_DashboardHeroCard> {
final latest = widget.controller.displayLatestReading;
final warmup = computeWarmupStatus(snapshot, latestReading: latest);
final primaryError = primaryErrorTextForSnapshot(snapshot);
final privateSupportCode =
kOgPrivateSupport && shouldOfferPrivateBleSupportCode(snapshot)
? privateBleSupportCodeForSnapshot(snapshot)
: null;

final String bigValue;
final String unitLabel;
Expand Down Expand Up @@ -1388,6 +1401,20 @@ class _DashboardHeroCardState extends State<_DashboardHeroCard> {
),
],
],
if (privateSupportCode != null) ...<Widget>[
const SizedBox(height: 12),
OutlinedButton.icon(
key: const ValueKey<String>('copyBleSupportCodeButton'),
onPressed: () =>
unawaited(_copySupportCode(privateSupportCode)),
style: OutlinedButton.styleFrom(
foregroundColor: const Color(0xFFD6ECE7),
side: const BorderSide(color: Color(0xFF9CC9C1)),
),
icon: const Icon(Icons.copy_rounded),
label: const Text('Copy support code'),
),
],
],
),
),
Expand Down Expand Up @@ -2193,9 +2220,7 @@ Future<ArchivedSensorExportFormat?> _chooseArchivedSensorExportFormat(
'${hiddenWarmupCount == 1 ? 'reading is' : 'readings are'} '
'included for a complete export. These remain hidden from '
'charts, recaps, and Apple Health.',
key: const ValueKey<String>(
'archivedExportWarmupDisclosure',
),
key: const ValueKey<String>('archivedExportWarmupDisclosure'),
),
],
const SizedBox(height: 4),
Expand Down
45 changes: 45 additions & 0 deletions openhealth/lib/src/session_presentation.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cgm_aidex/cgm_aidex.dart';
import 'package:cgm_ble/cgm_ble.dart';
import 'package:cgm_core/cgm_core.dart';
import 'package:intl/intl.dart';
Expand Down Expand Up @@ -411,6 +412,50 @@ String? primaryErrorTextForSnapshot(CgmSessionSnapshot snapshot) {
: userMessageForBleFailure(bleFailure);
}

/// Compile-time gate for privacy-safe support codes in explicitly marked
/// private test builds. Normal release builds compile this to false.
const bool kOgPrivateSupport = bool.fromEnvironment(
'OG_PRIVATE_SUPPORT',
defaultValue: false,
);

/// Returns a copyable, identifier-free setup code for a known AiDEX phase.
///
/// No general snapshot metadata is copied. BLE fields come exclusively from
/// [BleFailure.fromMetadata], which rejects unknown enum values and sanitizes
/// diagnostic codes before returning them.
String? privateBleSupportCodeForSnapshot(CgmSessionSnapshot snapshot) {
final phase = snapshot.metadata[aidexSetupPhaseMetadataKey];
if (phase == null || !AidexSetupPhase.values.contains(phase)) {
return null;
}
final fields = <String>['OGSUP1', 'phase=$phase'];
final failure = BleFailure.fromMetadata(snapshot.metadata);
if (failure != null) {
fields
..add('op=${failure.operation.name}')
..add('kind=${failure.kind.name}')
..add('code=${failure.diagnosticCode}');
}
return fields.join(' ');
}

bool shouldOfferPrivateBleSupportCode(CgmSessionSnapshot snapshot) {
if (privateBleSupportCodeForSnapshot(snapshot) == null) {
return false;
}
return switch (snapshot.stage) {
CgmSyncStage.connecting ||
CgmSyncStage.bonding ||
CgmSyncStage.pairing ||
CgmSyncStage.activating ||
CgmSyncStage.syncing ||
CgmSyncStage.error ||
CgmSyncStage.disconnected => true,
CgmSyncStage.scanning || CgmSyncStage.ready => false,
};
}

String? userMessageForBleError(Object error) {
return error is BleFailure ? userMessageForBleFailure(error) : null;
}
Expand Down
2 changes: 1 addition & 1 deletion openhealth/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: openglucose
description: Your Open-source health and wellness app focused on local data and privacy.
publish_to: none
version: 0.1.1+19
version: 0.1.2+22

environment:
sdk: ^3.11.4
Expand Down
132 changes: 124 additions & 8 deletions openhealth/test/session_presentation_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cgm_aidex/cgm_aidex.dart';
import 'package:cgm_ble/cgm_ble.dart';
import 'package:cgm_core/cgm_core.dart';
import 'package:openglucose/src/session_presentation.dart';
Expand Down Expand Up @@ -123,6 +124,123 @@ void main() {
});
});

group('private BLE support code', () {
test('contains only the closed phase and sanitized BLE failure', () {
final failure = BleFailure(
kind: BleFailureKind.deviceDisconnected,
operation: BleOperation.connect,
diagnosticCode: 'aidex.connection.disconnected',
);
final snapshot = CgmSessionSnapshot(
stage: CgmSyncStage.error,
statusText: 'Error',
sensor: sensor,
capabilities: sensor.capabilities,
metadata: <String, String>{
aidexSetupPhaseMetadataKey: AidexSetupPhase.discovery,
...failure.toMetadata(),
'deviceId': 'AA:BB:CC:DD:EE:FF',
'serial': 'PRIVATE-SERIAL',
'nativeError': 'secret native text',
'rawHex': 'deadbeef',
'reading': '112',
'timestamp': '2026-08-15T12:34:56Z',
},
lastError: 'secret error text',
);

final code = privateBleSupportCodeForSnapshot(snapshot);

expect(
code,
'OGSUP1 phase=P04 op=connect kind=deviceDisconnected '
'code=aidex.connection.disconnected',
);
expect(
code,
isNot(
anyOf(
contains('AA:BB'),
contains('PRIVATE-SERIAL'),
contains('secret'),
contains('deadbeef'),
contains('112'),
contains('2026-08-15'),
),
),
);
expect(shouldOfferPrivateBleSupportCode(snapshot), isTrue);
});

test('connecting code contains a phase without invented failure data', () {
final snapshot = CgmSessionSnapshot(
stage: CgmSyncStage.connecting,
statusText: 'Connecting',
sensor: sensor,
capabilities: sensor.capabilities,
metadata: const <String, String>{
aidexSetupPhaseMetadataKey: AidexSetupPhase.connect,
},
);

expect(privateBleSupportCodeForSnapshot(snapshot), 'OGSUP1 phase=P01');
expect(shouldOfferPrivateBleSupportCode(snapshot), isTrue);
});

test('malformed phase is rejected rather than copied', () {
final snapshot = CgmSessionSnapshot(
stage: CgmSyncStage.error,
statusText: 'Error',
sensor: sensor,
capabilities: sensor.capabilities,
metadata: const <String, String>{
aidexSetupPhaseMetadataKey: 'P04 device=AA:BB:CC:DD:EE:FF',
},
lastError: 'Failed',
);

expect(privateBleSupportCodeForSnapshot(snapshot), isNull);
expect(shouldOfferPrivateBleSupportCode(snapshot), isFalse);
});

test('malformed BLE diagnostic is redacted by BleFailure parser', () {
final snapshot = CgmSessionSnapshot(
stage: CgmSyncStage.error,
statusText: 'Error',
sensor: sensor,
capabilities: sensor.capabilities,
metadata: const <String, String>{
aidexSetupPhaseMetadataKey: AidexSetupPhase.subscribe,
bleFailureKindMetadataKey: 'bondRejected',
bleFailureOperationMetadataKey: 'subscribe',
bleFailureDiagnosticCodeMetadataKey:
'native failure AA:BB:CC:DD:EE:FF',
},
lastError: 'Failed',
);

expect(
privateBleSupportCodeForSnapshot(snapshot),
'OGSUP1 phase=P05 op=subscribe kind=bondRejected '
'code=ble.redacted',
);
});

test('ready sessions never offer a copy action', () {
final snapshot = CgmSessionSnapshot(
stage: CgmSyncStage.ready,
statusText: 'Connected',
sensor: sensor,
capabilities: sensor.capabilities,
metadata: const <String, String>{
aidexSetupPhaseMetadataKey: AidexSetupPhase.finalization,
},
);

expect(shouldOfferPrivateBleSupportCode(snapshot), isFalse);
});
});

group('computeWarmupStatus', () {
CgmSessionSnapshot snapshotWith({
DateTime? sessionStart,
Expand Down Expand Up @@ -288,10 +406,7 @@ void main() {
source: CgmRecordSource.standard,
recordedAt: sessionStart.add(const Duration(minutes: 60)),
),
const CgmReading(
valueMgdl: 106,
source: CgmRecordSource.standard,
),
const CgmReading(valueMgdl: 106, source: CgmRecordSource.standard),
];

final visible = readingsAfterWarmup(
Expand All @@ -300,10 +415,11 @@ void main() {
warmupMinutes: 60,
);

expect(
visible.map((reading) => reading.valueMgdl),
<double>[103, 105, 106],
);
expect(visible.map((reading) => reading.valueMgdl), <double>[
103,
105,
106,
]);
});
});

Expand Down
Loading
0