Skip to content

Testing: reusable real-dockview layout regression-test utility #837

Description

@svenmalvik

Summary

Layout state managed by dockview is a recurring source of subtle bugs that only surface when the app is live-driven (sidebars resizing when a pane moves, sidebar widths collapsing to equal thirds, panels remounting/flashing on restore). A jsdom + real-dockview test harness already reproduced one of these (#803) at width 0. Turning that into a documented, reusable regression-test utility would let new layout work ship with a test by default instead of being caught by the user after the fact.

Issue Type

  • Follow-up work
  • Reliability issue

Priority

  • P2 - important but non-blocking

Area

Renderer — dockview layout (src/renderer/hooks/dock-layout/**, App.tsx, dock panel components).

Expected Behavior

Layout regressions (restore, pane move, sidebar sizing, panel remount) are caught by a reusable test harness that drives real dockview under jsdom, including the width-0 / unmeasured-dock case.

Actual Behavior

Layout bugs are found by the user during live use, then fixed reactively. In #803 the wrong root cause was fixed twice (PRs #806 and #807) before the real one — applyDefaultLayout losing the 1:4:1 ratio when fromJSON runs at width 0 — was identified.

Steps to Reproduce

  1. Change dock layout logic (restore, default layout, sidebar sizing).
  2. Look for an existing reusable harness to regression-test it.
  3. Observe each fix re-derives its own test scaffolding.

Evidence

Sessions: sarpsborg-4 ("When I move a pane around, the width of both sidebars increases"), issue-803 ("It's still not fixed"), 712-sidebar-collapse-button. Seven dockview gotchas are recorded in agent memory (project_dock_sidebar_thirds_803, project_dockview_fromjson_remounts, project_dockview_setconstraints_lazy, project_dockview_active_panel_replay, project_fixed_popovers_need_portal, project_dockview_header_action_slots, project_sidebar_action_buttons) — evidence this surface bites repeatedly.

Frequency

  • Intermittent (per layout change)

Suspected Cause

No shared harness for real-dockview layout tests; each fix rebuilds test setup, and the width-0 restore path is easy to miss.

Suggested Next Step

Extract the real-dockview jsdom setup used for #803 into a documented test utility (mount at a nominal size, at width 0, and after fromJSON restore), with helpers to assert sidebar ratios and panel identity across restore. Reference it from docs/architecture/renderer.md so new layout work adds a regression test by default.

Validation After Fix

A new test using the utility reproduces the #803 equal-thirds regression at width 0 and passes on the fixed code; the sarpsborg-4 pane-move-widens-sidebars case is covered too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:rendererSubsystem: rendererclaudeClaude createdenhancementNew feature or requestoss-coreOpen, MIT-licensed, implemented in this repo (free tier)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions