← All Labs Lab 32 / 20 Substrate layout, 15-component framework & design.md theming stress test
Lab 32 · Durable agents · Learned

Substrate layout, 15-component framework & design.md theming stress test

20 Chrome CDP checks spanning zero DOM re-parenting, WAI-ARIA tablists, 10 dynamic closeable tabs, text selection/scroll retention, reload persistence, sibling HMR, 6-viewport sweep, Gaia replica, live ADR 0034 layout swaps, 15-component catalog + mock WS terminal, cross-component selection/form loops, 5 theme presets, 3 densities, and server/client design.md round-trip

Learned Needs: none Smoke: pnpm exec tsx examples/32-substrate-layout-stress-test/run.ts --smoke Run: pnpm exec tsx examples/32-substrate-layout-stress-test/run.ts Source: examples/32-substrate-layout-stress-test

Interactive gallery and 20-check automated Chrome CDP stress harness for @umwelten/substrate Shell layouts, the 15-component built-in framework, and the design.md visual identity compiler.

Live scenarios

Start the gallery locally on http://127.0.0.1:7490:

bash
pnpm exec tsx examples/32-substrate-layout-stress-test/run.ts

Then open:

  • / — Gallery index with links to all 8 live scenarios
  • /catalog/shell/ — Complete 15-component showcase (workbench-layout, fleet-connections, chat, kpi-strip, data-table, markdown-doc, workspace, detail-inspector, terminal over RFC 6455 mock WS, activity-log, beats, form-panel, connections, traces, theme-switcher)
  • /branded/shell/ — Server-injected TheFocus.AI Dark & Amber design.md (Ink #0E1014, Slate #1A1E26, Cream #F3F1EA, Amber #F2B33D, 0px square corners, 2px borders) applied automatically across both full workbench and /branded/shell/solo/kpi-strip/
  • /workbench/shell/ — 3-rail IDE workbench with nav-status, stress-controls, selectable-text, hmr-clock, chat, Overview, iframe-probe, live-editor, and traces
  • /gaia-clone/shell/ — 9-component Gaia Hub replica (fleet-connections left; Chat/Agents/Nodes/Keys/Users center; Inspector iframe + Traces right)
  • /custom-layout/shell/ — Runtime ADR 0034 layout swapper (3-Rail Workbench ↔ Bottom-Dock Drawer ↔ Focus Mode ↔ Bare Grid) via manifest reconciliation with zero page reload
  • /tab-overflow/shell/ — 14-tab overflow bar with horizontal scrolling, WAI-ARIA ArrowLeft/ArrowRight/Home/End navigation, and sibling HMR reload
  • /bare/shell/ — ADR 0034 base CSS auto-fill grid when no layout component is active

Running --smoke

bash
pnpm exec tsx examples/32-substrate-layout-stress-test/run.ts --smoke

Checks node --check on all 15 built-ins + 10 Lab 32 components, fetches all 13 HTTP routes (200 OK), and drives headless Chrome over CDP through all 20 stress checks with strict zero console/page error enforcement.

What we learned

Inspecting @umwelten/substrate/shell/components/workbench-layout.js, theme.css, and Gaia Hub's fleet-inspector.js / fleet-agents.js uncovered eight root causes behind the tab click/highlight breakage and layout instability:

  1. DOM re-parenting on tab switches & split toggles: Moving panels between centerBody / slotPrimary / slotSecondary and .umw-wb-parking tore <iframe> documents down and reloaded them on every switch (breaking fleet-inspector solo panels and ui:// apps), wiped panel scroll offsets, cleared text selections, and triggered MutationObserver removal noise. Fix: Panels now stay permanently inside zone containers (leftPanelsWrap, centerBody, rightBody) and toggle visibility strictly via data-wb-slot="primary" | "secondary" | "hidden".
  2. Recreating tab & nav <button> nodes on every render(): Calling replaceChildren() on centerTabs, rightTabList, and navSection inside click handlers destroyed the clicked button mid-gesture, breaking focus, breaking click+highlight interactions, and discarding keyboard focus. Fix: Cached tab/nav elements are reconciled in place (reconcileOrder), preserving exact button DOM identity and enabling WAI-ARIA ArrowLeft/ArrowRight/Home/End keyboard navigation.
  3. Center tab bar stretched edge-to-edge without .umw-wb-tab-list: centerTabs used .umw-wb-tabs (justify-content: space-between) directly, stretching Gaia's 5 center tabs across the pane and overflowing horizontally under 5+ tabs. Fix: centerTabs now wraps tabs in .umw-wb-tab-list[role="tablist"] with left-aligned flex layout and clean horizontal scrolling.
  4. Card flex/scroll clipping: .umw-wb-center-body > .shell-card forced flex: 1; min-height: 0; without scroll isolation. Fix: Primary/secondary [data-wb-slot] panels share flex: 1 1 0; min-height: 0; overflow-y: auto;, while full-bleed interactive cards (chat, terminal, fleet-inspector, [data-fill="true"]) flex cleanly to fill height.
  5. Viewport overflow & stuck drag state over iframes: Fixed pixel widths pushed the right pane past narrow (980px–1200px) viewports, and missing pointer capture left umw-wb-resizing (user-select: none) stuck when releasing over an iframe. Fix: Viewport-aware width clamping via ResizeObserver, setPointerCapture with pointercancel/blur cleanup, body.umw-wb-resizing iframe { pointer-events: none; }, and user-select: none scoped strictly to workbench chrome (tabs, headers, resizers) rather than panel content.
  6. Origin-wide localStorage collision: umw.workbench.v1 shared one key across /shell/ and /agents/<id>/shell/. Fix: Scoped persistence to umw.workbench.v2:${pathname}.
  7. Gaia fleet-inspector tab lookup & topbar order: b.textContent === "Inspector" missed "Inspector (2)" in split mode. Fix: Use serviceKey("shell:workbench") (openRightTab("fleet-inspector")) with [data-panel-id="fleet-inspector"] fallback and consistent topbar button ordering.
  8. Solo-page guard & non-panel filtering: workbench-layout now no-ops without header.topbar (unless forceMount: true) and skips <style>, <script>, <dialog>, and [data-workbench-ignore="true"].