Skip to content

Push and pull apply graph drops - #2272

Merged
bplatz merged 4 commits into
mainfrom
feat/graph-drop-transfer
Nov 9, 2026
Merged

bplatz merged 4 commits into
mainfrom
feat/graph-drop-transfer

Conversation

@bplatz

@bplatz bplatz commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #2252

Summary

Push and pull refused every commit that drops a graph: commit transfer recorded a drop's revivals but never applied the drop. A transferred commit now applies as replaying it does: its drops at its t, then the dropped graphs it writes again, then its flakes. The receiver's index then stops serving what the drops took, so the receiver reads what the writer reads, at the head and as of any t.

Changes

fluree-db-api/src/commit_transfer.rs:

  • Apply (apply_pushed_commits_to_state, shared by push and incremental pull): each commit's drops and revivals (apply_graph_lifecycle) run before its flakes, in commit order, replacing the batch revive loop. hide_dropped_graphs runs afterward when the transfer drops anything. A pull split into pages applies each page onto the state the previous one left.
  • Validation (prepare_push): each commit is checked against the state the drops before it leave (validate_after_graph_lifecycle), so retraction checks, staging, SHACL and vector lengths see what the writer saw. A push that carries a drop registers its graphs on the validation state up front, under the ids routing already gives them, so a graph created, dropped and written again within one push resolves.
  • Policy: the per-commit policy context is built before the commit's drops apply; it was built after the retraction check, still once per commit. A commit that drops graphs, pushed under a context that is not root, is refused with the standard modify refusal (403), from drop_needs_unrestricted_identity, now exported by fluree-db-transact. The order matters: with f:defaultAllow and deny policies stored in the default graph, a DROP DEFAULT judged after its own drop would find no policy and pass as root.
  • A commit that only drops is no longer refused as an empty commit.
  • A dropping commit in merged_commits is still refused, with a new message: a merge never brings one in (refuse_merging_graph_drops), and merged commits are stored without replay.

Clone and pack pull already handled drops: they write the commit blobs and reload, and the reload replays the drops.

CLI: push_failure explains a refusal of the drop's commit flag (unknown envelope flags: 0x20) as a remote on an earlier release.

Docs: the DROP section of compatibility.md, and the push chain rules, 403 and merged-commit rule in endpoints.md.

Transfers without drops do the work they did before. The per-commit step in apply returns at once for a commit that drops nothing, and the revive check it makes was already there. The validation-side steps run only for a push that carries a drop.

Tests

  • it_graph_drop::push_and_pull_apply_drops_as_the_writer_did: a push, a pull, and a pull one commit at a time, onto receivers that start from an index holding the graphs the commits drop. Each receiver must read what the writer reads at every t, again after a reload, and the pushed one again after its own index build. The commits include a drop alone, a write of the dropped graph again, a graph registered, dropped and written again within the transfer, and DROP DEFAULT.
  • it_graph_drop::a_push_validates_a_commit_after_its_drop: a vector at a new length, written after its graph's drop, is accepted.
  • it_graph_drop::a_push_that_drops_needs_an_identity_without_a_restricting_policy: a DROP DEFAULT pushed by an identity whose deny policy lives in the default graph gets a 403; the same identity's push of a commit that drops nothing is accepted.
  • CLI unit test a_push_refused_for_an_unknown_commit_flag_names_the_remote_release.

Not covered

  • A release before drops existed cannot read a commit that drops, so an older CLI pulling one, or a cluster mid-upgrade, refuses it. That comes from the commit format, not this path.
  • No test sends a drop through the HTTP push endpoint or raft. Both run prepare_push.

Commit transfer refused a commit that drops graphs, since it applied nothing
of the drop. Each transferred commit now applies as replay applies it: its
drops at its t, then the dropped graphs it writes again, then its flakes, and
the receiver's index stops serving what the drops took. A commit that only
drops is not an empty commit.

A push validates each commit against the state the drops before it leave, and
takes the policy from the state before the commit: only an identity without a
restricting policy may push a drop, as only one may drop locally. A commit a
merge brought in is still refused if it drops, since a merge never brings one
in. The CLI names an earlier release on the remote when it refuses the commit
flag.
@bplatz bplatz added the enhancement New feature or request label Nov 7, 2026
@bplatz
bplatz requested a review from a team November 7, 2026 00:58

@jdorety jdorety 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.

LGTM. Drop/revive ordering, applying drops in both validation and apply, the unrestricted-identity check, and store hiding all hold up; the new tests pass and fail when they should.

Non-blocking hardening, both reachable only with hand-crafted commits from an unrestricted identity:

  • A no-flake commit whose graph_drops names only unknown or system graphs passes the empty-commit check on push and pull and is stored as a no-op commit.
  • A drop of a graph first registered by a later commit in the same push is accepted; reload and per-commit peer catch-up then record different drop metadata (no read difference observed).

Share drop-target validation between push and incremental pull. Reject unknown and system graphs and targets introduced only by a later commit, while preserving same-commit registration.

Share drop and revival application with peer catch-up, remove copied graph names, and compare lifecycle metadata across transfer, catch-up, reload, and indexing.
Build a membership set for large drop lists and stores while retaining cheap slice scans for small inputs. Verify masking preserves shared indexes and handles unordered, duplicate, and unknown graph IDs.
Report unsupported commit format features generically and preserve the remote error. Cover drop and non-drop flags in the compatibility-message regression test.
@bplatz

bplatz commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in 258ef37

@bplatz
bplatz merged commit 6f8ebff into main Nov 9, 2026
19 checks passed
@bplatz
bplatz deleted the feat/graph-drop-transfer branch November 9, 2026 21:30
@aaj3f

aaj3f commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

@bplatz sorry, my review on this one landed after it merged. The two small points that still hold on main are in #2293. Thanks for this, carrying a drop through push and pull the way replay applies it was exactly the shape I'd hoped for.

bplatz added a commit that referenced this pull request Nov 11, 2026
A branch that starts from its source's index loads its historical
snapshots from that root, which names the source. The head load
re-stamps the record's ledger id; the historical loader did not, so a
view as of an earlier `t` carried the source's id with the branch's
fence, and the retention freshness check refused it as dropped. Every
time-travel read of such a branch below its head failed; #2272's
push/pull drop test reads those views.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Push and pull of commits that drop graphs

3 participants