Skip to content

Fix tab-strip + historical proposal bugs from master#638

Merged
SuuBro merged 5 commits into
masterfrom
goal/fix-tab-strip-2988bd28
May 25, 2026
Merged

Fix tab-strip + historical proposal bugs from master#638
SuuBro merged 5 commits into
masterfrom
goal/fix-tab-strip-2988bd28

Conversation

@SuuBro
Copy link
Copy Markdown
Owner

@SuuBro SuuBro commented May 25, 2026

Fix three E2E test failures introduced by the recent master chain
(98f7f0c Chrome-style tab strip, 122f76f editable historical proposals,
dac3668 docs/test updates). All three were marked `test.fixme` by PR #637
to keep CI green; this PR restores them to `test(...)` and ships the
underlying fixes.

Bugs fixed

Bug 1 — Preview iframe URL uses artifact path for live tab

`src/app/render.ts` (`restoreHistoricalPreviewTab` and `htmlPreviewContent`)
computed the live-tab predicate as `tab.id === LIVE_PREVIEW_PANEL_TAB_ID
|| tab.id.startsWith("preview:live")`, but the actual current-preview tab
id is `preview:entry:`. Result: artifact-id was folded into the live
iframe URL. Replaced both sites with the canonical `isLivePreviewTab()`
helper from `panel-workspace.ts`.

Bug 2 — Historical project proposal panel renders empty Components view

`tab.state.fields` for a historical `propose_project` snapshot has
`build_command` etc. at the top level but no synthesized `components`
array. The live wire path folds those server-side
(`LEGACY_KEY_MAP` in `server.ts`), but historical snapshots skip that step
and `projectProposalPanel` filters legacy keys out of its render loop.
`proposalPanelContent` now mirrors the server fold at the historical
override seam, synthesizing a single default component when the snapshot
has none. Identity short-circuit preserved via a new
`_proposalOverrideSource` ref so re-projection doesn't fire every render.

Bug 3 — Drag-drop allows reordering past pinned tabs

SortableJS `onMove` returned `false` for the target candidate that would
land on/before a pinned tab, but intermediate non-pinned swaps during the
same sweep had already mutated the DOM. `onMove` now climbs to the
`.goal-tab-pill` ancestor (for child-element hits) and sets a
`panelSortablePinnedBlocked` flag across the whole drag; `onEnd` skips
the state commit AND restores the DOM order from an `onStart` snapshot
when the flag is set. Defense-in-depth: also revert if the final order
places any non-pinned tab before any pinned tab.

Tests restored

The three `test.fixme` markers added by master commit 3b091a7 are
removed:

  • `tests/e2e/ui/preview-happy-path.spec.ts::"iframe src is /preview//?mtime="`
  • `tests/e2e/ui/proposal-revision-snapshots.spec.ts::"propose + edit + open-old card opens a historical tab while the latest draft stays live"`
  • `tests/e2e/ui/side-panel-tabs.spec.ts::"6. Desktop drag reorder persists and cannot move tabs before pinned Inbox"`

All three pass deterministically; full E2E suite is green.

Validation

  • `npm run check` ✓
  • `npm run test:unit` ✓
  • Targeted specs pass (15/15) ✓
  • Full `npm run test:e2e` ✓ (no new regressions vs master baseline)

🤖 Generated with Bobbit

SuuBro and others added 5 commits May 25, 2026 01:18
Historical project-proposal tabs render the raw tool-input snapshot of
`propose_project`, which has `build_command`, `test_command`, etc. at the
top level but no synthesized `components` array. The live wire path folds
those legacy keys into `components[0].commands` server-side
(`LEGACY_KEY_MAP` in server.ts), but historical snapshots skip that step,
and `projectProposalPanel` filters legacy keys out of its render loop —
so an older rev with `build_command: "echo old"` rendered an empty
"Components 0 — No components proposed." panel.

Mirror the server fold in `proposalPanelContent`'s historical seam: when
`type === "project"` and the snapshot has no non-empty `components`,
synthesize a single default component carrying the mapped commands and
`worktree_setup_command`. The projection runs only when seeding the
override, never against the live activeProposals slot, and never mutates
the raw `tab.state.fields` snapshot.

Track the raw source ref in `_proposalOverrideSource` so the identity
short-circuit still works (otherwise re-projecting on every render
produces a fresh object and defeats the guard).

Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
Bug 1: `isLiveTab` predicate in restoreHistoricalPreviewTab and
htmlPreviewContent only matched `preview:live*` ids, but the real
current-preview tab id is `preview:entry:<file>` (per
previewTabIdentityForContent). Result: the artifact-id segment was
folded into the live iframe src. Replace inline predicates with the
canonical isLivePreviewTab() helper from panel-workspace.

Bug 3: SortableJS onMove returns false for the single candidate target
that would land on/before a pinned tab, but earlier non-pinned swaps
during the same sweep had already mutated the DOM (e.g. dragging
pinnedB left past pinnedA toward pinned inbox — pinnedA↔pinnedB swap
commits before inbox blocks). Track a pinned-blocked flag across the
whole drag in onMove (climbing evt.related to its .goal-tab-pill
ancestor for child-element hits), and in onEnd:

  - if blocked at any point: skip the state commit AND manually
    restore the DOM order from a snapshot captured at onStart, since
    lit-html's repeat doesn't reliably re-position elements after
    external DOM shuffling
  - defense-in-depth: also revert if the final order places any
    non-pinned tab before any pinned tab

Tests: tests/e2e/ui/preview-happy-path.spec.ts and
tests/e2e/ui/side-panel-tabs.spec.ts pass (10/10, 30/30 with
--repeat-each=3).

Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
@SuuBro SuuBro merged commit f112d4b into master May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant