mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
refactor(google-health): read and write backfill progress through one schema
The backfillProgress column was read by four hand-rolled walkers over untyped records and written inline in the sync core. One module now owns the column: a Zod schema reads it, lenient per entry so a malformed cursor or end is dropped on its own, and one function writes it. The sync core keeps only the bookkeeping of a running backfill.
This commit is contained in:
1 parent
435099dc4f
commit
bfbd88b30b
10 files changed
+342
-316
No files matched your search
@@ -337,7 +337,7 @@ describe("Google Health backfill bounded by progress, not pages (#1220)", () =>
|
||||
const { GOOGLE_HEALTH_NO_PROGRESS_PAGES } =
|
||||
await import("@/lib/google-health/backfill-bounds");
|
||||
const { googleHealthBackfillEndedList } =
|
||||
await import("@/lib/google-health/sync-core");
|
||||
await import("@/lib/google-health/backfill-progress");
|
||||
const walk = 1 + GOOGLE_HEALTH_NO_PROGRESS_PAGES;
|
||||
|
||||
// First attempt: the first page and the twenty that repeat it. Not
|
||||
@@ -413,7 +413,7 @@ describe("Google Health backfill bounded by progress, not pages (#1220)", () =>
|
||||
await runChain(5);
|
||||
|
||||
const { googleHealthBackfillEndedList } =
|
||||
await import("@/lib/google-health/sync-core");
|
||||
await import("@/lib/google-health/backfill-progress");
|
||||
const c = await connection();
|
||||
expect(c.backfillCompletedAt).toBeInstanceOf(Date);
|
||||
const ended = googleHealthBackfillEndedList(c.backfillProgress);
|
||||
|
||||
Reference in new issue
Block a user