You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/RESTART_PLAN.md
+39-40Lines changed: 39 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -282,49 +282,48 @@ Each phase has:
282
282
283
283
**Deliverables:**
284
284
285
-
1.**Root Vitest workspace config**
286
-
- Create `vitest.workspace.ts` at repo root mapping each package/app to its own `vitest.config.ts` or `vite.config.ts`.
287
-
-`apps/web` must use its `vite.config.ts` (which has `@vitejs/plugin-vue` + `happy-dom`).
288
-
- All other packages use their own `vitest.config.ts` or a default node environment.
289
-
290
-
2.**Fix `apps/web` test failures**
291
-
-`app.test.ts`: must mount `App.vue` without parser errors.
292
-
-`router.test.ts`: must instantiate router without `window is not defined`.
293
-
-`useSession.test.ts`: must pass all 6 cases without cross-test leakage.
294
-
-`page-editor-tiptap-extensions.test.ts`: must run without Vue SFC parse errors.
295
-
296
-
3.**Fix `useSession` singleton leakage**
297
-
- Option A: Convert `useSession` to a factory that returns fresh state per call, with a `provide/inject` or app-level singleton in production.
298
-
- Option B: Keep module singleton but add `destroySessionSingletonForTests()` that nulls `bootstrapInFlight` and clears any `Promise` caches.
299
-
300
-
4.**Fix router module-load side effect**
301
-
- Change `router.ts` to export `createAppRouter()` factory.
302
-
- Update `main.ts` to call the factory.
303
-
- Update `app.test.ts` and any test that needs a router to call the factory after DOM setup.
304
-
305
-
5.**CI integration test wiring**
306
-
- Add `services: postgres` to the GitHub Actions `test` job (or use `docker-compose up -d` in a step).
307
-
- Export `DATABASE_URL`, `DATABASE_ADMIN_URL`, `TEST_DB_TEMPLATE_NAME` so `template-db.test.ts` and `account-flows.integration.test.ts` run instead of skipping.
308
-
309
-
6.**Refactor `usePageCollabEditor.ts` into focused composables**
310
-
- Split the 708-line composable into `useCollabWebSocket.ts`, `useCollabPush.ts`, `useCollabCrypto.ts`, `usePageEditor.ts`. Each must be < 300 lines.
311
-
- Update `PageEditorView.vue` imports.
312
-
-**During the split, fix two collab bugs:**
313
-
- Add `ydoc.on('updateV2', schedulePush)` (guarded by `!hydrating.value`) so non-Tiptap Yjs mutations trigger collab push.
314
-
- Fix `single-update-ack` handler in `page-collab-ws-incoming.ts` so `serverStateVector` advances correctly (do not blindly set it to `Y.encodeStateVector(ydoc)`).
315
-
316
-
7.**Add collab updates pagination to backend**
285
+
1.**Root Vitest workspace config** ✅
286
+
-`vitest.workspace.ts` created at repo root mapping each package/app to its own config.
- Added missing `vitest.config.ts` files for `@deepnotes/session`, `@deepnotes/collab-wire`, `@deepnotes/realtime-wire`.
289
+
290
+
2.**Fix `apps/web` test failures** ✅
291
+
-`app.test.ts`: mounts `App.vue` without parser errors.
292
+
-`router.test.ts`: instantiates router without `window is not defined`.
293
+
-`useSession.test.ts`: passes all 6 cases without cross-test leakage.
294
+
-`page-editor-tiptap-extensions.test.ts`: runs without Vue SFC parse errors.
295
+
296
+
3.**Fix `useSession` singleton leakage** ✅
297
+
-`resetSessionSingletonForTests()` now recreates the `openapi-fetch` client via `createDeepnotesApiClient()`, preventing cross-test API mock pollution.
298
+
- Module-level `const client` changed to `let client` to allow reassignment.
-`app.test.ts` and `router.test.ts` call factory after DOM setup.
304
+
305
+
5.**CI integration test wiring** ⏳
306
+
- Add `services: postgres` to GitHub Actions `test` job.
307
+
- Export `DATABASE_URL`, `DATABASE_ADMIN_URL`, `TEST_DB_TEMPLATE_NAME` so integration tests run instead of skipping.
308
+
309
+
6.**Refactor `usePageCollabEditor.ts` into focused composables** 🔄
310
+
- Split into `useCollabWebSocket.ts`, `useCollabPush.ts`, `useCollabCrypto.ts`, `usePageEditor.ts`.
311
+
-`CollabWsIncomingContext` updated to use `serverDoc` + `unackedUpdates` instead of `serverStateVector`.
312
+
-**`single-update-ack` handler fixed:** advances `serverDoc` only with the acknowledged diff, not full `ydoc` state.
313
+
- Remaining: rewrite `usePageCollabEditor.ts` as thin orchestrator calling the 4 composables, then wire `PageEditorView.vue`.
314
+
315
+
7.**Add collab updates pagination to backend** ⏳
317
316
- Add `?sinceIndex=` query param to `GET /api/pages/:pageId/collab-updates`.
318
317
-`performGetPageCollabUpdates` must return at most 100 rows per request.
319
318
- Client bootstrap loop fetches incrementally until no more rows.
320
319
321
-
8.**Add root `vitest.workspace.ts` in `new-deepnotes`**
322
-
-The outer repo root (`DeepNotes/`) has its own `vitest.config.ts` for legacy. `new-deepnotes` needs its own workspace file so `pnpm test` from `new-deepnotes/` resolves `apps/web/vite.config.ts` correctly.
323
-
-Verify `pnpm test` from `new-deepnotes/` root passes with 0 failures.
320
+
8.**Add root `vitest.workspace.ts` in `new-deepnotes`** ✅
321
+
-File created and references all package/app configs.
0 commit comments