3.7 KiB
3.7 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 01-guard-plan-editor-lifecycle | Guard the plan editor lifecycle | done | 1 | plan.md | ../../specs/ui/requirements/plan-editor-task-switch-stability.md |
Task 01: Guard the Plan Editor Lifecycle
Acceptance
- A task switch cannot expose an editor that belongs to the outgoing task.
- Plan search does not access a null or destroyed editor.
- Plan-comment commands do not access an editor from the outgoing task.
- Plan search works after the selected task editor becomes available.
- A sidebar task switch with the Plan panel open does not show route recovery.
Verification
- If dependencies are absent, run
cd apps && pnpm install --frozen-lockfile. - RED: Run the focused editor-lifecycle test before production changes.
- Unit: Run
cd apps && pnpm --filter @kandev/web test -- components/task/use-plan-find-shortcut.test.tsx components/task/task-plan-panel.session-switch.test.tsx. - Type check: Run
cd apps/web && pnpm run typecheck. - Lint: Run
cd apps && pnpm --filter @kandev/web lint. - Internationalization: Run
cd apps/web && pnpm run i18n:check. - Desktop E2E: Run
cd apps/web && pnpm e2e:run tests/search/plan-search.spec.ts -- --grep "switches sidebar tasks" --retries=0. - Repository check: Run
git diff --checkfrom the repository root.
Verify that Playwright discovers the expected test before using the browser run as evidence. The managed runner builds and removes its isolated processes.
Files likely touched
apps/web/components/task/use-plan-find-shortcut.tsapps/web/components/task/use-plan-find-shortcut.test.tsxapps/web/components/task/task-plan-panel.tsxapps/web/components/task/task-plan-panel.session-switch.test.tsxapps/web/e2e/tests/search/plan-search.spec.ts
Dependencies
None.
Parallelism
Sequential. Editor ownership, command guards, and regression coverage form one TDD slice.
Inputs
- Behavioral contract:
docs/specs/ui/requirements/plan-editor-task-switch-stability.md. - System design:
docs/specs/ui/system-design/plan-editor-task-switch-stability.md. - Root-cause trace and implementation plan:
plan.md. - Plan search hook:
apps/web/components/task/use-plan-find-shortcut.ts. - Plan panel state:
apps/web/components/task/task-plan-panel.tsx. - Existing browser coverage:
apps/web/e2e/tests/search/plan-search.spec.ts.
Output contract
Report the RED result, implementation summary, changed files, exact test
results, cleanup evidence, blockers, and risks. Update this task and plan.md.
Results
- RED: The two editor-lifecycle tests failed because the original search hook
read the
commandsgetter after the editor was destroyed. - GREEN: The focused Vitest run passed 2 files and 5 tests after task-scoped editor ownership and destroyed-editor guards were added.
- Browser regression: The managed Playwright run passed the sidebar task-switch scenario in 15.0 seconds. The route remained loaded, the selected Plan content changed, and plan search highlighted matches after the switch.
- Static checks: Frontend typecheck, ESLint, i18n validation, specification
lint, and
git diff --checkpassed. - Evidence: The Playwright run captured
plan-search--plan-task-switch-stable.pngfrom synthetic E2E data for the PR. - Cleanup: The managed E2E runner completed successfully and removed its isolated runtime.
- Residual risk: The regression uses the desktop layout because the failure is in shared editor lifecycle code. Mobile composition and interaction behavior are unchanged.
- PR fixup: Exact-head review added the plan-comment acceptance criterion, made the empty-owner guard explicit, and expanded the destroyed-editor test across query, close, navigation, and cleanup paths.