mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 14:32:03 +00:00
feat(backup): carry the setup answers out of the account and back in
Nothing recomputes an answer. The module map they produced survives on the account row, but the map says what is switched on, not that the person told the flow they take medication daily and have a visit next month — so a restore without the row opens a blank questionnaire for somebody who already answered it, and leaves the checklist ordering itself from nothing. Both ends live in one file, the arrangement the visits and the score already use, because a reader who greps only the restore route gets a false negative when the route delegates. `modulesDerivedAt` is the field that makes this more than history and it is asserted rather than defaulted: it is the once-only latch on the module derivation, so a restore that let it default to null would hand the next confirm permission to re-apply the questionnaire over every module decision taken since, silently. The round trip seeds it non-null and reads it back. The file's schema validates the three answer objects loosely and the restore narrows them through the same fail-soft readers the account payload uses. Being stricter there would refuse a whole account's restore over one retired chip. The wipe takes the row for the reason the reset already takes the wizard's own columns: the record the answers were about is gone, so the answers describe nothing.
This commit is contained in:
1 parent
dbfad0f28e
commit
3f44b882ac
11 files changed
+376
No files matched your search
@@ -28,6 +28,7 @@ vi.mock("@/lib/db", () => ({
|
||||
// `buildIntradayProfileBackupSection`.
|
||||
intradayCumulativeProfile: { findMany: vi.fn().mockResolvedValue([]) },
|
||||
healthScoreRecord: { findMany: vi.fn().mockResolvedValue([]) },
|
||||
onboardingRecord: { findUnique: vi.fn().mockResolvedValue(null) },
|
||||
// The visit tables. Empty here: this file asserts the sections it seeds,
|
||||
// and an account with no visits is the ordinary case the builder must
|
||||
// still answer for.
|
||||
|
||||
@@ -26,6 +26,7 @@ vi.mock("@/lib/db", () => ({
|
||||
// `buildIntradayProfileBackupSection`.
|
||||
intradayCumulativeProfile: { findMany: vi.fn().mockResolvedValue([]) },
|
||||
healthScoreRecord: { findMany: vi.fn().mockResolvedValue([]) },
|
||||
onboardingRecord: { findUnique: vi.fn().mockResolvedValue(null) },
|
||||
// The visit tables. Empty here: this file asserts the sections it seeds,
|
||||
// and an account with no visits is the ordinary case the builder must
|
||||
// still answer for.
|
||||
|
||||
Reference in new issue
Block a user