Skip to content

docs(export): correct the bundle layout, the CSV import claim and the tracked-day loss - #999

Merged
simonoppowa merged 2 commits into
developfrom
fix/export-format-doc
Sep 1, 2026
Merged

docs(export): correct the bundle layout, the CSV import claim and the tracked-day loss#999
simonoppowa merged 2 commits into
developfrom
fix/export-format-doc

Conversation

@simonoppowa

Copy link
Copy Markdown
Owner

Third of the three docs in #991. Checked against origin/release/2.2.0.

What survived: all three CSV column tables match CsvDataExporter exactly — 41 intake columns, 13 activity, 9 tracked-day, in order — and the dialect section matches _cell and CsvRowParser including the decimal-comma handling. Those are the parts an external tool actually parses, and they were right.

The premise was wrong

The doc described one zip containing JSON and CSV side by side, each CSV a "flat companion" to its JSON. The export is format-exclusive: a JSON/CSV toggle in export_import_dialog.dart picks one, and export_data_usecase.dart writes one or the other. No bundle the app has ever produced contains both. Someone writing a tool against this page unzips expecting six files and finds three.

Now split into a JSON-bundle table and a CSV-bundle table.

Two claims that were the opposite of the truth

CSV import exists. ImportDataUsecase.importDataCsv reads all three CSVs and is wired to the same toggle as the export. The page said the importer "reads the JSON files and ignores the CSV companions", and offered "Import CSV (intakes / activities / tracked days)" as future work "if there's demand".

Tracked days do not round-trip. The page promised CSV export+parse yields structurally equal DBOs and cited a test for it. trackedDayColumns has 9 entries; TrackedDayDBO has 19 fields. The ten per-nutrient goals from #173 — fibre, saturated fat, sugars, sodium, calcium, iron, potassium, magnesium, B12, vitamin D — have no column and are silently dropped. The cited test doesn't catch it because its tracked-day group never sets them. Anyone restoring from a CSV bundle loses those goals, and the page told them it was safe.

Also

  • Four artefacts were missing from the layout: weight_log.json, custom_activity_templates.json, and the recipe_images/ and meal_images/ directories.
  • "User profile (height, weight, birthday, PAL, goal) is intentionally not included" reads as your weight data isn't in the bundle. The profile box is excluded — but weight history is exported as weight_log.json. The two are now separated explicitly.

Checked

  • csv_data_exporter_test.dart passes
  • Column tables re-verified against CsvDataExporter on the release branch
  • The new #round-trip-guarantee cross-link resolves

No runtime test reads this file, unlike ai-architecture.md and RELEASING.md — which is part of why it drifted this far.

… tracked-day loss

Checked against origin/release/2.2.0. The CSV column tables are all still exact
-- 41 intake columns, 13 activity, 9 tracked-day, in order -- as is the dialect
section. The layout and the round-trip section were not.

- **The bundle is format-exclusive.** Settings -> Export offers a JSON / CSV
  toggle and writes one or the other; no bundle the app produces has ever
  carried a CSV next to its JSON counterpart. The doc described a single zip
  with both side by side, each CSV a "flat companion" -- so a tool author
  unzipping expecting six files finds three. Split into a JSON table and a CSV
  table.

- **Four artefacts were missing:** weight_log.json and
  custom_activity_templates.json from the JSON bundle, and the recipe_images/
  and meal_images/ directories carrying user photos.

- **CSV import shipped.** ImportDataUsecase.importDataCsv reads all three CSVs
  and is wired to the same toggle. The doc said the importer "reads the JSON
  files and ignores the CSV companions" and offered CSV import as future work
  "if there's demand".

- **Tracked days do not round-trip, and the doc promised they did.**
  trackedDayColumns has 9 entries against TrackedDayDBO's 19 fields: the ten
  per-nutrient goals added by #173 have no column and are dropped. The cited
  test does not pin what the doc claimed, because its tracked-day group never
  sets them. Now stated, with a pointer to use JSON for restores.

- **"User profile (height, weight, birthday, PAL, goal) is not included"** read
  as "your weight data is not in the bundle". The profile box is excluded, but
  weight history is exported as weight_log.json. Separated.

Refs #991
Copilot AI lite review requested due to automatic review settings September 1, 2026 15:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The updated ZIP layout section incorrectly claims photos are included in both JSON and CSV bundles and references a non-existent path missing the lib/ prefix.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates docs/export-format.md to correctly describe the app’s export/import ZIP contents and the actual behavior of JSON vs CSV bundles, aligning the documentation with the current exporter/importer implementation.

Changes:

  • Split the ZIP layout description into distinct JSON bundle vs CSV bundle tables (format-exclusive export).
  • Corrected the prior claim that CSV import is read-only by documenting the existing CSV import path.
  • Documented the tracked-day CSV round-trip limitation (per-nutrient goals are dropped) and pointed readers to JSON for lossless restore.
File summaries
File Description
docs/export-format.md Corrects export bundle layout and import/round-trip claims for JSON vs CSV formats.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/export-format.md Outdated
Comment on lines +40 to +45
Either bundle also carries any user-attached photos, under `recipe_images/` and
`meal_images/`.

The **profile box** — height, birthday, PAL, goal — is intentionally not
included; see `core/data/data_source/user_data_source.dart`. Note this is the
profile only: your logged **weight history** *is* exported, as `weight_log.json`.
Copilot caught it, and the code agrees: `_addUserImageIfPresent` sits inside
the `format == ExportFormat.json` branch of `exportData`, and
`importDataCsv` has no image-restore step at all. The page said either bundle
carries them, which would have cost someone their photos on a CSV round trip.

Also prefixes the profile-box path with `lib/`, matching every other path on
the page.
Copilot AI review requested due to automatic review settings September 1, 2026 16:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is documentation-only and the updated statements match the current export/import implementation (including CSV import and JSON-only artifacts).

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@simonoppowa
simonoppowa merged commit 8a47711 into develop Sep 1, 2026
14 checks passed
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.

2 participants