Fix tab-strip + historical proposal bugs from master#638
Merged
Conversation
Co-authored-by: bobbit-ai <bobbit@bobbit.ai>
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>
…istorical proposals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
All three pass deterministically; full E2E suite is green.
Validation
🤖 Generated with Bobbit