4.5 KiB
4.5 KiB
id, title, status, wave, depends_on, plan, requirements, acceptance_criteria, system_design
| id | title | status | wave | depends_on | plan | requirements | acceptance_criteria | system_design | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01-preserve-plan-comments | Preserve plan comments across session switches | done | 1 | plan.md |
|
|
|
Task 01: Preserve Plan Comments Across Session Switches
Summary
Separate Tiptap projection reconciliation from user-authored mark deletion so changing Agent sessions cannot remove pending comments from browser state. Reset stale comment-editor state on session changes and verify the full user flow with focused tests.
In scope
- Add private transaction provenance to programmatic comment-mark reconciliation.
- Preserve orphan cleanup for real destructive plan edits.
- Reset open plan-comment selection/edit state when
activeSessionIdchanges. - Add unit, component, and desktop multi-session E2E regressions.
Out of scope
- Comment data-model, storage-key, API, backend, or WebSocket changes.
- Moving comments between sessions.
- Mobile or desktop layout changes.
- Recovering previously deleted comments.
Acceptance
- Replacing the editor's session comment projection removes old visible marks without calling the destructive comment callback or changing stored drafts.
- A real user document edit that removes a marked range still deletes its pending comment exactly once, and a session change closes stale edit state.
- Returning to the owning session restores the pending comment's badge and exact feedback in the production-built desktop user flow.
Verification
cd apps && pnpm install --frozen-lockfile
cd apps/web && pnpm exec vitest run components/editors/tiptap/tiptap-plan-editor.test.tsx components/task/task-plan-panel.session-switch.test.tsx
cd apps/web && pnpm e2e:run tests/session/multi-session-ux.spec.ts -- --grep "preserves pending plan comments across session switches"
After specification or plan edits:
python3 scripts/lint-spec-files.py --all
git diff --check
Files likely touched
apps/web/components/editors/tiptap/comment-mark.tsxapps/web/components/editors/tiptap/tiptap-plan-editor.test.tsxapps/web/components/task/task-plan-panel.tsxapps/web/components/task/use-plan-selection.tsapps/web/components/task/task-plan-panel.session-switch.test.tsxapps/web/e2e/tests/session/multi-session-ux.spec.tsdocs/plans/plan-comment-session-switch-preservation/plan.mddocs/plans/plan-comment-session-switch-preservation/task-01-preserve-plan-comments.md
Dependencies
None.
Risks
- Transaction suppression must be limited to tagged projection reconciliation; otherwise genuine orphaned comments could remain.
- The session-change reset must not run on ordinary comment-store updates or close an editor while the owning session remains selected.
Parallelism
sequential
Inputs
REQ-UI-PLAN-COMMENT-DRAFTS-001and its system design.- Current
CommentMark,TipTapPlanEditor,TaskPlanPanel, and comment-store behavior. - Existing multi-session and Plan comment Playwright patterns.
- Confirmed temporary Vitest reproduction recorded in
plan.md.
Results
- Tagged every comment-mark projection transaction with private provenance and limited orphan cleanup to IDs removed by untagged document transactions and still absent from final document state.
- Cleared local selection, browser selection, and global comment-edit identity
when
activeSessionIdchanges. - RED unit evidence: projection replacement invoked the destructive callback; session replacement left the old comment textarea open.
- RED browser evidence: the primary-session badge count remained zero after a primary to sibling to primary round trip.
- GREEN unit command:
cd apps/web && pnpm exec vitest run components/editors/tiptap/tiptap-plan-editor.test.tsx components/task/task-plan-panel.session-switch.test.tsxpassed 7 tests in 2 files. - GREEN browser command:
cd apps/web && pnpm e2e:run tests/session/multi-session-ux.spec.ts -- --grep "preserves pending plan comments across session switches"passed its Chromium scenario against the production build. cd apps/web && pnpm run typecheckand focused ESLint passed. No backend, API, schema, persistence-key, mobile layout, or touch behavior changed.