Closed general

workspace apply removes existing tabs that teardown does not restore (round trip loses the user's layout)

Colby Knox · 1mo ago ·closed by Colby Knox

adom-cli 0.6.3 on Colby's container, full cycle on an app-free bench (kcknox/ztest-bench-lite: editor | 3d-viewer + one webview):

  • before: Visual Studio Code | Staging, Web View, Hero Studio, KiCad Dashboard
  • after apply: Visual Studio Code | 3D, Hydrogen (the four existing tabs in the non-editor pane were removed, as the plan's step 4 says)
  • after teardown: Visual Studio Code alone. Teardown removed exactly the two tabs apply created (correct) but did not bring back the four it had displaced, so the user ends with less than they started with. I re-added them by hand through split/add-tab.

Ask: make the cycle round-trip. Two options, either is fine:

  1. apply records the tabs it removes (panelType, panelState, pane position) in the same _applied ledger, and teardown restores them after removing what it created (restore before removing the last tab of a pane, so the pane-close branch is not needed).
  2. apply defaults to merge mode (keep existing non-editor tabs, add the bench's tabs beside them, shape panes around them) and only removes existing tabs with --replace; then teardown's "remove what I created" already round-trips.

Option 2 is also what Hydrogen Cloud's Apply button implies to a user (nothing they had open disappears without asking). Whichever is chosen, --dry-run should print the displaced tabs so the user sees what will move.

1 Reply

Colby Knox · 1mo ago

Shipped in adom-cli 0.7.0 (GH v0.7.0, wiki package 4.3.0), taking the merge-by-default option since it is what the cloud's Apply button implies, plus the ledger-and-restore for --replace so both proposals landed:

  • Merge is the default: apply keeps every existing pane and tab, reuses a bench tab whose name already exists by navigating it, and adds the rest to a work pane. Your exact repro now round-trips losslessly in merge mode: before Staging/Web View/Hero Studio/KiCad Dashboard; after apply the same five plus the bench's additions (Staging and Web View reused, not duplicated); after teardown exactly the additions gone, everything original intact.
  • --replace keeps the exact rebuild and ledgers every displaced non-editor tab (name, url, panelType) in the _applied record; teardown restores them. One subtlety your repro would have hit: displaced tabs whose names the bench REUSED (the same file replacing Staging with its own Staging) restore after the bench copies are removed, everything else restores before removals so a pane never empties. Verified live: replace displaced four tabs, teardown removed the bench's four and restored all four displaced, final bench identical to the start.
  • --dry-run prints the mode and, for replace, the exact tabs that would be displaced.

The same release carries the bench-identity handoff: export writes project from the nearest page.json (verified writing adom/adom-cli from the package checkout), apply keys the _applied ledger by project#path and stamps launched registry entries with the owning bench, lingering_apps names each app's bench, teardown accepts the identity or a unique bare-ref prefix, and the cloud mirror sends project beside path and workspace.

Log in to reply.