Repository navigation
fix(tests): DST-safe time helpers for BolusCalculator and ScheduledBasalInference - #40
Merged
Merged
Conversation
…rence tests Use calendar wall-clock construction instead of elapsed-seconds-from-start-of-day math, so test fixtures resolve to the intended hour/minute across the Europe/Berlin DST fallback transition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(tests): DST-safe time helpers for BolusCalculator and ScheduledBasalInference (post-#39 CI repair)
Source branch:
fix/sync-39-dst-tests→ target:devBaseline:
dev54e76a96e5e6ac4bd6968ec98a2b165c36d23fd5(direct parent of the repair commit)Repair commit:
09f07d0860a137693e34342275670fac32493958Diff scope: 2 test files, +5 / −4 (
TrioTests/BolusCalculatorTests/BolusCalculatorTests.swift,TrioTests/CoreDataTests/ScheduledBasalInferenceTests.swift)Summary
Post-merge CI repair for sync PR #39 (
sync/trio-2026-10-25→dev, merge804801c50, merged asb5e9d2f2).PR #39 fixed the four stale OpenAPSSwift parity goldens, but the
devCI run on its merge result still failsthe full iOS unit-test job. The cause is not the merge: two test helpers in the Trio test target compute their
fixtures with elapsed-seconds-from-start-of-day arithmetic, which breaks on the Europe/Berlin DST fallback day
(2026-10-25 is a 25-hour day and the
Trio Testsscheme pinsTZ=Europe/Berlin). Both helpers predate thesync and are test-only.
This PR contains only those two helper corrections. Production code, localization, project file, schemes,
parity goldens and branch history are untouched, and the pre-existing FPU expectation repair already on
devis not modified.
CI evidence (the failure this repairs)
GitHub Actions run
40171219998ondevhead54e76a96e—[DO NOT RUN] Automated unit tests:swift test)xcodebuild testexit 65, 28m2sThe full-suite job built successfully and failed only in
Run tests, in the two areas repaired here:BolusCalculatorTestsresolved the 07:00 scheduled basal setting to 90 instead of 100, andScheduledBasalInferenceTestsproduced the wrong segment count for the fallback day, including anindex-out-of-range after the unexpected count.
54e76a96eitself carried only the Tai FPU expectation update(
TrioTests/CoreDataTests/CarbsStorageTests.swift), so it did not include these two corrections.The two corrections
1.
ScheduledBasalInferenceTests.time(_:_:)Before:
startOfDay(for: Date()).addingTimeInterval(hour * 3600 + minute * 60)— on a 25-hour fallback daythe accumulated seconds land an hour off the intended wall-clock hour, shifting every fixture in the sweep
relative to the schedule boundaries it is meant to hit.
After:
Calendar.current.date(bySettingHour:minute:second:of:)with a start-of-day fallback — fixtures arebuilt at the requested wall-clock hour/minute, matching how production
ScheduledBasalInferencebuilds andcompares its schedule bounds.
2.
BolusCalculatorTests.getCurrentSettingValue(for:at:)Before: minute-of-day derived as
dateComponents([.minute], from: startOfDay, to: date).minute— an elapsedcount that is one hour short on the fallback day, so the 07:00 lookup fell into the previous schedule entry
(90 instead of 100).
After: minute-of-day derived from
dateComponents([.hour, .minute], from: date)ashour * 60 + minute—wall-clock semantics, consistent with production
minutesOfDay.Both helpers therefore keep schedule-lookup semantics through the fallback and the spring transition for the
daytime values the tests exercise. They still anchor to the current date, so this is not deterministic
coverage of every time zone or ambiguous local time — it removes the DST dependence, it does not add DST
regression coverage.
Deliberately not part of this PR
TrioTests/CoreDataTests/CarbsStorageTests.swift— the Tai-specific FPU split expectation (16 × 2.7 ginTai
processFPUsemantics) was already repaired ondevin54e76a96eand is unchanged here.project.pbxproj, scheme or parity-golden changes.804801c50/b5e9d2f2history: the repair commit's direct parent is the currentdevbaseline, so the branch adds exactly one commit on top of
devand nothing is rewritten.Verification evidence (narrow, pre-PR)
Reviewer and coder evidence is local and narrow by design; it does not replace PR CI.
54e76a96e, completebaseline-to-HEAD diff limited to the two helpers (5 insertions, 4 deletions),
git diff --checkclean, nostaged or committed change outside
TrioTests/.ScheduledBasalInferenceTests: 11 tests passed in the coder's selector run (xcresultTest-Trio Tests-2026.10.25_09-50-57-+0100.xcresult).BolusCalculatorTests/testGetCurrentSettingValue(): the coder's selector was written without the trailing(), so it never executed that test; the reviewer re-ran it explicitly against the same build and verified1 passed, 0 failed/skipped (xcresult
Test-Trio Tests-2026.10.25_09-57-57-+0100.xcresult). Reported as11 scheduled-basal passes plus this separately verified bolus pass — not as one combined run.
Trio Watch App.xcscheme,Trio Watch Complication Extension.xcscheme,Localizable.xcstrings, plus this untracked draft) areexcluded and must not be staged with the branch.
Release gate
Full PR CI is the release gate: both
Algorithm Package (swift test)andRun Unit Testsmust be green onthe pushed
fix/sync-39-dst-testshead before merge. The narrow local runs above only show that the twofailing areas are repaired; they do not cover the rest of the iOS suite.
Merge checklist
fix/sync-39-dst-tests(single commit09f07d086, parent54e76a96e) — nothing pushed yet.TrioTests/files (+5 / −4).Algorithm Package (swift test)andRun Unit Testsboth green on the PR head.dev(Robert only; the orchestrator never merges).devCI run to confirm the two pre-sync helper defects are closed.