# Final view-state fix report ## Summary - Preserve the forced opening Decisions flow until the first ordinary prose block, then move to Plan once even when the saved preference is Decisions. - Selecting Decisions now reveals, scrolls to, and focuses the first unanswered card. Resolved history starts collapsed, and the control names its unanswered count for assistive technology. - Removed only unreferenced sidecar grid CSS and stale layout comments. Active `data-plan-sidecar-*` hooks remain in the focused and inline projections. ## Files - `apps/web/src/app.tsx`, `apps/web/src/decision-view-control.tsx`, and `apps/web/src/decision-view.test.ts` - `packages/editor/src/decision-state.ts`, `packages/editor/src/decision-state.test.ts`, `packages/editor/src/decisions.tsx`, and `packages/editor/src/decisions.test.tsx` - `e2e/sidecar.e2e.ts` - `apps/web/src/workspace.tsx`, `packages/editor/src/plan-editor.tsx`, and `packages/editor/src/styles.css` ## RED `bun test packages/editor/src/decision-state.test.ts packages/editor/src/decisions.test.tsx apps/web/src/decision-view.test.ts` produced the intended four failures: - saved Plan changed to Plan as soon as opening questions resolved; - saved Decisions stayed on Decisions after first prose; - the Decisions control omitted the unanswered accessible name; - resolved history was open with no stored preference. The focused browser test also failed before implementation because the first questionnaire card remained inactive after returning to Decisions. ## GREEN and verification - `bun test packages/editor/src/decision-state.test.ts packages/editor/src/decisions.test.tsx apps/web/src/decision-view.test.ts apps/web/src/tokens.test.ts` — 36 pass, 0 fail. - `bun node_modules/@playwright/test/cli.js test --config e2e/playwright.config.ts e2e/sidecar.e2e.ts --grep "selecting Decisions returns"` — 1 pass. - `TMPDIR=/private/tmp bun node_modules/@playwright/test/cli.js test --config e2e/playwright.config.ts` — 67 pass, 0 fail. - `TMPDIR=/private/tmp bun test` — 616 pass, 0 fail. - `bun run types` — pass. - `DPRINT_CACHE_DIR=/private/tmp/dprint-cache bun run ci` — pass. - `bunx dprint fmt` on changed source and test files — pass. - `git diff --check` — pass. ## Commit `Fix decisions view lifecycle and navigation` ## Risks The opening transition is client-local UI state by design; no room phase, protocol field, or migration was introduced. Comment-layer interaction was not changed. ## Follow-up: one-shot opening phase ### Summary - Replaced the remembered boolean with an explicit `initial` / `forced` / `complete` local lifecycle. A forced opening remains Decisions through answer resolution, selects Plan when its first prose arrives, and cannot become forced again if prose is later removed. - Focused view navigation now uses immediate `scrollIntoView`, which does not impose motion on reduced-motion users. ### RED `bun test packages/editor/src/decision-state.test.ts` failed as intended: after an opening room completed, removing prose with a saved Plan preference returned Decisions instead of Plan. ### GREEN and verification - `bun test packages/editor/src/decision-state.test.ts apps/web/src/decision-view.test.ts packages/editor/src/decisions.test.tsx` — 11 pass, 0 fail. - Focused Playwright navigation and Show-in-plan coverage — 2 pass. - `TMPDIR=/private/tmp bun test` — 620 pass, 0 fail. - `bun run types` — pass. - `DPRINT_CACHE_DIR=/private/tmp/dprint-cache bun run ci` — pass. - `bun run build` — pass. - `TMPDIR=/private/tmp bun run e2e` — 69 pass, 0 fail. - `git diff --check` — pass. ### Show-in-plan investigation The supplied trace showed no product navigation race. The target questionnaire was resolved and correctly hidden under the new `1 resolved` disclosure, while the injected development questionnaire was the only visible card. The browser test now explicitly opens resolved history before finding the target. ### Commit `Complete the one-shot opening phase`