feat(api): publish the setup state on the account payload, and read it

Additive: `onboarding` carries the nine steps with their status, the answers as
given, the flow's own completion stamp and the one task it offered. Always
present — a record that never entered the flow reads as empty answers with nine
pending steps, so a client branches on the statuses rather than on whether the
field exists, and an unknown step id is skipped rather than refused.

It is resolved for the CALLER's own record rather than for the active one,
unlike the two module fields beside it. The three write routes are actor-only,
and publishing a setup state the browser cannot write would be a read it could
act on and never complete.

Both ends land here, because a field with no reader is the failure this
repository keeps rediscovering. The getting-started checklist orders its rows
from the answers — medication first for somebody who takes one daily, the
data-source row first for somebody who named a wearable — and it stays on screen
while the flow is unfinished. That is the second half: five readings were never
evidence that the setup finished, and now a pending step, an unconfirmed set of
answers or an offered task that produced nothing keeps the list where it is.

The ordering only applies once the answers are confirmed. Re-ordering the
dashboard under somebody who is still mid-question would be movement they did
not ask for.
This commit is contained in:
Marc-André Bombeck committed 2026-09-10 11:03:47 +02:00
1 parent 021ea8f1ff
commit dbfad0f28e
7 files changed
+852 -35

No files matched your search

@@ -312,11 +312,17 @@ export function GettingStartedChecklist() {
notificationsConfigured,
insightsConfigured,
dismissedIds,
// v1.39 (C1) — the setup answers order these rows: medication first
// for somebody who said they take one daily, the data-source row first
// for somebody who named a wearable. Null until the account payload
// resolves, and for any record that never entered the flow.
onboarding: user?.onboarding ?? null,
}),
[
user?.heightCm,
user?.dateOfBirth,
user?.gender,
user?.onboarding,
measurementCount,
medicationCount,
dataSourceConnected,
@@ -334,6 +340,10 @@ export function GettingStartedChecklist() {
measurementCount,
dismissedAll,
items,
// v1.39 (C1) — five readings are not evidence the setup finished. While a
// step is still pending, the answers were never confirmed, or the one task
// the flow offered never produced its result, the list stays.
onboarding: user?.onboarding ?? null,
});
// v1.4.15 phase-A3 fix #3 — flicker guard. Until BOTH the auth user