Repository navigation
feat(longform): non-destructive stage transitions with diff-aware propagation + confirm dialogs - #46
Merged
Merged
Conversation
…pagation + confirm dialogs Replaces the "wipe arrangement+pills on any chunk dirty" pattern with ID-aware diff propagation: a Triage edit prunes only the arrangement items whose chunk vanished, and the Editor's existing reconcilePills handles pill geometry refresh on its own. User-edited cuts/FX/pills survive Triage tweaks instead of disappearing silently. Confirm dialogs gate the genuinely destructive transitions: - Reject chunk in arrangement: confirm with item/cut/FX counts - Split chunk in arrangement: 3-way pick (Replace A / B / Both A→B) - Merge chunks isolated in arrangement: replace-all or cancel merge - Delete arrangement item with editor edits: confirm with counts - Remove cam with cuts/userEdited pills: confirm with counts Adjacent-merge collapses silently. Duplicate copies pills/cuts/FX onto the clone with shifted timeline ranges. DetectionPanel now preserves chunk ids on slider re-detect so an arrangement is no longer quietly emptied by a small threshold tweak. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
reconcilePillshandles pill geometry refresh on its own. User-edited cuts/FX/pills survive Triage tweaks instead of disappearing silently.Why
Pre-change, navigating back from the Editor to Triage and tweaking a single chunk silently destroyed the entire arrangement and every editor edit. The Editor already had a robust ID-stable
reconcilePillsmerge — it was just being short-circuited by an upstream wipe. The fix is to let the merge do its job and only ask the user before truly destructive operations (everything else propagates silently).Action matrix (all confirmed by user during planning)
Triage
Sync
Arrange
Implementation notes
New pure helpers (all unit-tested)
frontend/src/local/edits-impact.ts— counters:countEditsAffectedByChunkRemoval/ByItemRemoval/ByCamRemoval, plusisAlwaysAdjacentInArrangement.frontend/src/local/triage/diff-arrangement.ts—propagateTriageChangesToArrangement(prevChunks, nextChunks, arrangement). Removes items whose chunk is gone or rejected; preserves identity when nothing changed (so the persist-hook fingerprint stays cheap).frontend/src/local/triage/triage-arrangement-ops.ts—applySplitToArrangement(...)andapplyMergeToArrangement(...). Pure transforms invoked after the Triage store mutation lands.Imperative dialog API
frontend/src/lib/confirm.ts—confirmDestructive/chooseSplitReplacement/confirmMergeReplaceAllpush requests onto a tiny zustand store; await the Promise.frontend/src/components/ConfirmDialogHost.tsx— single-mount modal renderer. Esc cancels; Enter confirms (destructive flavour only). Backdrop click cancels.Guarded action wrappers
frontend/src/local/triage/triage-guarded-actions.ts—rejectFocusedGuarded,splitFocusedGuarded,joinFocusedGuarded. Wired intoTriageTransportBar(keyboard shortcuts + Drop button) andChunkInspector(Split / Join prev / Join next).frontend/src/local/arrange/arrange-guarded-actions.ts—removeItemGuarded(counts-aware confirm + IDB pruning),duplicateItemWithEdits(clones pills/cuts/FX onto the new item with timeline-shifted ranges).Minimal call-site changes
useTriagePersist.ts— wipe replaced withpropagateTriageChangesToArrangement. No morepills: [].useArrangePersist.ts—pills: []wipe removed entirely.DetectionPanel.tsx— re-detection merge now keepsprev.id(no 8000 t justprev.accepted) so a small slider tweak doesn't quietly empty the arrangement.LaneHeader.tsx— dropswindow.confirm; the count-aware confirm now lives inEditor.tsx'sonDeleteClipso it can read pills/cuts/fx.Verification
npx tsc -b✓npx vitest run --project=unit→ 1010/1010 pass (26 new tests acrossedits-impact,diff-arrangement,triage-arrangement-ops).Test plan
arrEndSreflects new geometry;userEditedpills keep theirsourceOutedits.syncOverrideMs/ re-run sync → no dialog; pills shift automatically.🤖 Generated with Claude Code