Skip to content

feat(health): parse activity summaries from Apple Health exports - #47

Merged
johnnyhuy merged 1 commit into
mainfrom
agent/issue-46-activity-summaries
Nov 13, 2026
Merged

johnnyhuy merged 1 commit into
mainfrom
agent/issue-46-activity-summaries

Conversation

@johnnyhuy

@johnnyhuy johnnyhuy commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Parse daily Apple Health ActivitySummary rows alongside workouts and records in the Foundation-only package. The new Codable model keeps ring totals and goals separate from record-derived daily totals, preserves the calendar day and source energy unit, and offers supported energy conversions to kilocalories.

Completes the activity-summary parsing slice. Part of #6. Closes #46.

Verification

  • mise run lint passed, with 491 warnings and 0 serious violations across the repository. No warnings in the changed Swift files.
  • mise run build passed.
  • mise run test passed, including 23 pipeline checks, 151 XCTest tests, and 30 Swift Testing tests across 4 suites.

The CI run passed every check, including the Linux SwiftPM build/tests, iOS build, mobile e2e suite, and iOS UI tests with coverage.

Proof

Unit-test capture succeeded. This core ingestion slice has no app UI changes, so simulator screenshots were not needed; no capture path was blocked. The standard CI UI tests and mobile e2e suite also passed. The following transcript comes from mise run test on commit 5844498.

The new HealthActivitySummaryTests suite proves mixed XML ingestion without double counting, both parser input APIs, all ring fields, supported and unsupported energy units, missing and invalid numeric values, JSON round-trips, decoding older exports, and malformed XML rejection.

Executed 151 tests, with 0 failures (0 unexpected) in 2.260 (2.285) seconds
Test preservesUnsupportedUnitsWithoutInventingKilocalories(unit:) with 3 test cases passed after 0.006 seconds.
Test leavesMissingValuesNil() passed after 0.006 seconds.
Test parsesDataAndRoundTripsJSON() passed after 0.006 seconds.
Test normalisesSupportedEnergyUnits(unit:) with 4 test cases passed after 0.006 seconds.
Test decodesExportsFromBeforeActivitySummaries() passed after 0.006 seconds.
Test rejectsInvalidNumericValues(value:) with 5 test cases passed after 0.006 seconds.
Test parsesMixedExportWithoutDoubleCounting() passed after 0.007 seconds.
Test rejectsMalformedXML() passed after 0.008 seconds.
Suite HealthActivitySummaryTests passed after 0.008 seconds.
Test run with 30 tests in 4 suites passed after 0.008 seconds.

The CI UI coverage job also captured the existing app journeys successfully.

Test Suite 'BetterFitAppUITests.xctest' passed at 2026-11-13 03:49:05.562.
Executed 27 tests, with 0 failures (0 unexpected) in 450.751 (450.769) seconds
** TEST SUCCEEDED **

Reviewer notes

The exported dateComponents string stays unchanged rather than being converted into an invented timestamp. Exercise values are in minutes and stand values are in hours. Missing, negative, non-finite, or non-numeric XML quantities become nil; measured zero remains zero. Energy with an unknown or absent unit is preserved but is not presented as kilocalories.

Existing JSON without the new collection decodes with an empty activitySummaries array. This slice does not add activity ring UI, merge ring totals into record-derived summaries, or change recommendation policy. The parent ingestion epic remains open.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@johnnyhuy
johnnyhuy merged commit 984f325 into main Nov 13, 2026
10 checks passed
@johnnyhuy
johnnyhuy deleted the agent/issue-46-activity-summaries branch November 13, 2026 03:50
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.

Parse activity summaries from Apple Health exports

1 participant