Skip to content

ENG-848: best-effort onboarding sync can't fail a persisted config#435

Open
alecantu7 wants to merge 1 commit into
stagingfrom
alejandrocantu/eng-848-onboarding-besteffort-sync
Open

ENG-848: best-effort onboarding sync can't fail a persisted config#435
alecantu7 wants to merge 1 commit into
stagingfrom
alejandrocantu/eng-848-onboarding-besteffort-sync

Conversation

@alecantu7

Copy link
Copy Markdown
Contributor

What

Follow-up from the #432 review (@lucas-koontz). In persistOnboarding, the best-effort steps syncModels/syncHarness ran inside the same try as the authoritative DB write, so a throw returned { ok: false } after the config had already persisted — bouncing the user to the onboarding error screen, with retry re-running the whole sequence.

Fix

  • After dbOk is confirmed true, run syncModels/syncHarness in their own try/catch that swallows errors (genuinely best-effort — the authoritative config already landed). Return { ok: true } regardless of their outcome.
  • Regression tests: a throw from syncModels or syncHarness after the DB write lands still yields { ok: true }.

Second review note (App.tsx:130) — no code change, documented

hasLocalTermsConsent() (App.tsx:30) is already internally try/catched and returns false on any error, so even though it now sits outside resolveBootTarget's guard it cannot throw or escape init(). Added a clarifying comment at the call site rather than a redundant guard.

Verification

  • npm run typecheck (main + renderer + test) clean.
  • persistOnboarding.test.ts + bootTarget.test.ts + host.test.ts37 passed (incl. the 2 new throw-case tests).

Scope note

Lands on staging (source of the ENG-817 code) — deliberately not patched onto the ENG-720+817 hotfix branch (#432main), to avoid main diverging ahead of staging. Flows to main/prod via the normal path.

Closes ENG-848. Follow-up to #432 (ENG-720, ENG-817).

…848)

PR #432 review follow-up. In persistOnboarding, syncModels/syncHarness ran
inside the same try as the authoritative DB write, so a throw returned
{ok:false} even after the config had already persisted — bouncing the user to
the onboarding error screen (and re-running everything on retry).

- Move syncModels/syncHarness into their own try/catch after dbOk is confirmed;
  swallow their failures (genuinely best-effort). Return {ok:true} regardless.
- Add regression tests: a throw from syncModels or syncHarness after the DB
  write lands still yields {ok:true}.
- App.tsx: add a comment noting hasLocalTermsConsent() is internally try/caught
  (returns false on any error) — the second review note; it cannot throw or
  escape init(), so no code change is needed there.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant