Skip to content

Assert schedule is sorted properly - #38

Merged
ps2 merged 4 commits into
tidepool-org:mainfrom
LoopKit:main
Jul 27, 2026
Merged

Assert schedule is sorted properly#38
ps2 merged 4 commits into
tidepool-org:mainfrom
LoopKit:main

Conversation

@ps2

@ps2 ps2 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

ps2 added 3 commits May 21, 2026 18:26
Bring in Tidepool LoopAlgorithm updates
The binary-search filterDateRange overload assumes its collection is sorted
ascending by startDate, but returns silently-wrong results otherwise. Add a
debug-only assert enforcing that contract (compiled out of release builds, so
no runtime cost).

This immediately surfaced an existing violation: testGlucoseEffectFromHistory
built a `basal` schedule with segments out of order (and one with endDate
before startDate, plus overlaps). Replace it with a well-formed sorted,
contiguous, non-overlapping schedule, and regenerate the expected-effect
fixture to match the corrected schedule.
Assert filterDateRange input is sorted ascending
@ps2
ps2 requested review from Camji55 and nhamming July 27, 2026 16:23
@ps2 ps2 changed the title Import small algorithm fixes from DIY Assert schedule is sorted properly Jul 27, 2026
@ps2
ps2 merged commit f9286b7 into tidepool-org:main Jul 27, 2026
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