Skip to content

Skip rebase reports success but leaves the branch unchanged when its new head doesn't advance t #2111

Open

Description

@bplatz

Problem

A ConflictStrategy::Skip rebase whose new head lands at a t no greater than the branch's current head does nothing, and reports success. This happens whenever the rebase skips at least as many commits as the source gained since the branch point. The branch keeps its old head commit: the skipped commit's data is still there, and none of the source's new commits are. The returned report still counts the replayed and skipped commits.

Reproduction

  1. mydb:main at t=1 (ex:alice ex:name "Alice"); create branch dev.
  2. On dev: insert ex:alice ex:name "Alice-dev" (t=2), then ex:eve ex:name "Eve" (t=3).
  3. On main: insert ex:alice ex:name "Alice-main" (t=2).
  4. rebase_branch("mydb", "dev", ConflictStrategy::Skip) returns replayed=1, skipped=1.

The rebased head is main's t=2 plus one replay, so t=3: the same t as dev's head before the rebase. Afterwards the dev record's commit_head_id is unchanged, and both the rebasing instance and a second instance over the same storage read ["Alice", "Alice-dev", "Eve"]. Expected: ["Alice", "Alice-main", "Eve"].

rebase_skip_conflicting in fluree-db-api/tests/it_rebase.rs is this scenario. It passes because it only asserts that Eve is present, which was already true before the rebase.

Cause

apply_rebase (fluree-db-api/src/rebase.rs) advances the branch with publish_commit(&branch_id, new_head_t, last_head_id). That is the commit path's monotonic publish: in the memory, file and storage nameservices a commit_t that does not exceed the record's is a no-op returning Ok(()). A rebase replaces the branch's history rather than extending it, so its new head need not have a greater t. The replayed commit blobs are written before the publish and are left unreferenced.

Direction

Advance the ref with a compare-and-set against the pre-rebase head (StagedRebase::pre_rebase_head_id), as merge's fast-forward path and push already do with compare_and_set_ref, and return an error if it is refused. The test should assert that the skipped commit's data is gone and that another instance sees the new head.

Only the local path was reproduced. The Raft path proposes the ref advance through consensus and was not checked.

Found while reviewing #2052, which keys the cross-ledger governance cache by the model ledger's head commit, so the cache stays correct once a branch's head can return to an earlier t.

Activity

  1. added
    bug
    P2
    area:transact
    on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:transactbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions