7.2 KiB
7.2 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-reconcile-env-switch-transcript-placement | Reconcile environment-switch transcript placement | done | 1 | plan.md |
|
|
|
Task 01: Reconcile Environment-switch Transcript Placement
Summary
Arm a session-scoped placement request for environment-changing Dockview switches, defer the incoming transcript until its layout and latest history are ready, and block automatic older-history pagination during that window. Prove that enabled and disabled sessions resolve from their own state while same- environment and ordinary layout behavior remain unchanged.
Failing regressions first
- Add a store action test that performs an
env-atoenv-bswitch and requires a tokened request for the incoming session whilependingChatScrollTopremains null. Require the same-environment early return not to arm a request. - Add a native-scroll hook case with outgoing and incoming sessions, distinct saved offsets, a matching environment-switch token, and a pending history refresh. Require no initial write or pagination eligibility until the incoming rows settle.
- Complete the refresh with a larger scroll height and require an enabled session to land at the current bottom.
- Repeat with auto-scroll disabled and require the incoming session's saved offset, never the outgoing session's offset.
- Add a cached-entry session-message test that holds the background
message.listpromise and requires the placement-readiness signal to remain pending until that exact refresh settles. - Add a desktop Playwright case that switches between two overflowing tasks in different environments and fails on the current top reset.
In scope
- Add and consume the tokened Dockview transcript-placement request.
- Extend activation pending to support a visible external reactivation token.
- Expose cached history-refresh readiness without changing loading copy or presentation.
- Block the older-history sentinel while environment placement is unresolved.
- Cover the env-switch store action, absolute scroll preservation isolation, initial placement, session-specific saved offset, pagination block, and same-environment behavior.
- Add the desktop differing-environment browser regression and run the existing mobile auto-scroll suite.
- Update plan and work-order results after implementation.
Out of scope
- Reusing
preserveChatScrollDuringLayoutfor the environment switch. - Changing saved-offset persistence, auto-scroll controls, pagination page sizes, or message fetching contracts.
- Changing maximize, un-maximize, preset/custom layout, explicit navigation, unread divider, or live-tailing behavior.
- New copy, layout, responsive composition, or mobile navigation.
Acceptance
- A cross-environment switch places an enabled incoming transcript at the bottom after its latest history settles, without applying the outgoing session's offset.
- A disabled incoming transcript restores only its own saved offset.
- Automatic top-intersection pagination remains blocked until placement is complete, and same-environment switching retains the current path.
Verification
cd apps && pnpm --filter @kandev/web test -- lib/state/dockview-env-switch-action.test.ts lib/state/dockview-scroll-preserve.test.ts hooks/domains/session/use-session-messages.test.ts components/task/chat/transcript-auto-scroll.test.ts components/task/chat/message-list-native.test.tsx
cd apps && NODE_ENV=production pnpm --filter @kandev/web test -- lib/state/dockview-env-switch-action.test.ts lib/state/dockview-scroll-preserve.test.ts hooks/domains/session/use-session-messages.test.ts components/task/chat/transcript-auto-scroll.test.ts components/task/chat/message-list-native.test.tsx
cd apps/web && pnpm run typecheck
cd apps && pnpm --filter @kandev/web lint
cd apps/web && pnpm e2e:run --host --project chromium tests/chat/auto-scroll-toggle.spec.ts -- --grep "environment-changing task switch" --retries=0
cd apps/web && pnpm e2e:run --host --no-build --project mobile-chrome tests/chat/mobile-auto-scroll-toggle.spec.ts -- --retries=0
python3 scripts/lint-spec-files.test.py
python3 scripts/lint-spec-files.py --all
git diff --check -- docs/specs/ui docs/plans/transcript-env-switch-scroll apps/web/components/task/chat apps/web/components/task/task-chat-panel.tsx apps/web/hooks/domains/session apps/web/lib/state apps/web/e2e/tests/chat
Run pnpm install --frozen-lockfile from apps/ before the first package
command in a fresh worktree.
Files likely touched
apps/web/lib/state/dockview-store.tsapps/web/lib/state/dockview-env-switch-action.test.tsapps/web/lib/state/dockview-scroll-preserve.test.tsapps/web/hooks/domains/session/use-session-messages.tsapps/web/hooks/domains/session/use-session-messages.test.tsapps/web/components/task/chat/use-chat-panel-state.tsapps/web/components/task/task-chat-panel.tsxapps/web/components/task/chat/message-list-shared.tsxapps/web/components/task/chat/message-list-native.tsxapps/web/components/task/chat/message-list-native-scroll.tsapps/web/components/task/chat/message-list-native.test.tsxapps/web/components/task/chat/transcript-auto-scroll.tsapps/web/components/task/chat/transcript-auto-scroll.test.tsapps/web/e2e/tests/chat/auto-scroll-toggle.spec.ts
Dependencies
None.
Risks
- A request that is not session- and token-checked can clear or reposition a later task switch.
- Placement must wait for both layout and cached-history refresh readiness, not only one signal.
- The sentinel block must be released after the final placement write, not when the request is first observed.
Parallelism
sequential
Inputs
REQ-UI-TRANSCRIPT-AUTO-SCROLL-001, criteria 11 through 13.docs/specs/ui/system-design/transcript-auto-scroll.md, especially Environment-change rebuild lifecycle.- Existing env-switch store-action and native-scroll hook harnesses.
- Existing desktop and mobile transcript auto-scroll Playwright suites.
Results
- Added a session-scoped, tokened Dockview placement request that is armed only by environment-changing switches and never captures the outgoing transcript's absolute offset.
- Added cached-entry history-refresh readiness and delayed native placement until both Dockview and message history settle. Auto-scroll writes and the older-history sentinel stay inactive while the request owns placement.
- Added unit regressions for enabled bottom placement, disabled incoming offset, stale-token completion, same-environment behavior, pagination blocking, and isolation from absolute layout restore.
- Added a desktop Playwright regression using two confirmed distinct task environments. It covers enabled and disabled return trips through the task sidebar.
- Verification passed: focused Vitest in test and production modes (128 tests), full Vitest (1,756 files and 15,076 tests, with 4 skipped), typecheck, lint, Prettier, spec lint, desktop Playwright (1 test), and mobile Playwright (5 tests).