Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
refactor: keep the WorkEditor header DOM order equal to its desktop order so tab order still matches the layout (#3568)
[._.]/ Adam Eivy037b660d0144
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 24f51d36b2..a5790961c0 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -192,4 +192,4 @@- **[issue-3578] Image-to-3D renders no longer stall the progress bar on a stage banner that lands across two chunks.** The shared generate driver split each `data` chunk from the generator on its own, with nothing carried between them — but a child process hands out its output on arbitrary byte boundaries, so a banner like "Baking textures at 2048px" could arrive as two halves, neither of which matched any stage signature. The percent then sat where the previous banner left it until the next one happened to land whole, which on the long sampling phase reads as a hung render. Both lanes now feed their output through the same buffered line reader the rest of the app's subprocess streams use, which stitches the partial line back together and flushes whatever is left when the child exits — so a generator that writes its final "Saved:" line without a trailing newline still has its asset path read. stdout and stderr keep separate buffers, since a shared one would splice a partial line from one stream onto a chunk from the other. Tqdm's carriage-return redraws still surface as individual frames, and the raw output kept for classifying a non-zero exit is unchanged, so an out-of-memory or gated-model failure is still named the same way.- **[issue-3565] Three Writers Room controls are now big enough to hit on a phone.** The Edit pencil on every Cast/Places/Objects bible row was an 11px icon with no padding around it — an ~11x11px tap target sitting next to the row text, so a thumb aiming for it selected the entry description instead. The snapshot Revert button in the Polish panel was 11px text and a matching icon on a row with no vertical padding of its own (~16px tall), and the World style Clear button in the Storyboard config tab was bare 9px text (~10x22px). All three now clear the 44px floor the rest of the app uses. Each one bleeds into the padding its own row already had rather than adding height on top of it, so the bible list and the snapshot list keep their density and the Clear button stays inside its stack gap instead of overlapping the style dropdown beneath it.- **[issue-3579] Refusing a 3D model install on unsupported hardware now says why in English, and a new reason code can no longer go label-less.** The image-to-3D registry answers "can this host run that target?" with stable codes like `requires-linux-host` and `cuda-probe-failed`; the 3D page turned those into sentences from a hand-written table of its own, and the install endpoint had no table at all — so asking to install a target this machine can't run streamed back "This host cannot run TRELLIS.2 (CUDA) (requires-linux-host)", handing the user the internal code instead of the one thing they could act on. Both sides now render the same shared map, which lives next to the function that returns the codes and is mirrored to the client the way the catalog type registry already is. A parity test asserts the two copies never drift, and — the reason the drift was worth fixing rather than just re-syncing — it also reads the resolver's source and asserts the labelled set still *equals* the codes it can actually return. The previous arrangement failed silently: the CUDA lane added three codes by hand on each side, and a fourth that someone forgot to mirror would have rendered as the generic "Unsupported on this host" with every test still green.-- **[issue-3568] The Writers Room prose editor starts above the fold on a phone again.** The work header laid out every control in one wrapping row, so at ~375px the title field, status dropdown, Edit/Read/Review toggle, Save, Snapshot and the Work menu stacked into four or five rows and ate 250-300px of a 667px screen — the textarea you came to write in began below the fold before the keyboard even opened. The header is now two compact rows on a phone: title, Save and the Work menu on the first, and the three secondary controls on a sub-bar of their own beneath it, with the view toggle collapsing to its three icons so that row stays single-line. Nothing moved into the overflow menu — every control is still one tap away — and the desktop layout is byte-for-byte the same single row in the same left-to-right order, because the sub-bar dissolves back into the header row at `sm` and up rather than being a second copy of the controls. Each control on the phone rows now clears the 44px touch floor, and the icon-only view toggles carry their names for screen readers.+- **[issue-3568] The Writers Room prose editor starts above the fold on a phone again.** The work header laid out every control in one wrapping row, so at ~375px the title field, status dropdown, Edit/Read/Review toggle, Save, Snapshot and the Work menu stacked into four or five rows and ate 250-300px of a 667px screen — the textarea you came to write in began below the fold before the keyboard even opened. The header is now two compact rows on a phone: title, Save, Snapshot and the Work menu on the first, and the status dropdown plus the view toggle on a sub-bar of their own beneath it. The view toggle and Snapshot drop their text labels under `sm` so both rows stay single-line at 375px, keeping their names for screen readers. Nothing moved into the overflow menu — every control is still one tap away — and the desktop layout is the same single row in the same left-to-right order, because the sub-bar dissolves back into the header row at `sm` and up rather than being a second copy of the controls: the markup order *is* the desktop order, so the desktop tab order still follows what is on screen. Each control on the phone rows now clears the 44px touch floor.diff --git a/client/src/components/writers-room/WorkEditor.jsx b/client/src/components/writers-room/WorkEditor.jsxindex 2a2adb3813..ee84e79551 100644--- a/client/src/components/writers-room/WorkEditor.jsx+++ b/client/src/components/writers-room/WorkEditor.jsx@@ -729,14 +729,14 @@ export default function WorkEditor({ work, onChange, onToggleExercise, exerciseO<div className="flex flex-col h-full">{/*Header — one wrapping row on desktop, two compact rows on phones (#3568).- Under `sm` the secondary controls (status, view mode, snapshot) live in- their own full-width sub-bar so the first row is just title + Save +- Work menu; at `sm+` that wrapper becomes `display: contents` and its- children rejoin the single header row. The `sm:order-*` classes restore- the original left-to-right desktop sequence (title · status · view mode ·- Save · Snapshot · menu) that the DOM regrouping would otherwise shuffle.- Every control stays on screen at every width — nothing is hidden behind- the menu, so the prose editor clears the fold without losing reach.+ Under `sm` the status select and view-mode toggle move to a full-width+ sub-bar of their own (`order-last`) so the first row is just title, Save,+ Snapshot and the Work menu; at `sm+` the sub-bar is `display: contents`,+ generating no box, so its children are direct flex items of the header+ row again. DOM order is therefore the desktop order — no `order` classes+ on the controls themselves — which keeps desktop tab order matching what+ is on screen. Every control stays visible at every width; nothing was+ pushed into the overflow menu to buy the space.*/}<div className="flex flex-wrap items-center gap-2 px-4 py-2 border-b border-port-border bg-port-card"><input@@ -744,20 +744,64 @@ export default function WorkEditor({ work, onChange, onToggleExercise, exerciseOonChange={(e) => setTitle(e.target.value)}onBlur={commitTitle}onKeyDown={(e) => { if (e.key === 'Enter') e.target.blur(); }}- className="bg-transparent text-base font-semibold text-white border-none focus:outline-none focus:bg-port-bg/50 px-1 rounded flex-1 min-w-[140px] sm:min-w-[180px] min-h-[44px] sm:min-h-0 order-1 sm:order-1"+ className="bg-transparent text-base font-semibold text-white border-none focus:outline-none focus:bg-port-bg/50 px-1 rounded flex-1 min-w-[140px] sm:min-w-[180px] min-h-[44px] sm:min-h-0"aria-label="Work title"/>+ {/* Secondary controls. `w-full order-last` gives them their own compact+ row below the primary actions under `sm`; `sm:contents` dissolves the+ wrapper so they sit inline — in this DOM order — on desktop. */}+ <div className="w-full order-last flex items-center gap-2 sm:contents" data-testid="work-header-secondary">+ <select+ value={status}+ onChange={(e) => commitStatus(e.target.value)}+ className="bg-port-bg border border-port-border rounded px-2 py-1 min-h-[44px] sm:min-h-0 text-[11px] text-gray-300"+ aria-label="Status"+ >+ {Object.entries(STATUS_LABELS).map(([k, l]) => <option key={k} value={k}>{l}</option>)}+ </select>+ {/* Not a true tablist (no separate panels keyed off tab id, no roving+ tabindex, no arrow-key cycling). aria-pressed is the semantically+ correct primitive for a toggle group. The text labels collapse to+ icon-only under `sm` to keep this row single-line at ~375px, so+ each button carries an explicit aria-label. */}+ <div className="flex items-center bg-port-bg border border-port-border rounded p-0.5" role="group" aria-label="View mode">+ {VIEW_MODES.map(({ id, label, icon: Icon, title: viewTitle }) => (+ <button+ key={id}+ type="button"+ aria-pressed={viewMode === id}+ aria-label={label}+ onClick={() => setViewMode(id)}+ className={`flex items-center gap-1 px-3 sm:px-2 py-2 sm:py-0.5 min-h-[40px] sm:min-h-0 text-[11px] rounded ${+ viewMode === id ? 'bg-port-card text-white' : 'text-gray-400 hover:text-gray-200'+ }`}+ title={viewTitle}+ >+ <Icon size={11} /> <span className="hidden sm:inline">{label}</span>+ </button>+ ))}+ </div>+ </div><buttononClick={handleSave}disabled={!dirty || saving}- className={`flex items-center gap-1 px-3 py-1 min-h-[44px] sm:min-h-0 text-xs rounded order-2 sm:order-4 ${+ className={`flex items-center gap-1 px-3 py-1 min-h-[44px] sm:min-h-0 text-xs rounded ${dirty && !saving ? 'bg-port-accent text-white hover:bg-port-accent/80' : 'bg-port-bg text-gray-500'}`}title={dirty ? 'Save (Ctrl/Cmd+S)' : 'Up to date'}><Save size={12} /> {saving ? 'Saving…' : dirty ? 'Save' : 'Saved'}</button>- <div className="relative order-3 sm:order-6" ref={overflowRef}>+ <button+ onClick={handleSnapshot}+ disabled={dirty}+ aria-label="Snapshot"+ className="flex items-center gap-1 px-3 py-1 min-h-[44px] sm:min-h-0 text-xs rounded bg-port-bg border border-port-border text-gray-300 hover:text-white disabled:text-gray-600 disabled:cursor-not-allowed"+ title="Snapshot the active draft as a new version"+ >+ <GitCommit size={12} /> <span className="hidden sm:inline">Snapshot</span>+ </button>+ <div className="relative" ref={overflowRef}><buttononClick={() => setOverflowOpen((v) => !v)}className="flex items-center justify-center px-3 sm:px-2 py-1 min-h-[44px] sm:min-h-0 text-xs rounded bg-port-bg border border-port-border text-gray-300 hover:text-white"@@ -809,49 +853,6 @@ export default function WorkEditor({ work, onChange, onToggleExercise, exerciseO</div>)}</div>- {/* Secondary controls. `w-full` forces its own compact row under `sm`;- `sm:contents` dissolves the wrapper so these are direct flex items- of the header row again on desktop. */}- <div className="order-4 w-full flex items-center gap-2 sm:contents" data-testid="work-header-secondary">- <select- value={status}- onChange={(e) => commitStatus(e.target.value)}- className="bg-port-bg border border-port-border rounded px-2 py-1 min-h-[44px] sm:min-h-0 text-[11px] text-gray-300 sm:order-2"- aria-label="Status"- >- {Object.entries(STATUS_LABELS).map(([k, l]) => <option key={k} value={k}>{l}</option>)}- </select>- {/* Not a true tablist (no separate panels keyed off tab id, no roving- tabindex, no arrow-key cycling). aria-pressed is the semantically- correct primitive for a toggle group. The text labels collapse to- icon-only under `sm` to keep this row single-line at ~375px, so- each button carries an explicit aria-label. */}- <div className="flex items-center bg-port-bg border border-port-border rounded p-0.5 sm:order-3" role="group" aria-label="View mode">- {VIEW_MODES.map(({ id, label, icon: Icon, title: viewTitle }) => (- <button- key={id}- type="button"- aria-pressed={viewMode === id}- aria-label={label}- onClick={() => setViewMode(id)}- className={`flex items-center gap-1 px-3 sm:px-2 py-2 sm:py-0.5 min-h-[40px] sm:min-h-0 text-[11px] rounded ${- viewMode === id ? 'bg-port-card text-white' : 'text-gray-400 hover:text-gray-200'- }`}- title={viewTitle}- >- <Icon size={11} /> <span className="hidden sm:inline">{label}</span>- </button>- ))}- </div>- <button- onClick={handleSnapshot}- disabled={dirty}- className="flex items-center gap-1 px-3 py-1 min-h-[44px] sm:min-h-0 text-xs rounded bg-port-bg border border-port-border text-gray-300 hover:text-white disabled:text-gray-600 disabled:cursor-not-allowed sm:order-5"- title="Snapshot the active draft as a new version"- >- <GitCommit size={12} /> Snapshot- </button>- </div></div>{runningKind && (diff --git a/client/src/components/writers-room/WorkEditor.test.jsx b/client/src/components/writers-room/WorkEditor.test.jsxindex 32c8ee0739..575c40f593 100644--- a/client/src/components/writers-room/WorkEditor.test.jsx+++ b/client/src/components/writers-room/WorkEditor.test.jsx@@ -5,11 +5,11 @@ import { MemoryRouter } from 'react-router';// Header layout contract for #3568: on a ~375px phone the WorkEditor header// used to wrap into 4-5 rows and push the prose textarea below the fold. The-// fix regroups the secondary controls (status, view mode, snapshot) into one-// full-width sub-bar under `sm` while `sm:contents` dissolves that wrapper on-// desktop so the single-row layout — and its left-to-right order — is-// unchanged. jsdom doesn't apply Tailwind, so these assert the class contract-// that drives the layout plus the behaviour that must survive the regroup.+// fix moves the status select and view-mode toggle into a full-width sub-bar+// that `sm:contents` dissolves back into the single header row on desktop —+// so DOM order stays the desktop order and only the phone layout changes.+// jsdom doesn't apply Tailwind, so these assert the class contract that drives+// the layout plus the behaviour that must survive the regroup.vi.mock('./StoryboardPanel', () => ({default: function StoryboardPanelStub() { return <div data-testid="storyboard-panel" />; },@@ -54,7 +54,6 @@ async function renderEditor() {return view;}-// The header controls, in the order they must read left-to-right on desktop.function headerControls() {const title = screen.getByLabelText('Work title');return {@@ -64,49 +63,56 @@ function headerControls() {viewGroup: screen.getByRole('group', { name: 'View mode' }),save: screen.getByRole('button', { name: /^Sav/ }),snapshot: screen.getByRole('button', { name: 'Snapshot' }),- menu: screen.getByLabelText('Work menu').closest('div'),+ // The `relative` wrapper that positions the dropdown, not the button.+ menu: screen.getByLabelText('Work menu').parentElement,};}-function orderOf(el) {- const match = /(?:^|\s)sm:order-(\d+)(?:\s|$)/.exec(el.className);- return match ? Number(match[1]) : null;-}-beforeEach(() => {vi.clearAllMocks();});describe('WorkEditor header layout (#3568)', () => {- it('keeps the first header row to title + Save + Work menu on mobile', async () => {+ it('gives the secondary controls their own row under sm and none of their own on desktop', async () => {await renderEditor();- const { header, title, save, menu } = headerControls();+ const { status, viewGroup } = headerControls();const secondary = screen.getByTestId('work-header-secondary');- // Four direct children: three first-row controls plus the sub-bar.- expect([...header.children]).toEqual([title, save, menu, secondary]);- // The sub-bar takes a full row of its own under `sm`…+ // Its own full-width row, ordered after the primary actions, under `sm`…expect(secondary.className).toContain('w-full');- // …and dissolves into the header row at `sm+`.+ expect(secondary.className).toContain('order-last');+ // …dissolved into the header row at `sm+`.expect(secondary.className).toContain('sm:contents');+ for (const el of [status, viewGroup]) {+ expect(secondary.contains(el)).toBe(true);+ }});- it('parks status, view mode and snapshot in the mobile sub-bar', async () => {+ it('leaves title, Save, Snapshot and the Work menu on the first mobile row', async () => {await renderEditor();- const { status, viewGroup, snapshot } = headerControls();+ const { header, title, save, snapshot, menu } = headerControls();const secondary = screen.getByTestId('work-header-secondary');- for (const el of [status, viewGroup, snapshot]) {- expect(secondary.contains(el)).toBe(true);+ expect([...header.children]).toEqual([title, secondary, save, snapshot, menu]);+ // Only the sub-bar is re-ordered; anything else carrying an `order-*` class+ // would either break the row split or desync tab order from the layout.+ for (const el of [title, save, snapshot, menu]) {+ expect(el.className).not.toMatch(/(?:^|\s)(?:sm:)?order-/);}});- it('restores the original left-to-right control order on desktop', async () => {+ it('keeps DOM order equal to the desktop left-to-right order', async () => {await renderEditor();const { title, status, viewGroup, save, snapshot, menu } = headerControls();- const expected = [title, status, viewGroup, save, snapshot, menu];- expect(expected.map(orderOf)).toEqual([1, 2, 3, 4, 5, 6]);+ // title · status · view mode · Save · Snapshot · menu — the pre-#3568+ // desktop sequence, and (because nothing sets `order` on desktop) the tab+ // order a keyboard user gets.+ const sequence = [title, status, viewGroup, save, snapshot, menu];+ for (let i = 0; i < sequence.length - 1; i += 1) {+ const relation = sequence[i].compareDocumentPosition(sequence[i + 1]);+ expect(relation & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();+ }});it('renders every control exactly once — nothing is duplicated per breakpoint', async () => {@@ -117,19 +123,20 @@ describe('WorkEditor header layout (#3568)', () => {expect(screen.getAllByRole('group', { name: 'View mode' })).toHaveLength(1);});- it('keeps view-mode buttons named when their labels collapse to icons under sm', async () => {+ it('keeps buttons named when their labels collapse to icons under sm', async () => {await renderEditor();- const { viewGroup } = headerControls();+ const { viewGroup, snapshot } = headerControls();for (const name of ['Edit', 'Read', 'Review']) {const button = within(viewGroup).getByRole('button', { name });- // The visible text is hidden under `sm`, so the name comes from aria-label.expect(button).toHaveAttribute('aria-label', name);expect(within(button).getByText(name).className).toContain('hidden sm:inline');}+ expect(snapshot).toHaveAttribute('aria-label', 'Snapshot');+ expect(within(snapshot).getByText('Snapshot').className).toContain('hidden sm:inline');});- it('gives the mobile-visible header controls a 44px touch target', async () => {+ it('gives the header controls a 44px touch target on mobile', async () => {await renderEditor();const { title, status, save, snapshot } = headerControls();const menuButton = screen.getByLabelText('Work menu');