Repository navigation
Description
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
mydb:mainat t=1 (ex:alice ex:name "Alice"); create branchdev.- On
dev: insertex:alice ex:name "Alice-dev"(t=2), thenex:eve ex:name "Eve"(t=3). - On
main: insertex:alice ex:name "Alice-main"(t=2). rebase_branch("mydb", "dev", ConflictStrategy::Skip)returnsreplayed=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