mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
fix: record the export stamp an Apple Health import already promised
The import status endpoint returns the instant the Health app stamped on the archive, the published contract requires the field, and the schema comment said the parser filled it during unpack. It never did: ExportDate sat on the parser's ignore list, so the column answered null on every job ever run, for a year. The parser reads the element now and hands the stamp to the worker on the next chunk boundary, so the value lands while the run is still going and a job that later fails still records which export it was working from. An archive that omits the element, or writes a value the runtime cannot read, leaves the column null rather than guessing at an instant. No contract change: the endpoint and the OpenAPI description already described this behaviour.
This commit is contained in:
1 parent
fc1ebeae9e
commit
2ea08c6966
5 files changed
+180
-3
No files matched your search
+10
-2
@@ -4968,8 +4968,16 @@ model ImportJob {
|
||||
/// `APPLE_HEALTH_IMPORT_PARSER_REVISION`, so a job parsed under an older
|
||||
/// revision never short-circuits a fresh upload of the same bytes.
|
||||
parserRevision Int @default(1) @map("parser_revision")
|
||||
/// Apple's `ExportDate` attribute string-formatted, parsed during
|
||||
/// the unpack phase. NULL until the parser sees it.
|
||||
/// The instant the Health app stamped on the archive itself — the
|
||||
/// `value` attribute of the `<ExportDate>` element that opens
|
||||
/// `export.xml`. Written mid-run by the parse phase the moment the
|
||||
/// element goes past (`onExportDate` in
|
||||
/// `src/lib/measurements/import-apple-health-export.ts`, persisted by
|
||||
/// `src/lib/jobs/apple-health-import-worker.ts`), so a job that later
|
||||
/// fails still records which export it was working from. Consumer: the
|
||||
/// status endpoint (`src/app/api/import/apple-health-export/[jobId]/
|
||||
/// status/route.ts`). NULL until the parser reaches the element, and
|
||||
/// for an archive that omits it or writes an unreadable value.
|
||||
exportedAt DateTime? @map("exported_at")
|
||||
startedAt DateTime @default(now()) @map("started_at")
|
||||
completedAt DateTime? @map("completed_at")
|
||||
|
||||
Reference in new issue
Block a user