fix(desktop): keep Settings stable during Runtime Host refresh - #3450
fix(desktop): keep Settings stable during Runtime Host refresh#3450chihumyum wants to merge 1 commit into
Conversation
Generated-by: Codex
jackwener
left a comment
There was a problem hiding this comment.
Automated review of exact head 54651d6b0aeca844f527f75cfe00f4a8d6b6c9fc against current main@d62857a8357e9160926726a2a13096bc2dc2b91d.
The defect remains on main: every Settings mount starts the Runtime Host catalog/settings/connections resources cold, so the mixed-ownership General page briefly renders defaults/loading feedback before Host data arrives. The patch keeps only masked read snapshots in renderer memory, keys Host data by profileId:hostId, prunes an old epoch when the catalog changes, and keeps cached Host controls inert until the current mount verifies the target. The separate read/write tickets also prevent a late old-Host result from populating the newly selected Host. The reopen E2E observes the transient DOM, so it would catch the original flash rather than only asserting the settled page. I found no actionable P0-P2 defect; git diff --check is clean.
Required conclusions:
- Optimal for the actual problem: yes. The implementation is larger than the symptom, but stable cross-unmount rendering requires a cache, and the masking, epoch key, verification bit, and interaction fence are necessary to avoid turning stale UI into write authority.
- Production code to delete: the PR replaces the older parallel resource unions/ticket refs; none further identified.
- Tests to delete/replace: none identified. The helper tests and transient-DOM E2E cover distinct contracts.
- Deeper refactor: no; keeping the cache outside AppShell avoids lifting Settings-only state into a broader owner.
- Ready to merge: not yet. No hosted
testcheck is reported on this exact head, and automated review is not approval. - Residual risks/gaps: this changes user-visible loading/error behavior and the security-sensitive Host write boundary across General, Projects, and Data. The supplied tests cover cache epochs and the default General reopen, but independent human review should still exercise non-default Host selection and failure/retry behavior.
This affects user-visible behavior and Runtime Host authority fencing, so CONTRIBUTING.md requires independent human judgment on the exact head.
Summary
Behaviour
Before fixing, the yellow banner flashes each time the settings page is opened.
before.mp4
After fixing, no yellow banner was ever shown.
after.mp4
Verification
npm run lintnpm run format:checknpm run buildnpm run typechecknpm --workspace @maka/desktop test— 1050/1050 passednpm --workspace @maka/desktop run build-storybooknpm --workspace @maka/desktop run smoke:storybook— 168/168 passednpx knip --workspace apps/desktopnpx knip --workspace packages/uinpm run astryx:surface-inventorynpx playwright test --config e2e/playwright.config.ts e2e/settings.spec.ts— 3/3 passedFull desktop E2E completed with 39 passed and 1 skipped. One unrelated
prompt-rail.spec.tsgeometry assertion remained intermittent at exactly24px versus
<24px; this PR does not modify that surface, and an isolatedthree-run repeat passed twice.
Review focus
AI use
Select exactly one:
Tool(s) and scope: Codex — implementation, race analysis, unit/Storybook/Electron
E2E coverage, regression verification, and pull request preparation. The human
contributor reviewed the contribution and accepts responsibility for it.
Checklist
Does this PR entail a change in behavior?