Database governance built for humans and agents — controlling changes and access across every major database.
Vue → React: routing + app-shell + auth migration
Goal: Replace the Vue host (vue-router, App.vue, AuthContext.vue, the 3
layouts, the 5 React-mount bridge .vue files, ReactPageMount + the glob page
registry, the Pinia auth store, the router guard, the auth interceptor) with a
single React root running react-router-dom v7, with the app store as the
single source of truth for session state. This is the critical-path track to
fully deleting Vue from frontend/.
Delivery: one big-bang PR (decision). The pages are already React, so the bulk is mechanical route-table translation + deleting Vue files. The PR is built in an internal order (below) so the tree stays buildable/reviewable per commit.
Hard constraints:
- No breaking changes. Purely swapping the host; nothing user-visible changes.
- The guard is a faithful, line-by-line port of the existing
router/index.tsbeforeEach— same checks, same order, same redirects.
Decisions (locked)
- Strategy: big-bang single PR (no two-router coexistence).
- Router: react-router-dom v7 (
createBrowserRouter, nested route objects,lazy, loaders) — closest 1:1 translation of the nested vue-router config. - Guard: faithful port of
beforeEachas a root-routeloader. - pev2: replace the third-party Vue query-plan visualizer with React in this
PR, so the
vuecore dep is removed entirely (clean, complete deletion).
§1 Target architecture (end state)
One React root owns everything. main.ts drops createApp(App) and the separate
#react-app overlay mount, and mounts a single tree:
ReactDOM.createRoot(#app).render(
<RouterProvider router={createBrowserRouter(routes)} />
)
└─ <RootLayout> // replaces App.vue: providers + global overlays
(Toaster, AgentWindow, Watermark, SessionExpiredSurfaceGate — today's ReactApp)
└─ <AuthGate> // replaces AuthContext.vue: gates render on app-store session
└─ <Outlet/> // matched layout + page
- Routes:
createBrowserRouterwith a nested route-object array translated1:1 from the vue-router config (102 routes, 73 page names). The 3 Vue layouts (Splash/Body/Dashboard) become React layout routes with<Outlet/>;DashboardLayout's named<router-view name="body">→ a nested<Outlet/>. Each leaf swapscomponent: ReactPageMount, props:{page:"X"}forlazy: () => import("@/react/pages/.../X")— replacing the island mount + theimport.meta.globregistry. One React root; pages render in-place. - Navigation:
useNavigate/useParams/useLocation/<Navigate>replacerouter.push/useRoute. - Route names: existing name constants (
AUTH_SIGNIN_MODULE, …) are kept and attached ashandle: { name }so the guard,useRecentVisit, and module back-path tracking keep working unchanged.
§2 Auth / session model + guard
Session source of truth → app-store AuthSlice. Port the Pinia auth store
1:1 onto the slice:
- State:
currentUser,unauthenticatedOccurred,requireResetPassword,authSessionKey,isSelfEmailUpdate. Getter:isLoggedIn. - Methods:
login,signup,logout,fetchCurrentUser,setRequireResetPassword,sendEmailLoginCode,updateCurrentUserNameForEmailChange— bodies copied verbatim; only the navigation calls swapped (router.push→ the React Router instance'srouter.navigate(...); data routers expose.navigate()).
Auth interceptor: authInterceptorMiddleware.ts flips unauthenticatedOccurred
on a 401 — repointed from useAuthStore() to useAppStore.getState().
SessionExpiredSurface already reacts to that flag (now reads the app store).
<AuthGate> (replaces AuthContext.vue): reads isLoggedIn /
unauthenticatedOccurred from the app store, calls fetchCurrentUser() on mount
when not loaded, and gates render exactly like AuthContext.vue (watch on
currentUserName, isSelfEmailUpdate handling).
The guard (replaces beforeEach): a single root-route loader that runs
on every navigation and reproduces the existing guard step-for-step:
- same-route loop guard → 2. 403/404 direct access → 3. OAuth/OIDC callbacks
direct → 4. OAuth2 consent → 5. allow 2FA-setup / password-reset / profile-setup
when logged in → 6. module back-path tracking → 7. logged-in-on-auth-route
redirect (relay_state/redirect) → 8. auth-route store resets
(resetDatabases/instances/projects) → 9. not-logged-in → signin redirect (with
redirectquery) → 10. enforce 2FA → 11. enforce password reset → 12. allowed-route-patterns → 13. 404 fallback. It reads the matched route'shandle.name(mirroring vue route names), reads session from the app store, andthrow redirect()where the old guard callednext({name}).
§3 Route table, the 79 bridges, reverse islands
- Route table: mechanical translation of the ~102 routes; layouts → layout
routes; leaf routes →
lazyimports; name constants →handle.name. The SQL-editor "layout as a page" island collapses into a normal layout route. - The 79
useVueStatebridges: each reads a Vue-reactive source that is being deleted, so each is rewritten — vue-router reads (useRoute/router/currentRoute) →useParams/useLocation/useNavigate; Pinia-auth reads → app-store auth selectors; app-shell Pinia-bridge reads (theDashboardFrameShelllegacy bootstrap +syncSubscriptionToPinia) → those bridges are deleted once the Vue shell that needed them is gone, so they become direct app-store selectors. ThenuseVueState.ts, the Vue reactivity primitives (effectScopeinProjectSidebar), and the page-mount/glob registry are removed. This ~79-file sweep is the single largest mechanical part and the main reason the PR is big. - vue-i18n (5 importers) → react-i18next (React already uses it); the
ReactPageMountlocale-sync watcher goes away. - pev2 reverse island: re-implement the Postgres query-plan visualizer
(
PostgresPlanView.tsx, currentlycreateApp(pev2)) in React sovueis fully removed. The one piece of genuinely net-new UI; isolated in its own commit.
§4 Internal build order (within the one PR)
- Add
react-router-dom; author the nested route table +handle.name+lazyimports (not wired to the root yet). - Port the auth slice (verbatim bodies) + the guard loader +
<AuthGate>+ repoint the interceptor. - Build
<RootLayout>+ the 3 React layout routes. - Flip
main.tsto the single React root (RouterProvider); dropcreateApp(App)+#react-app. - Sweep the 79
useVueStatebridges → React Router hooks / app-store selectors; deleteuseVueState+ Vue reactivity primitives + glob registry. - Replace pev2 with a React plan visualizer.
- Delete the Vue shell (
App.vue,AuthContext.vue, 3 layouts, 5 mount bridges,ReactPageMount, Pinia auth store, old guard) + removevue/vue-router/pinia/vue-i18n/@vueuse/@vitejs/plugin-vue/vue-tsc+ clean the Vite config + addcheck-react-no-pinia.mjs.
Verification ("no breaking changes" gate)
- Guard unit tests mirroring every
beforeEachbranch (not-logged-in→signin, logged-in-on-auth-route→home, 2FA enforce, password-reset enforce, 403/404, OAuth callback passthrough, consent). - Full
type-check/check/test(the existing 2308-test suite; pages are unchanged React, so their tests stand). - Manual QA of critical flows: login, logout, session-expiry (401→surface), OAuth/OIDC callback, 2FA setup, password reset, deep-link to a protected route (→signin→back), workspace switch, SQL-editor entry.
- History/back-button parity:
createBrowserRouter↔ the oldcreateWebHistory.
Risks & mitigations
- Guard (highest risk): verbatim port + unit tests + auth-flow QA.
- pev2 React rebuild: the only net-new UI; isolated commit, screenshot-compare.
- 79-file sweep: mechanical; caught by type-check + existing page tests.
- Two-stage rollback safety: built in internal order so each commit type-checks.
Out of scope
projectIamPolicyPinia store: its bridge stays until the permission/workspace layer migrates (separate, pre-existing).- Any page-level UI/behavior change — this is a host swap only.