Skip to content

Sync upstream Trio dev 1.0.2.79 into Tai/dev - #46

Merged
mountrcg merged 196 commits into
devfrom
sync/trio-2026-11-20
Nov 20, 2026
Merged

mountrcg merged 196 commits into
devfrom
sync/trio-2026-11-20

Conversation

@mountrcg

@mountrcg mountrcg commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Brings Tai dev up to upstream nightscout/Trio dev at d37fe347e (1.0.2.79) — a 191-commit delta over 16 commits on the upstream dev line (8 functional commits/merges + 8 CI build-counter bumps) since the last sync base 3f6b238b4 (1.0.2.71, PR #44). The merge lands as 60 files changed, +3 570 / −1 106 on top of Tai dev.

Upstream's feat/profiles subsystem (PRs #1763–#1766, merged upstream as #1788) is deliberately excluded from this sync — details below.

Branch commits: f1e91a29e (sync(trio): merge upstream/dev at d37fe347e), 96a3cdda3 (Revert "Merge pull request #1788 from nightscout/feat/profiles"), a29a6dfb3 (sync(trio): restore Tai fork additions after excluding feat/profiles), 64574cfc4 (fix(sync): cover Tai CSF units in TherapySchedulePDFContent switch) and 35454bc4d (fix(sync): use upstream pump availability signal in home header) — the two compile fixes found by review. Current head is 35454bc4d, build-for-testing green. Merge base c9d309b02; working tree clean; no submodule or .gitmodules change.

What changed

Statistics PDF report export (#1777)

The Statistics screen gained a full multi-page report builder (StatExportMenuView, StatPDFExporter, StatPDFReportView, ReportChartType) with per-page selection and report presets (ExportSetup, ReportPresetSetup). Pages: glucose distribution by day, glucose percentile by day (plus the existing GRI view), insulin bolus, insulin TDD, meals, and a therapy-schedule page with the basal total. The export header shows the device's marketing name (UIDevice+Extensions) instead of the raw model identifier, and the menu has a help sheet. Chart math was factored into StatChartUtils; about 345 lines of new localization strings.

Watch: one compact glucose trace instead of a synced history (#1598)

The watch no longer syncs a glucose-history snapshot — WatchStateSnapshot.swift is gone on both sides (Trio/Sources/Models/, Trio Watch App Extension/) and WatchState was rewritten around a single request/push cycle: one request in flight, a fixed push window, and a compact trace that carries the phone's own values and colours (the phone computes them with its getDynamicGlucoseColor). A CGM gap only dates the BG bubble instead of blanking the trace, and a request from an older watch app build is still answered. AppleWatchManager follows the new payload shape.

Watch: bolus confirmation crown hint (#1783)

The bolus-confirmation crown hint arrow points by crown side rather than by wrist, with watch unit tests covering both orientations.

APSManager cleanup and removal of the old statistics pipeline (#1681)

APSManager loses unused APS state, injected services and pump helpers (−457 / +3 lines against Tai's previous file). The old statistics reporting pipeline is removed outright: Statistics.swift, Loops.swift, the StatsData Core Data entity pair, their NSPredicates helpers, and the statistics reporting in APSManager/DeviceDataManager. Tai has no callers left (verified), and the new Statistics export module above does not use that pipeline. CoreDataStack gains a separated content-change publisher, which GarminManager follows.

Smaller fixes

  • DevelopmentBranchAlerter no longer publishes changes from within view updates (#1779): @Observable + @ObservationIgnored + a ViewModifier-driven alert; Tai's branding strings are kept.
  • TrioApp.resolver is static, so a second TrioApp instance is no longer created (#1781).
  • CI consolidated into a single non-fork workflow (#1773): new .github/workflows/upstream_automation.yml; unit_tests.yml trimmed; action versions bumped in add_to_project.yml and stale_issues.yml. auto_version_dev.yml stays deleted on Tai.

Upstream commits

Functional (upstream dev line):

  • 490de75a7 — Migrate non-fork build GitHub action jobs into a single workflow (#1773)
  • f096d9739 — Statistics PDF export (#1777)
  • 3adbc238e — Fix "Publishing changes from within view updates" warning (#1779)
  • 927c22b7a — Watch: send one compact glucose trace instead of syncing a history (#1598)
  • d2c7f3186 — Watch: bolus confirmation crown hint by crown side (#1783)
  • de0f7f1f9 — feat/profiles (#1788) — excluded, see below
  • 5587e4b35 — Use static TrioApp.resolver instead of creating a new TrioApp (#1781)
  • b9fcb5434 — Remove unused APS state, injected services and pump helpers; remove the unused statistics reporting pipeline and StatsData entity (#1681)

Version bumps (build counter only, applied manually instead of cherry-picking): ad6c66876 (1.0.2.72), 102bf772a (1.0.2.73), 4a9fdecff (1.0.2.74), e6a9259e2 (1.0.2.75), 7e2fa52cb (1.0.2.76), e11a823e7 (1.0.2.77), 1bbf79dfd (1.0.2.78), d37fe347e (1.0.2.79).

What Tai keeps

  • autoISF end to end: upstream's cleaned APSManager was taken, then Tai's fork patch was re-applied on top — enactManualTempBasal(rate:duration:), the settings/preferences accessors, adjustPumpedVolumeToConcentration(_:) and adjustPumpedRateToConcentration(_:). Nothing referencing the removed StatsData/Statistics pipeline came back.
  • Tai's therapy-profile system, unchanged: AdaptProfile, ProfileScheduler, ProfileScheduleFirer, ActiveProfileMirror, the App Intents (ApplyProfileIntent, CreateCustomTempTargetIntent, ScheduleCustomTempTargetIntent, ScheduleProfileOnceIntent, ScheduleTempPresetIntent), the SettingsScope write rules and all four therapy editors editing live settings.
  • Garmin watch support (GarminManager, GarminCommandRouter and tests).
  • Tai branding: APP_DISPLAY_NAME = Tai, BUNDLE_IDENTIFIER = org.nightscout.$(DEVELOPMENT_TEAM).tai, COPYRIGHT_NOTICE = autoISF 3.01, RELEASE_NOTES_REPO = mountrcg/Tai, APP_URL_SCHEME = Trio, the app-group lines and both ConfigOverride.xcconfig includes.
  • Testflight/ stays as is (only WhatToTest.en-CA.txt changes, by design).
  • Submodule pins and .gitmodules untouched — the range contains no gitlink change.
  • .github/workflows/auto_version_dev.yml stays deleted (Tai removes it deliberately).

What is excluded

Upstream feat/profiles — not in this sync (option C)

Upstream merged the therapy-profile feature into dev inside the single merge de0f7f1f9 (PRs #1763 Core Data storage, #1764 switching/editing, #1765 Nightscout upload, #1766 remote commands, rolled up as #1788). Because it all arrives through one merge commit, it is excluded with one git revert -m 1 de0f7f1f9 — deterministic, no per-file hand-reversion:

  • 35 files deleted: Modules/TherapyProfiles/* (7), Services/TherapyProfiles/{TherapyProfileManager,TherapyProfileValidator}, APS/Storage/TherapyProfileStorage.swift, Services/RemoteControl/TrioRemoteControl+Profile.swift, Models/{TherapyProfile,CompactTherapyProfile,ScheduledProfileSwitch}.swift, the 8 *Stored+CoreData{Class,Properties} pairs and Model/Helper/TherapyProfileStored+helper.swift, plus 12 profile test files (TrioTests/TherapyProfileTests/*, TrioTests/CoreDataTests/TherapyProfileStorageTests.swift).
  • 4 Core Data entities removed from TrioCoreDataPersistentContainer.xcdatamodel/contents: TherapyProfileStored, TherapyProfileEntryStored, TherapyProfileSwitchStored, ScheduledProfileSwitchStored. StatsData is not restored (upstream removed it in #1681 and Tai accepts that).
  • Nightscout multi-profile upload/import undone (NightscoutManager, NightscoutAPI, NightscoutUploadPipeline, onboarding import); SettingItems has no route to TherapyProfiles.
  • The four therapy editors keep Tai's behaviour — live settings through SettingsScope, not "the active therapy profile".

Reason: profiles are analysis-only for Tai at the moment. They will be ported as their own feature card, not smuggled in through a sync.

Note on two similarly named files: Modules/Stat/View/ViewElements/Export/Charts/TherapySchedulePDFContent.swift and Modules/Onboarding/View/TherapyProfileChart.swift come from #1777 and are not part of the profile subsystem — they read live settings, and the profile merge's net effect on them was zero, so they stay.

Upstream feat/tandem

Not in this range (feat/tandem is a separate branch, upstream head 888326d9e, not part of dev). Tracked as its own ticket.

Conflict resolutions

13 merge conflicts (items 1–11), 8 revert conflicts (items 12–13), plus the two binding canon edits (items 14–15).

  1. .github/workflows/auto_version_dev.yml (modify/delete) — stays deleted.
  2. Trio.xcodeproj/project.pbxproj — upstream's file set was taken, then the fork file set was reconciled as a 3-way merge (base 3f6b238b4, ours Tai dev, theirs profile-free upstream): 4 hunks, upstream's re-sorted Models group, and the Statistics/Loops/StatsData/WatchStateSnapshot entries dropped. All 118 Tai-only files plus Tai resources are referenced again; 0 dangling object IDs.
  3. Trio/Sources/APS/APSManager.swift — upstream's cleaned version (its cleanup must survive), then Tai's autoISF/concentration patch re-applied in the reconciliation commit.
  4. Trio/Sources/Assemblies/ServiceAssembly.swift — Tai kept.
  5. Modules/BasalProfileEditor/{BasalProfileEditorProvider,BasalProfileEditorStateModel,View/BasalProfileEditorRootView}.swift — Tai kept.
  6. Modules/CarbRatioEditor/View/CarbRatioEditorRootView.swift — Tai kept.
  7. Modules/ISFEditor/View/ISFEditorRootView.swift — Tai kept.
  8. Modules/TargetsEditor/View/TargetsEditorRootView.swift — Tai kept.
  9. Modules/Home/View/HomeRootView.swift — Tai kept.
  10. Modules/Settings/SettingItems.swift — Tai kept.
  11. Services/DevelopmentBranchAlerter/DevelopmentBranchAlerter.swift — upstream's @Observable/ViewModifier implementation with Tai's strings ("This is the development version of Tai, …", "Hey Tai user, watch out!").
  12. TrioCoreDataPersistentContainer.xcdatamodel/contents (revert conflict) — the 4 profile entities removed, nothing else added.
  13. Localizable.xcstrings — auto-merged on upstream's side, never hand-merged; the revert strips the profile strings automatically.
  14. Config.xcconfig — all fork lines intact, APP_DEV_VERSION 1.0.2.71 → 1.0.2.79 (APP_VERSION stays 1.0.2).
  15. Testflight/WhatToTest.en-CA.txt — based on Trio dev 1.0.2.79.

Files 4–10 were kept Tai-side in the merge and again in the revert: upstream's only change on them in this range came from profile commits, so "keep Tai" is the exclusion.

Verification

Three review passes on this branch; the last one re-ran the full build-for-testing gate on the final head and it succeeds. All content gates are PASS and the branch now compiles clean.

Review 1 — card t_829535dc at a29a6dfb3:

  • Profile exclusion (PASS) — no profile file, model, Core Data entity, Nightscout upload path or remote-control command survives; no dangling symbols.
  • Fork specifics (PASS) — Tai display name and bundle id, APP_DEV_VERSION = 1.0.2.79, COPYRIGHT_NOTICE = autoISF 3.01, submodule pins and .gitmodules unchanged, auto_version_dev.yml still deleted, WhatToTest line updated.
  • Tai profile system (PASS) — AdaptProfile, ProfileScheduler, ProfileScheduleFirer, ActiveProfileMirror, App Intents, SettingsScope and the four editors intact.
  • Merge integrity (PASS) — git diff --check clean; pbxproj object graph 2 758 objects, 0 dangling, all 118 fork files re-added.
  • Build (FAIL) — build-for-testing exited 65 on exactly one compile error: a non-exhaustive switch over Tai-extended TherapySettingUnit in the upstream stats-export file TherapySchedulePDFContent.swift:141 — Tai adds .mgdLPer10Gram / .mmolLPer10Gram for its CSF editor, which upstream's new switch did not know.

Rework 1 — 64574cfc4 (fix(sync): cover Tai CSF units in TherapySchedulePDFContent switch): explicit cases for .mgdLPer10Gram and .mmolLPer10Gram in format(_:), grouped with the correct sibling fraction digits (1), no @unknown default escape hatch. Two added lines, no other file in the commit.

Review 2 — card t_77142000 at 64574cfc4:

  • Rework scope and format (PASS) — the switch fix is correct and the commit does not touch anything else.

  • Regression checks (PASS) — git diff --check clean, no profile-subsystem file in the diff, fork specifics (Tai, 1.0.2.79) and the untracked README/draft untouched.

  • Build (FAIL) — the CSF error is gone, and the identical command now stops on one remaining, distinct error:

    CI=true xcodebuild build-for-testing -workspace Trio.xcworkspace -scheme Trio \
      -destination 'platform=iOS Simulator,id=49BD8E10-5C12-43D9-AE9C-086377072DC2' \
      -derivedDataPath … CODE_SIGNING_ALLOWED=NO
    → exit 65
    
    Trio/Sources/Modules/Home/View/HomeRootView+Header.swift:257:52: error:
    value of type 'any APSManager' has no member 'isScheduledBasal'
    

    Cause: upstream 508f3bda8 (#1681) deleted isScheduledBasal from the APSManager protocol as dead code; Tai's fork-only header block (rightHeaderPanel(), added in 23a229ca05) still gated the delivery-rate line on it. The last unresolved merge collision between the fork header and the cleaned APSManager — the next error behind the one the first rework fixed, not a new regression. Rework card t_0405628a followed.

Rework 2 — 35454bc4d (fix(sync): use upstream pump availability signal in home header): the Tai header block now derives pump availability from state.pumpDisplayState != nil — the signal upstream itself uses since the APSManager cleanup — instead of the removed apsManager.isScheduledBasal. Two lines changed in HomeRootView+Header.swift (the condition plus its comment), no other file in the commit; APSManager.swift and DeviceDataManager.swift are untouched, and the pre-existing PumpHistoryEvent.isScheduledBasal field and its consumers stay as they are.

Review 3 (final) — card t_f5bf3fcc at 35454bc4d: all three gates PASS.

  • Rework scope (PASS) — the commit touches only HomeRootView+Header.swift (2 inserted / 2 deleted); isScheduledBasal appears nowhere in the protocol or its members any more.

  • Build-for-testing (PASS) — on the exact head:

    CI=true xcodebuild build-for-testing -workspace Trio.xcworkspace -scheme Trio \
      -destination 'platform=iOS Simulator,id=49BD8E10-5C12-43D9-AE9C-086377072DC2' \
      -derivedDataPath … CODE_SIGNING_ALLOWED=NO
    → exit 0, TEST BUILD SUCCEEDED
    
  • Regression checks (PASS) — git diff --check clean; no profile-subsystem file in the diff (TherapyProfileStorage.swift, TrioRemoteControl+Profile.swift absent; TherapyProfileChart.swift is the fork's therapy-settings chart from f91ed2baf, not feat/profiles); fork specifics intact (APP_DISPLAY_NAME = Tai, APP_DEV_VERSION = 1.0.2.79); the CSF-units fix (mgdLPer10Gram / mmolLPer10Gram) still present; README and this draft untouched.

  • CI — not run yet. The exact-head checks (Algorithm Package, Run Unit Tests) run on the first push of this PR.

Checklist before merge

  • Build-for-testing green on the exact head 35454bc4d — TEST BUILD SUCCEEDED, exit 0.
  • CI green on the exact head of this PR.

Not included

  • No new Tai feature and no Tai-side behaviour change — this is a synchronization. APP_DEV_VERSION moves 1.0.2.71 → 1.0.2.79 (upstream's build counter; APP_VERSION stays 1.0.2).
  • Upstream feat/profiles is not included (analysis-only for now; separate port).
  • Upstream feat/tandem is not included (separate ticket).
  • No release notes beyond the one-line WhatToTest update.

Screenshots

Not applicable for a Tai-side change: the new Statistics export UI and the watch changes are upstream's own UI, shown with screenshots in the upstream PRs (#1777, #1598, #1783). This merge adds no Tai-only UI.

claude and others added 30 commits September 25, 2026 06:29
Shortened the explanatory comments added for the objectID/id fix and
the Decimal/Double-to-Int trap guards down to one line each -- same
substance, less essay.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017dwtF7rgieonCdrsQo11r5
-adds new way of syncing
-removes unused files
this is a performance improvement for Garmin and Apple watch
Without new data the glucose bobble switched to "--" once the newest reading
was 6 minutes old. Like the phone's home screen, it now keeps showing the
last reading, its trend arrow and delta, with the reading's age ("6 m",
"< 1 m") next to the delta, until the reading is 12 minutes old, the loop's
own freshness gate. The age counts up with the main view's timer.

IOB, COB, the loop status and the treatment buttons keep their own staleness
rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0135v4JApHewuwGjWKiSPDNY
…phone"

This reverts commit 3b8c467; the change belongs on the fork's dev view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0135v4JApHewuwGjWKiSPDNY
Covers full histories, deltas, the 2 h context tail and the bucket repair
on both sides, and logs a missing local history as such instead of as
changed glucose settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix two crash risks in Override preset row rendering
LibreCRKit is superseded by RoundWhiteDiscKit, which LibreLoop now uses,
and which pairs Libre 3 / 3+ sensors with a plain-key app identity before
falling back to its runtime tables.

- RoundWhiteDiscKit (airedev326, main) replaces the LibreCRKit submodule,
  workspace entry, local package reference and app link.
- LibreLoop moves from loopandlearn's trio branch to LoopKit/LibreLoop's
  legacy-loopkit-compat branch: current LibreLoop plus only the changes
  needed to build against loopandlearn's LoopKit.
- swiftformat.sh excludes RoundWhiteDiscKit, and the submodule list and
  CODEOWNERS follow the rename.
RoundWhiteDiscKit now takes app credentials from the host; LibreLoop
downloads them and picks the sensor by its advertised BLE address.
Replace LibreCRKit with RoundWhiteDiscKit and track LoopKit's LibreLoop
* scripts update, remove LibreCRKit, point to OmnipodKit dev branch

* update submodules in common with Loop v3.14.9 plus DanaKit; other submodules unchanged

* restore LibreLoop to match dev branch

* update OmnipodKit to point to dev branch
Run swiftformat and extract missing strings
bjorkert and others added 28 commits November 16, 2026 11:06
…ly, keep them in memory in the manager and load them before a remote save
Fix Apple Watch bolus direction arrow
[Part 1/4] Store therapy profiles in Core Data
[Part 2/4] Add therapy profiles with switching and editing
[Part 3/4] Upload every therapy profile to Nightscout
# Conflicts:
#	Trio/Sources/Localizations/Main/Localizable.xcstrings
#	Trio/Sources/Services/TherapyProfiles/TherapyProfileManager.swift
[Part 4/4] Add remote profile switch, save and delete commands
Fix app init running twice from TrioApp().resolver
Remove unused statistics reporting pipeline and StatsData entity
This reverts merge de0f7f1 relative to its first parent 7e2fa52,
excluding the upstream therapy-profiles subsystem from the sync.
Tai keeps its own profile editors, SettingsScope semantics, AdaptProfile
and ProfileScheduler. The StatsData entity stays removed (59ccd6a).
Re-apply Tai's APSManager changes (insulin concentration adjustments,
enactManualTempBasal, settings/preferences accessors) on top of
upstream's cleaned APSManager.

Rebuild project.pbxproj as a 3-way merge of Tai dev with the
profile-free upstream changes since 3f6b238, so all Tai fork files
stay referenced while upstream's additions and deletions (Statistics,
Loops, StatsData, WatchStateSnapshot) are honored.
Tai extends TherapySettingUnit with .mgdLPer10Gram and .mmolLPer10Gram,
which the upstream stats PDF export did not handle. Group them as
TherapySettingEditorView.displayText does: .mgdLPer10Gram with
.gramPerUnit and .mmolLPer10Gram with the mmol units, all at max one
fraction digit.
APSManager.isScheduledBasal was removed upstream in 508f3bd. Derive
pump availability from state.pumpDisplayState, as upstream does.
@mountrcg
mountrcg merged commit 35454bc into dev Nov 20, 2026
@mountrcg mountrcg mentioned this pull request Nov 20, 2026
1 of 3 tasks
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.