Skip to content

feat(health): export activity ring summaries as CSV and JSON - #53

Merged
johnnyhuy merged 1 commit into
mainfrom
agent/issue-52-activity-summary-export
Nov 13, 2026
Merged

johnnyhuy merged 1 commit into
mainfrom
agent/issue-52-activity-summary-export

Conversation

@johnnyhuy

@johnnyhuy johnnyhuy commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Add CSV and JSON exports plus atomic file writers for parsed activity ring summaries. CSV uses explicit units and safely quoted text, while JSON retains original energy values and units for a lossless round trip.

Part of #6. Closes #52.

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, 162 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 the iOS UI suite with coverage.

Proof

Captured the full unit and integration test run in .tmp/proof/issue-52-test.log and pasted the relevant passing lines below, with runner glyphs omitted. The 11 new tests cover the XML-to-export path, units, missing values, measured zeroes, order, duplicate days, unsupported units, CR/LF/CRLF and quote escaping, raw JSON round trips, non-finite JSON errors, file replacement and file errors.

The mixed XML test exports a 2092 kJ ring total as 500 kcal without adding the separate 100 kcal record or 200 kcal workout. It also verifies measured zero and a missing following day. The file test creates and replaces real CSV and JSON files, then reads them back.

Executed 162 tests, with 0 failures (0 unexpected) in 2.193 (2.223) seconds
Test csvPreservesArrayOrderAndDuplicateDays() passed after 0.005 seconds.
Test jsonRoundTripPreservesRawEnergyUnitsMissingValuesAndOrder() passed after 0.006 seconds.
Test csvUsesExplicitUnitsAndPreservesCalendarDay() passed after 0.006 seconds.
Test csvEscapesTextContainingDelimiters(delimiter:) with 5 test cases passed after 0.006 seconds.
Test emptyExportsContainHeaderOrEmptyJSONArray() passed after 0.006 seconds.
Test csvDistinguishesMissingValuesFromMeasuredZero() passed after 0.006 seconds.
Test csvLeavesUnsupportedEnergyEmpty(unit:) with 3 test cases passed after 0.006 seconds.
Test jsonRejectsNonFiniteValues(value:) with 3 test cases passed after 0.006 seconds.
Test fileWritingPropagatesErrors() passed after 0.006 seconds.
Test writesAndReplacesCSVAndJSONFiles() passed after 0.006 seconds.
Test exportsParsedActivityRingsWithoutAddingRecordOrWorkoutEnergy() passed after 0.007 seconds.
Suite HealthActivitySummaryExportTests passed after 0.008 seconds.
Test run with 41 tests in 5 suites passed after 0.008 seconds.

The mobile e2e job also passed, reporting 3 passed (3.5m).

The iOS UI coverage job passed. Relevant captured output follows.

	 Executed 2 tests, with 0 failures (0 unexpected) in 51.156 (51.157) seconds
	 Executed 27 tests, with 0 failures (0 unexpected) in 433.065 (433.096) seconds
	 Executed 27 tests, with 0 failures (0 unexpected) in 433.065 (433.097) seconds
** TEST SUCCEEDED **

Unit and integration capture succeeded. No iOS or watchOS UI changed, so simulator screenshots were not needed; no capture path was blocked.

Reviewer notes

Ring summaries remain separate from record-derived daily summaries to avoid double counting. CSV leaves energy blank for missing or unsupported units; JSON retains the original unit and value. File writes require an existing parent directory. File-picking UI and recommendation integration remain deferred under #6, as recorded in #34. The parent epic stays open.

An earlier main build had a WebDriverAgent startup timeout and a sets-section UI assertion failure. Both simulator jobs passed on this PR, including that UI test; runner or timing flakiness remains a possible follow-up.

Add unit-labelled CSV, lossless JSON and atomic file writers for parsed activity summaries. Verify mixed XML exports, missing values, zeroes and CSV escaping.

Co-authored-by: OpenAI Codex <noreply@openai.com>
@johnnyhuy
johnnyhuy merged commit c550e6f into main Nov 13, 2026
10 checks passed
@johnnyhuy
johnnyhuy deleted the agent/issue-52-activity-summary-export branch November 13, 2026 15:46
This was referenced Nov 13, 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.

Export parsed activity ring summaries as CSV and JSON

1 participant