feat(workbench): route editor state on effect-atom (#105 phase 2) - #263
Merged
Conversation
🦋 Changeset detectedLatest commit: 84b2ca7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Sep 2, 2026
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.
Summary
Phase 2 of the #105 effect-atom migration (phase 1: #250). The routes-page route-input editor state — previously seven coordinated
useState/derivation clusters per editor (draft, raw JSON, errors, rawError, attempted, arguments, argv) — moves onto anAtom.familykeyed by manifest digest + compiled route id, in a new dedicated browser-state module per thedocs/effect-conventions.md"Workbench browser state" convention.packages/workbench/src/routes/route-editor-atoms.ts: writableAtom.familykeyeddigest\u0000routeId, initial valueundefined(uninitialized sentinel). No effects, no streams (stream-backed derived atoms remain banned until the post-rc.112 re-pin), noAtom/AsyncResultin any public export.packages/workbench/src/routes/routes-model.ts: stays pure — addsRouteEditorState+ pure transitions (initialRouteEditorState,setRouteEditorDraftValue,setRouteEditorRaw,validateRouteEditor) that derive from the untouchedvalidateRouteInput/validateRawRouteInput/cliCommandInvocationprojections.packages/workbench/src/routes/routes-page.tsx:RouteInputEditorconsumes the atom viauseAtomwith functional updaters; markup unchanged;RoutesPagepublic props unchanged.The
undefinedsentinel is what keeps provider-less static SSR rendering byte-identical initial markup (useAtomValue'sgetServerSnapshotreturns the initial atom value), so the existing contract tests pass unmodified.Preserved behavior contracts (#222/#224 fixes)
routes-model.test.ts,routes-page.test.ts, andexamples-real.e2e.test.tsare untouched and green. Pinned explicitly by new unit tests: optional-boolean omitted/true/false three-state, stale-prefill fail-closed paths untouched (mcpToolPrefillForgating on validated arguments preserved), variadic/repeated-option argv + usage projection, attempted-gated re-validation, and the raw-path asymmetry (raw edits after Validate update rawError/arguments but never argv).Disposal regression (phase-1 pattern)
route-editor-atoms-disposal.test.ts(integration pool): rsbuild browser fixture mounting the realRoutesPageunder a bareRegistryProvider; 5 mount → type → validate → unmount → remount cycles assert fresh initial state each remount, plus an A→B→A digest-switch cycle; zero page errors.Verification (local, after rebasing over #259)
pnpm typecheckcurrently fails on pristine origin/main (TS7016 inclassify-docs-only.test.tsfrom ci: extract docs-only classifier tests and retry stale-diagnostic e2e flakes #259) — pre-existing, reproduced on a clean main worktreeroutes-model+routes-page+ newroutes-editor-state): 40/40public-api.test.ts :: keeps bundled config extension types in emitted root declarations, pre-existing (fails identically on a pristine origin/main worktree; unrelated to workbench)Bundle delta (workbench production build)
Near-zero as predicted — the effect core + atom runtime entered the shared chunk in phase 1.
Patch changeset included (
agent-bundleships the Workbench dist).