Skip to content

[codex] Fix changed clip ID merge contract - #26

Merged
explicit09 merged 1 commit into
mainfrom
codex/issue-4-merge-contract
May 21, 2026
Merged

[codex] Fix changed clip ID merge contract#26
explicit09 merged 1 commit into
mainfrom
codex/issue-4-merge-contract

Conversation

@explicit09

Copy link
Copy Markdown
Owner

Summary

Fixes the issue #4 merge contract gaps found in review:

  • advance the current branch when merge_changed_clip_ids targets HEAD
  • treat clip position changes as changed clip IDs
  • apply source-side clip deletions and reorders when overlaying non-overlapping changes

Root Cause

The changed-clip merge path keyed changes only by clip contents, so source moves were invisible. Its overlay also replaced or appended source clips but never removed clips deleted by the source branch. Finally, successful HEAD target merges created a commit without advancing the current branch ref.

Validation

  • cargo fmt --check
  • cargo test -p vedit-core
  • cargo test

Closes #4.

@explicit09
explicit09 marked this pull request as ready for review May 21, 2026 18:11
@explicit09
explicit09 merged commit 5d6357c into main May 21, 2026
8 checks passed
@explicit09
explicit09 deleted the codex/issue-4-merge-contract branch May 21, 2026 18:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 948bb018f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +449 to +455
if let TrackChild::Clip(anchor) = child
&& let Some(anchor_id) = &anchor.clip_id
&& !source_changed.contains(anchor_id)
&& let Some(index) = target_clip_index(target_track, anchor_id)
{
return Some(index + 1);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve order of adjacent trailing source changes

When multiple changed clips appear consecutively at the end of a source track, this insertion logic can reverse their order in the merged result. In source_insertion_index, each trailing clip anchors to the same unchanged predecessor (index + 1), so later clips are inserted before earlier ones (e.g., source x,a,b with a,b changed merges as x,b,a). This produces an incorrect timeline ordering even for non-overlapping merges.

Useful? React with 👍 / 👎.

Comment on lines 340 to 342
if let TrackChild::Clip(clip) = child
&& let Some(id) = &clip.clip_id
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Count all clip positions when detecting clip moves

Move detection misses cases where an identified clip changes position relative to clips without IDs, because clip_index is only tracked for TrackChild::Clip values that already have clip_id. If a no-ID clip is inserted/moved before an identified clip, that identified clip keeps the same computed index and is treated as unchanged, so source-side reorder edits can be silently dropped during changed-clip-ID merges.

Useful? React with 👍 / 👎.

Comment on lines +369 to +373
TrackChild::Clip(clip) => clip
.clip_id
.as_ref()
.is_none_or(|id| !source_changed.contains(id)),
_ => true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Drop stale transitions and gaps with removed changed clips

This retain pass removes changed clips but always keeps non-clip children, so source-side clip deletions can leave dangling transitions/gaps from the target timeline. For example, deleting a changed clip that had an adjacent transition preserves that transition even though one side of it is gone, producing an invalid or semantically corrupted track ordering after an otherwise “clean” merge.

Useful? React with 👍 / 👎.

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.

vedit-core: add stable merge command contract for source/optional-target and merge result metadata

1 participant