Skip to content

fix(statistics): query data streams by the roles the deployment actually streams under - #694

Open
Zeroupper wants to merge 2 commits into
testfrom
fix/data-stream-roles
Open

Zeroupper wants to merge 2 commits into
testfrom
fix/data-stream-roles

Conversation

@Zeroupper

Copy link
Copy Markdown
Collaborator

Why

Statistics cards resolved a data stream's device role by guessing the device type (Polar, Location Service, Health Service). The SDK keys each measurement by its task control's target device (SQLiteDataManager.onMeasurementtaskControl.destinationDeviceRoleName ?? phone), so a protocol running mobility/health on the phone, or a sensor with a custom role, was fetched from the wrong stream and backfill came back empty.

What

  • StatisticsViewModel.rolesFor(dataType) derives roles from deployment.expectedDataStreams — the same source the writer uses. _fetchInto fetches every role a type streams under and concatenates; any failure leaves the card untouched.
  • Removed ViewModel.roleOf and the per-card deviceRoleName guesses; HeartRateCardViewModel no longer takes a device type; DataStreamQueryService.fetch requires the role (no silent phone fallback).
  • carp_webservices → published ^4.4.0, git dependency override dropped.

Tests

  • New rolesFor test with a phone + custom-role Polar protocol (replaces the two role-guessing tests).
  • dart analyze clean, flutter test 110/110.

…lly streams under

Cards resolved a device role by guessing the device type (Polar, Location
Service, Health Service). The SDK keys each measurement by its task
control's target device, so a protocol running mobility/health on the
phone - or a sensor task with a custom role - was fetched from the wrong
stream and came back empty. Derive roles from deployment.expectedDataStreams
instead and fetch every role a data type streams under.

Also bump carp_webservices to the published 4.4.0 and drop the git override.
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