Skip to content

fix(health): reject unsupported workout duration units - #89

Merged
johnnyhuy merged 1 commit into
mainfrom
agent/issue-88-workout-duration-units
Nov 16, 2026
Merged

johnnyhuy merged 1 commit into
mainfrom
agent/issue-88-workout-duration-units

Conversation

@johnnyhuy

Copy link
Copy Markdown
Contributor

Workout parsing now treats explicitly unsupported duration units as missing, so their raw values no longer enter summaries as seconds. Supported seconds, minutes and hours units, case variants, omitted-unit defaults and measured zero retain their existing behaviour.

Part of #7. Closes #88.

Verification

  • mise run lint passed with 0 serious violations and 491 existing warnings.
  • mise run build passed.
  • mise run test passed, including 23 video-pipeline checks, 169 XCTest tests and 98 Swift Testing tests.
  • swift test --filter WorkoutDurationUnitTests failed before the parser fix with 17 expectation failures, demonstrating the regression tests detect the bug.

Proof

Core logic test capture succeeded. The before-fix transcript showed an unsupported unit contributing 30 seconds to a weekly total that should contain only a valid 30-minute workout.

Expectation failed: (workout.duration → 30.0) == nil
Expectation failed: (week.totalDuration → 1830.0) == (1800 → 1800.0)
Test run with 5 tests in 1 suite failed after 0.013 seconds with 17 issues.

The full mise run test transcript after the fix shows supported conversions, preserved metadata and child statistics, Codable round trips, measured zero, missing duration in per-workout and weekly CSV/JSON exports, and mixed weekly totals in both input orders.

==> summary: 23 passed, 0 failed
Executed 169 tests, with 0 failures (0 unexpected) in 2.377 (2.473) seconds
Test supportedAndOmittedUnitsNormaliseToSeconds(unit:seconds:) with 11 test cases passed after 0.064 seconds.
Test unsupportedUnitsKeepWorkoutAndOtherMetrics(unit:) with 6 test cases passed after 0.064 seconds.
Test measuredZeroRemainsZeroInSummariesAndExports(unit:) with 4 test cases passed after 0.064 seconds.
Test unsupportedDurationDoesNotContaminateMixedWeeklyTotals() passed after 0.064 seconds.
Test unsupportedDurationStaysMissingInSummariesAndExports() passed after 0.064 seconds.
Suite WorkoutDurationUnitTests passed after 0.067 seconds.
Test run with 98 tests in 14 suites passed after 0.072 seconds.

No app screens changed. Simulator and UI captures were not required for this core-only slice; no capture method was blocked.

Reviewer notes

Omitted duration units continue to mean seconds for compatibility. Empty units and unsupported units such as day and ms produce a missing duration, even when start and end dates exist. This slice does not infer elapsed duration from those dates or add conversions for new units. Other ingestion and recommendation work in #7 remains open.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@johnnyhuy
johnnyhuy merged commit 32b583d into main Nov 16, 2026
10 checks passed
@johnnyhuy
johnnyhuy deleted the agent/issue-88-workout-duration-units branch November 16, 2026 11:22
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.

Reject unsupported workout duration units

1 participant