Repository navigation
Preview workspace slice 1 — baseline renderer interaction contract #942
Description
Important
Problem -- The prior Preview workspace work relied on unit and browser-harness checks while the real interaction contract remained uncharacterized. That allowed a scroll feedback loop and CodeMirror lifecycle regressions to reach a Dev Host. Before any workspace shell changes, the working Preview renderer must have a browser-backed behavioral contract.
Approach -- Add a focused Playwright characterization suite against the known-good single-file Preview baseline. The slice exercises the same Preview entry points a researcher uses and records observable behavior for Markdown editing, scrolling, saving, and Sidebar click routing. It makes no workspace UI or renderer ownership change.
Scope -- in: Playwright Chromium provisioning, preview fixtures, interaction assertions, and a reproducible local/CI command. Out: inner tabs, persistent renderer hosts, pane trees, drag-and-drop, breadcrumb navigation, workspace state, scroll persistence, and any modification to PreviewFileView or PreviewEditor.
Assumptions -- The existing baseline renderer is the behavior to preserve. If a characterization test fails, the failure is investigated as a baseline defect before #943 begins; the test is not weakened to accommodate a new workspace implementation.
Acceptance Criteria
- Playwright Chromium is provisioned and the Preview browser suite runs locally and in CI; a missing browser is a blocking setup failure, not a waived test.
- A Markdown file opened through the normal Preview route can enter Edit mode, finish asynchronous language loading, receive typed text in CodeMirror, and retain focus in CodeMirror rather than moving to the composer.
- The test proves the composer does not receive the editor's typed characters after Markdown language loading settles.
- A normal Preview document scroll advances the renderer's actual scroll container and remains at the user-selected position after queued animation frames settle.
- Cmd+S from the Preview editor reaches the existing file-write path with the current editor content and does not move focus to the composer.
- Sidebar single-click continues to route a file to Preview, while Sidebar double-click continues to open the native VS Code editor; the existing extension behavior remains covered.
- Existing Home, Files Changed, Context, Pulse Inspector, and outer-tab behavior remain unchanged by the test fixture and pass their current regressions.
- The suite is stable enough to run repeatedly without timing sleeps that mask renderer readiness; readiness is observed through visible renderer/editor state.
Test Contract
The tests describe externally observable behavior, not component internals:
- Open a real Markdown fixture through the Preview bridge used by Sidebar and Chat file pills.
- Focus the visible CodeMirror content, type after the language chunk has settled, and assert both the editor document and active element.
- Scroll the actual visible Preview renderer, wait for browser frames, and assert its position rather than a workspace-level proxy.
- Invoke Cmd+S and assert the mock file-write request and retained editor focus.
- Exercise the existing single-click and double-click routing boundary from the extension suite.
Constraints And Invariants
- No production Preview implementation changes land in this slice.
- Happy DOM and unit tests may support the suite but cannot substitute for a real Chromium interaction test.
- This issue establishes the baseline contract for all later Preview workspace slices. A later implementation may extend the suite but may not remove or relax these assertions without an explicit parent-issue decision.
- A failure found here blocks Preview workspace slice 2 — persistent renderer pool and inner tabs #943. It is fixed or deliberately re-scoped before renderer pooling, tab retention, or pane behavior is introduced.
Follow-On
#943 begins only after this contract is green. It adds persistent renderer hosts and inner tabs while preserving every behavior defined here.
Source
Part of #940 and ADR 0013. Replaces this issue's former lifted-workspace-state and renderer-hydration plan.
Activity
[-]Preview workspace slice 1 — lifted workspace state + single-pane tab bar[/-][+]Preview workspace slice 1 — baseline renderer interaction contract[/+]jeonghun-jj-lee commentedon Sep 10, 2026
Completed in harmoniqs/opencode commit d1e791192a. The focused Chromium Preview baseline contract passes locally and in CI; app typechecks and unit/browser-harness tests are green.