Skip to content

Compare two rings: a second ring, kept apart, side by side - #90

Merged
gabrielbr merged 1 commit into
mainfrom
ccr-67ccb970-dqwwqd
Nov 17, 2026
Merged

gabrielbr merged 1 commit into
mainfrom
ccr-67ccb970-dqwwqd

Conversation

@gabrielbr

Copy link
Copy Markdown
Owner

The owner wears a Colmi and a JRing to see which is more reliable. Their choice: compare only. The main ring keeps feeding the whole app, and the second ring appears only on a new Compare rings screen.

Keeping the second ring's data apart

  • RingBLEClient(role = COMPARISON):
    • its own connection slot, so the two rings never block each other;
    • its own saved ring (ring_ble_compare);
    • it publishes to the new ComparisonBus, not PulseEventBus. Persistence, the device row, the accuracy watcher, Health Connect, Strava and the sync coordinator never see it. Only its diagnostics cross over, marked [comparison ring].
  • RingCommandWriter.publish: drivers that published to PulseEventBus directly now go through it, and the comparison client overrides it. Those are YCBT history and out-of-band events, LuckRing history progress, Colmi's sync "done" and jring's workout log. Without this, a second ring of those families would have leaked into the main history.
  • comparison_readings (DB v38, migration 37→38): heart rate, SpO₂, HRV, steps and per-minute sleep, with ids per ring, kind and time so re-syncs update rows. Only the comparison screen reads it.

Behaviour

  • ComparisonRing (in AppServices) connects the second ring and runs its normal startup and history sync on each connect.
  • During a recorded workout it streams the second ring's heart rate too, and restarts that stream on reconnect.
  • "Stop comparing" forgets the ring without the vendor unbind, so it stays paired to its own app.

Screen

Settings → My ring → Compare rings (settings/compare):

  • Find a ring: a scan list that leaves out the main ring.
  • Rings card: each ring's role, name, line style, status and battery.
  • Per day:
    • both heart-rate curves (main solid coral, comparison dashed cyan);
    • each ring's average over time, and its hours with readings;
    • how close the rings were when both measured within 3 minutes;
    • steps and the night's sleep from each ring;
    • each workout: average, highest and minutes with readings, per ring.
  • Ground truth: it says neither ring is known to be right and links the accuracy check (for a watch).

Checks

  • Tests: new RingComparisonTest and ComparisonReadingsTest. Full suite: 2073 tests, the same 3 environment-only failures as main has in this container.
  • Renders: the cards were rendered on the JVM with Robolectric at 1.0× and 1.3× (local harness, not committed). Two fixes came from them: the column heads are now line swatches, since "Comparação" truncated, and each workout got its own title line.
  • Docs and audit: docs/ring-comparison.md, a new AGENTS.md section, and audits/2026-11-17-compare-rings.md.
  • Owed on hardware:
    • both rings connected at once;
    • the second ring's history arriving;
    • a workout with both streaming.
  • Not yet: the background sync worker syncs only the main ring.
  • Design canvas: not updated in this PR.

Generated by Claude Code

The owner wears a Colmi and a JRing to see which is more reliable, and
chose "compare only": the main ring keeps feeding the app.

- RingBLEClient gains a role. The comparison client has its own
  connection slot and saved ring, and publishes to ComparisonBus instead
  of PulseEventBus (only its diagnostics cross, marked).
- Drivers that publish on their own (YCBT, LuckRing, Colmi, jring) go
  through RingCommandWriter.publish, which the comparison client
  overrides, so no family can leak a second ring's data.
- comparison_readings (v38) holds its HR, SpO2, HRV, steps and per-minute
  sleep. Nothing but the comparison screen reads it.
- ComparisonRing (AppServices) connects it, runs its startup and history,
  and streams its heart rate during recorded workouts.
- Settings > My ring > Compare rings: find and pair the second ring;
  per day both heart-rate curves, time-weighted averages, hours with
  readings and how close the two were; steps and sleep; each workout
  ring against ring.

Docs: docs/ring-comparison.md, AGENTS.md. Audit:
audits/2026-11-17-compare-rings.md.

Claude-Session: https://claude.ai/code/session_01P1t1aUqSUPd3whKXmgVm7w
@gabrielbr
gabrielbr merged commit 8ac6fba into main Nov 17, 2026
1 check passed
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.

2 participants