Skip to content

fix(health): reject unsupported workout metric units - #57

Merged
johnnyhuy merged 1 commit into
mainfrom
agent/issue-55-reject-unsupported-workout-units
Nov 13, 2026
Merged

johnnyhuy merged 1 commit into
mainfrom
agent/issue-55-reject-unsupported-workout-units

Conversation

@johnnyhuy

@johnnyhuy johnnyhuy commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Reject unsupported energy and distance units in workout statistics and workout totals, so raw values cannot be treated as kilocalories or metres. Recognised conversions, omitted-unit defaults, raw child statistics, and fallback to recognised totals remain available.

Part of #7. Closes #55.

Verification

  • mise run lint passed with 0 serious violations. The 491 existing warnings are outside the changed files.
  • mise run build passed.
  • mise run test passed, including the video pipeline smoke tests, 169 XCTest tests and 41 Swift Testing tests.
  • git diff --check passed.
  • CI mise run build and mise run test passed on Linux.
  • CI mise run lint and mise run ios:build:ci passed.
  • CI mise run ios:e2e passed all 3 tests.
  • CI mise run ios:coverage passed all 27 UI tests with coverage.

Proof

Captured the full unit and integration run in .tmp/proof/issue-55-test.log. The transcript below names all seven new tests. The parser integration tests feed actual XML through the public parser and verify that recognised child statistics or totals are used when the other source has an unsupported unit. The weekly test verifies missing metrics, mixed recognised and unsupported metrics, and measured zeroes.

Test Case '-[BetterFitTests.WorkoutUnitValidationTests testRecognisedChildStatisticsSurviveUnsupportedWorkoutTotalUnits]' passed (0.000 seconds).
Test Case '-[BetterFitTests.WorkoutUnitValidationTests testSupportedDistanceUnitsAndOmittedUnitKeepExistingConversions]' passed (0.000 seconds).
Test Case '-[BetterFitTests.WorkoutUnitValidationTests testSupportedEnergyUnitsAndOmittedUnitKeepExistingConversions]' passed (0.000 seconds).
Test Case '-[BetterFitTests.WorkoutUnitValidationTests testUnsupportedChildUnitsFallBackToRecognisedWorkoutTotals]' passed (0.000 seconds).
Test Case '-[BetterFitTests.WorkoutUnitValidationTests testUnsupportedStatisticUnitsPreserveRawValuesButHaveNoNormalisedValue]' passed (0.000 seconds).
Test Case '-[BetterFitTests.WorkoutUnitValidationTests testUnsupportedUnitsDoNotContaminateWeeklyTotals]' passed (0.001 seconds).
Test Case '-[BetterFitTests.WorkoutUnitValidationTests testUnsupportedWalkingDistanceFallsBackToRecognisedCyclingStatistic]' passed (0.000 seconds).
	 Executed 169 tests, with 0 failures (0 unexpected) in 2.371 (2.393) seconds
	 Executed 169 tests, with 0 failures (0 unexpected) in 2.371 (2.395) seconds
􁁛  Test run with 41 tests in 5 suites passed after 0.009 seconds.

The Linux build and test job also passed all seven new tests, with 169 XCTest tests and 41 Swift Testing tests green overall. The iOS build job reports ** BUILD SUCCEEDED **.

The mobile e2e job passed with the following captured output.

3 passed (4.6m)

The iOS UI coverage job passed with the following captured output.

Executed 27 tests, with 0 failures (0 unexpected) in 465.081 (465.109) seconds
** TEST SUCCEEDED **

Unit and integration test capture succeeded. No iOS or watchOS UI changed, so simulator screenshots and local UI tests were not needed. CI still verified the full UI and e2e suites. No capture path was blocked.

Reviewer notes

Missing units retain the existing kcal and metre defaults, including the existing cal alias. Empty strings and unsupported units now produce nil normalised metrics; child statistics still retain their original sum and unit and round-trip through Codable. Top-level workout totals contain normalised values only, so unsupported totals become nil.

This slice covers workout energy and distance only. Record-derived daily summaries, duration units, new unit aliases, and recommendation integration remain follow-up work. The parent epic stays open.

The unrelated Release Please job on main failed after #54 because v1.0.0 already exists. That follow-up is tracked in #56.

Keep unknown energy and distance units out of normalised workout and weekly summaries, preserving recognised fallbacks and raw child statistics.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@johnnyhuy
johnnyhuy merged commit 2d7e079 into main Nov 13, 2026
10 checks passed
@johnnyhuy
johnnyhuy deleted the agent/issue-55-reject-unsupported-workout-units branch November 13, 2026 19:41
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 units in workout energy and distance summaries

1 participant