ENG-848: best-effort onboarding sync can't fail a persisted config#435
Open
alecantu7 wants to merge 1 commit into
Open
ENG-848: best-effort onboarding sync can't fail a persisted config#435alecantu7 wants to merge 1 commit into
alecantu7 wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up from the #432 review (@lucas-koontz). In
persistOnboarding, the best-effort stepssyncModels/syncHarnessran inside the sametryas 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
dbOkis confirmed true, runsyncModels/syncHarnessin their owntry/catchthat swallows errors (genuinely best-effort — the authoritative config already landed). Return{ ok: true }regardless of their outcome.syncModelsorsyncHarnessafter the DB write lands still yields{ ok: true }.Second review note (App.tsx:130) — no code change, documented
hasLocalTermsConsent()(App.tsx:30) is already internallytry/catched and returnsfalseon any error, so even though it now sits outsideresolveBootTarget's guard it cannot throw or escapeinit(). 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.ts→ 37 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 (#432 →main), to avoidmaindiverging ahead ofstaging. Flows tomain/prod via the normal path.Closes ENG-848. Follow-up to #432 (ENG-720, ENG-817).