Repository navigation
feat(herdr-core): keep splits, order and zoom in an ovis-layout document, laid out top down - #2830
Conversation
…is keeps the layout hc has no workspace, tab or split API. On a core whose herdr-app document was never written (the desktop app's own core), the adapter keeps names, splits and a pane's move to another workspace in terminal labels, and ping reports which layout calls it answers. The UI gates each layout action on that offer instead of one herdr-core boolean.
…e on new tabs, refuse a helper's move to Other terminals Review round: a split records the pane it split (ovis.split=<dir>:<pane>) and a label-made tab is tiled as that split tree; tab.create and pane.split carry the workspace's name; moving a helper to Other terminals is refused, as its parent's tab would still show it.
…eir own Panes of a label-kept tab take their rects from their terminals' grids, and the attach sizes each terminal to its cell, so split panes shrank each other (a shell went to one row). ping now reports layout.split false, pane.split stays unsupported, and the split-tree layout goes until top-down geometry lands.
…ent, laid out top down On a herdr-core no Herdr app arranges, Ovis now keeps the order of workspaces and tabs, each tab's split tree and its zoom in one hc document, ovis-layout (schema 1), written with doc.get -> edit -> doc.set(version) and one retry on conflict. Membership and names stay in terminal labels; every snapshot reconciles the document with them. Every tab, the Herdr app's included, is now cut top down from a fixed 1000x1000 area by its tree, never from terminal grids: a viewer resized each terminal to its cell and the grid read back as the rect made split panes shrink each other (#2812). pane.split, layout.set_split_ratio, pane.resize, pane.swap, pane.zoom, tab.move, workspace.move and pane.rename are answered on Ovis-kept tabs; ping reports layout.split and layout.arrange only where hc's hello names doc.set. The Herdr app's document is only read. Worktrees get their own offer flag so they stay hidden on herdr-core.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 17 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
- Read ovis-layout before the terminal list, so an edit never prunes a pane another writer added under the version it writes against. - Apply tab and workspace moves to the order as each attempt reads it, anchored on the entry they go before: a concurrent reorder stays, and a drop after Other terminals or among a parent's helper tabs lands. - Claim the terminals of the Herdr app's hidden nodes and inactive stack children, so they show nowhere else. - Keep every pane of a deep split at least one unit wide. - Place a leaf a document names twice once. - Offer no split or arrange, and start no split shell, where ovis-layout is in a schema this Ovis does not know; say so when a split pane could not be placed.
|
Review round 1 (omo at 9c57999: BLOCK on MEDIUMs, no HIGH; Codex Terra xhigh: no HIGH, six MEDIUM). Fixed in b109f31, each with a test:
Validation at b109f31: |
Pane rects on herdr-core are shares of a fixed 1000x1000 area now, so an observer or keep_size attach that started at the pane's rect asked hc for a 1000x1000 terminal. Panes carry their terminal's grid (HerdrPane.grid) and the attach reads it first (paneGrid). Also: a split in a zoomed tab unzooms it, so the new pane is in view; and every child of a Herdr app stack shows again (Ovis cannot switch the active one), only hidden nodes are held back.
|
Review round 2 (omo at b109f31: BLOCK on one reproduced HIGH). Fixed in f0a17c2:
Validation at f0a17c2: |
A terminal under a hidden node was left out of the snapshot, so closing its tab or workspace from Ovis ended the shown panes and left it running out of reach. Hidden nodes are laid out with the rest again, like stack children: Ovis can neither show nor switch them, and each closes with its tab.
# Conflicts: # server/herdr-core/adapter.test.ts # server/herdr-core/adapter.ts # server/herdr-core/live.test.ts # server/herdr-core/snapshot.ts # server/herdr/client.ts # shared/machines.ts # src/components/CommandPalette.appLayout.test.tsx # src/components/CommandPalette.tsx # src/components/PaneCanvas.appLayout.test.tsx # src/components/Sidebar.appLayout.test.tsx # src/components/Sidebar.tsx # src/components/TabStrip.appLayout.test.tsx # src/lib/machineContext.test.ts # src/lib/machineContext.tsx
|
Merged origin/main (with #2799) at 89405e8, no force-push. Remaining LOW findings, not fixed in this PR (one fix round is spent):
|
|
Merged origin/main (with #2829) at 587fc39 with no conflicts and no force-push. |
Fixes #2812
Follows #2799 (merged); this branch has origin/main merged in.
What
On a herdr-core no Herdr app arranges (the desktop app's own core), Ovis now keeps the layout itself, and split panes no longer shrink each other:
ovis-layout(schema 1): orderedworkspaces[], each with orderedtabs[], each tab a split tree ({leaf}or{split: right|down, ratio, first, second}) andzoomed. Written asdoc.get-> edit ->doc.set(version), with one retry onconflict. Membership and names stay in terminal labels (herdr.space,herdr.tab,ovis.*), so a Herdr app started later still adopts the terminals.cols/rows. This also applies to tabs from the Herdr app's document, laid out bysize.weight, with astackshowing its active child andhiddennodes skipped.splits[]is filled with herdr's path ids (split_<n>_<path>), so divider drag and keyboard resize work unchanged.pane.split,layout.set_split_ratio,pane.resize,pane.swap(neighbour or explicit),pane.zoom,tab.move,workspace.move,pane.rename(ovis.panelabel).pingreportslayout.split/layout.arrangeonly where hc's hello listsdoc.set(capabilities come fromhello.methods, never from version strings).HelloInfonow carriesmethods.herdr-app. Aovis-layoutwritten in an unknown schema is neither read nor overwritten.LayoutOffergainsworktrees(always false on herdr-core), soarrangecan turn on without offering worktrees.Why
Issue #2812: a pane's rect was its terminal's grid, the attach resized the terminal to its cell, and the next snapshot read that grid back, so nested splits collapsed (a shell went to 8x1). Labels alone can't hold order, ratios or zoom, and they can't be written atomically across terminals. That's why the order and tree live in one CAS document.
Public contract:
docs/herdr-core-layout.md(labels table, document format, reconcile and write rules);docs/guide.mdherdr-core section updated.Validation
snapshot.test.tsherdr-core: lay out split panes top-down so they do not shrink each other, then offer split #2812 replay (split right, then left pane down, viewers size terminals to their cells, three snapshots must have identical rects) fails on feat(herdr-core): rename, split and move workspaces and tabs where Ovis keeps the layout #2799's head 2e9c37a (rects follow the grids) and passes now.bun test server/herdr-core/: 165 pass, 0 fail (with the review-round fixes, see the PR comment). The new adapter cases cover split right/down as one tree, the CAS retry, ratio/resize/swap/zoom, reorder with Other terminals last, prune/append, a foreign-schema document and the app document refusing writes, and pane names.server/herdr-core/live.test.ts, isolated hc core: own session, state and socket): hc 0.1.14 (CI's pin) 7 pass / 0 fail. On hc 0.1.17 everything passes except the existing schema-pin test (it pins 0.1.14, as noted in feat(herdr-core): rename, split and move workspaces and tabs where Ovis keeps the layout #2799). The live case splits right then down, attaches each terminal at 15x1 / 56x29 (herdr-core: lay out split panes top-down so they do not shrink each other, then offer split #2812's sizes) and checks the rects are unchanged across snapshots.bun run check fast: pass on the merge with origin/main 89405e8 (unit 11312 pass, 0 fail). Review rounds and their fixes: see the PR comments.check full, a manual desktop-app session.Follow-ups / known limits
cols/rows. That's a viewer-policy issue, not geometry.