Skip to content

fix(sync): a facet-narrowed selector carries its stamped rows' hard deletes - #10024

Open
olety wants to merge 5 commits into
opus-exportdoors/selector-facet-band-export-carries-tombstonesfrom
opus-exportdoors/selector-facet-export-carries-tombstones
Open

olety wants to merge 5 commits into
opus-exportdoors/selector-facet-band-export-carries-tombstonesfrom
opus-exportdoors/selector-facet-export-carries-tombstones

Conversation

@olety

@olety olety commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Fixes FIX-LIST row [SELECTOR-FACET-EXPORT-DROPS-BODYLESS-TOMBSTONES] (P2), the facet half that blind review round 1 of #10010 split out of [SELECTOR-FACET-BAND-EXPORT-DROPS-BODYLESS-TOMBSTONES].

Based on #10010's branch, because both change TombstoneExport and DeletedRecordScope. This PR's own diff is its test and fix commits, a merge of #10010's round-3 head 971c524, and the blind-review fix and test commits a1d85a3 and ab6b703. It lands after #10010.

Defect

A selector narrowed to some facets keeps a row by the row's FacetOf stamps:

  • scope.rs facet_scope_by_source reads them from the window;
  • a seed is a row with a selected stamp, and entity_selector_decision withholds a row with any unselected or malformed stamp;
  • filter.rs adds the seeds' one-hop closure.

A hard delete removes the row's body and every edge of it from the vault's window in the same commit (sync/window/tombstones.rs). The export then keeps no row of it, and TombstoneExport::admits carried no tombstone of a row it does not keep once the selector named a facet (FACETED_TOMBSTONE_EXPORTED = false). So the owner's own machine whose selector names facets never received the delete, and kept a row the owner deleted. That covers a residence read's window tombstone ids (sync/residence/window_tombstones.rs, which serves exactly this export's tombstones map) and a proved machine's window sync.

Another vault's copy is a different case, and this PR does not make a delete reach it (see Notes).

The delete's captured scope cannot judge this. Its facet axis is the record scope facet, and the selector does not select by that (REVIEW-10010 round 1, P1=2). The capture never held the row's stamps.

Fix

  • deletion/tombstone_scope.rs: DeletedRecordScope gains facet_of: BTreeSet<ScopeId>, beside fix(sync): a band-narrowed selector carries its rows' hard deletes #10010's entity_type. It holds the live row's stored FacetOf targets at delete time, each only where both ends sit on the ONE-1645 table by their stored types (facet_of_endpoint_types_on_table), the same rule the selector's read mirror uses.
    • A target with no stored row is unknowable, and a failed read proves nothing. Either way the capture holds no stamps (logged), and the capture itself still lands.
    • A rebind to a later request keeps the held set.
  • sync/selector/tombstones.rs: TombstoneExport::new takes the selector's facet filter in place of the faceted bool, and FACETED_TOMBSTONE_EXPORTED is gone. Under a facet-narrowed selector, a bodyless tombstone travels only where the capture holds at least one stamp and every stamp names a selected facet. That is the keep rule: a seed, and no unselected stamp. selects takes the whole capture, so it judges facets, worlds and bands (fix(sync): a band-narrowed selector carries its rows' hard deletes #10010's captured entity_type) from one row.
    • The world, band, grant (grant.admits("read", captured scope)) and member (member_reads_by_capture) rules are unchanged, and all still apply.
  • sync/selector/authorize/filter.rs: the call site passes facets.

Blind review of this PR (REVIEW-10024, rounds 1 and 2, P1=4) found three more ways a bodyless tombstone was judged differently from the live row. All three are fixed here:

  • Device-only worlds (P1-1). A NOTE in a device-only world is withheld while live. Its hard delete took its InWorld edges, so the device-only check could no longer see the world, and its tombstone (id, reason, time) left the device.
    • DeletedRecordScope gains carried_worlds: Option<CarriedWorlds>: the row's carried worlds, its sources' among them, captured at delete time by the same settings::carried_worlds_in the device-only check reads.
    • A read that fails is captured as unknown.
    • filter.rs withholds a tombstone whose capture is kept by the destination's current flagged worlds (tombstones::device_only_by_capture), beside the live check.
  • Copies to another vault (P1-2). Another vault's federation admission refuses every tombstone (admission::reject_federated_tombstones), so a single tombstone in a selector answer made the client refuse the whole answer, live rows included. The guest codec drops them all anyway (strip_guest_share_metadata).
  • Multi-world NOTEs (P1-4). A live NOTE in worlds W and X travels under a World(W) selector, held at its witness W (note_world::blob_scope_held_at_with_history, FIX-LIST 9433). Its capture holds {W, X}, which is not a narrowing of {W}, so its delete stayed off.
    • TombstoneExport::held_position holds a captured row whose kind takes live worlds (NOTE, ASSET, caption) at the same witness, with note_world::position_at over the grant's and the selector's world ceilings.
    • The world rule and the grant judge that held position. The same fix covers a grant narrowed to W under a World::All selector.

Stays off (fail closed):

  • a row with a scope facet and no stamp;
  • a row reached only by closure;
  • a row with a stamp in a facet the selector does not select;
  • a capture written before this field existed;
  • no capture, or a capture bound to another request.

Test

New file crates/oneiron/tests/selector_facet_tombstone_after_hard_delete.rs (cfg oneiron_test_support, feature test-hooks). It uses public API and the existing label_writers::open_member_vault door, and follows #10010's band fixture.

Fixture:

  • A member holds a live Member federation grant whose Scope admits every record (read_preset).
  • F is the member's substrate FACET (the PERSON put mints it), and G is a FACET of its own.
  • The owner keeps three CLAIMs about the member:
    • stamped: scope facet F, plus put_edge(FacetOf -> F);
    • unstamped: scope facet F, no edge;
    • other: scope facet G, plus FacetOf -> G.
      FIXTURE asserts check each CLAIM's stored FacetOf targets.
  • The owner packs the window. FIXTURE: before the deletes, the selector narrowed to F keeps the stamped CLAIM alone. This pins the keep rule the tombstone rule must match.
  • The owner hard-deletes all three. FIXTURE: the reloaded window holds each tombstone and no body.

Then three authorized selectors export that window: open, F and G.

  • a_facet_narrowed_members_window_carries_its_stamped_rows_hard_delete:
    • FIXTURE: open carries all three;
    • MISSED-DELETE: F carries the stamped CLAIM's tombstone;
    • MISSED-DELETE: G carries the other CLAIM's tombstone.
  • a_facet_narrowed_members_window_carries_no_tombstone_of_a_row_it_never_kept (guards):
    • LEAK: F carries neither the unstamped nor the other CLAIM's tombstone;
    • LEAK: G carries neither CLAIM in F.
  • a_window_copied_to_another_vault_carries_no_tombstone (P1-2): the open and F exports through filtered_window_doc_for_peer(.., PeerMachine::Unknown).
    • FIXTURE: the member's own open and F windows carry the stamped CLAIM's tombstone;
    • REFUSED-ANSWER: neither copy to another vault carries any tombstone.

P1-1 and P1-4 have no test of their own yet. They need a device-only world fixture and a two-world NOTE fixture. They are filed as an own P3 row, [SELECTOR-TOMBSTONE-REVIEW-10024-PROOFS], for a tests-only follow-up PR.

Expected results (RUSTFLAGS="--cfg oneiron_test_support" cargo test --locked -p oneiron --all-features --test selector_facet_tombstone_after_hard_delete):

The proof run is booked after READY and runs after the merge.

Notes

  • Stored change: keep. These are additive serde-default fields in the tombstone-scope side table (facet_of, carried_worlds), each skipped when empty. An older capture decodes with no stamps, so its tombstone stays off a facet-narrowed selector, as before. It also decodes with no carried worlds, so the live device-only check alone judges it, as before.
  • Not fixed here (REVIEW-10024 P1-3): a delete still never reaches another vault. Connect delivery and the guest document go through the guest codec, which drops every tombstone, and federation admission refuses every one. Both were so on main before this stack. Carrying a delete there needs a new admission path: one that takes a delete only of a row the same sender delivered under the same grant, and keeps it off ordinary peer updates. That is a new path rather than this row's selector rule, and it decides what an owner's delete does to a copy in someone else's vault. It is filed as [CROSS-VAULT-DELETE-NEVER-ADMITTED] (P2) for the federation owner, with an ASK for the intent.
  • No new verb, grant, attestation or door.
  • Disclosure: a tombstone carries the row's id, the delete's reason and its time, never content. A facet-narrowed export to the owner's own machine now takes it only under these conditions:
    • the same selector seeded the row while it was live;
    • the row sat in the worlds and bands the selector selects, held at the same world witness;
    • the grant reads that position;
    • the row carried no world kept off that machine.
      The member gate decides after that, as before. A copy to another vault carries no tombstone.
  • Not covered: the tombstone of a deleted FACET the selector names (kept while live by facet_visible) still stays off, as on main. A CLAIM cannot hold two stamps (the edge door refuses a stamp to a facet other than its scope facet), so the "every stamp" rule has no CLAIM test with two stamps. It mirrors entity_selector_decision's unselected withhold.

…deletes

A selector narrowed to a facet keeps a row by its FacetOf stamp, and a
hard delete takes the row's body and edges out of the window, so the
export carries no tombstone of it and the peer keeps the deleted row.
Guards: a row whose scope facet is F with no FacetOf edge, and a row
stamped to another facet, carry no tombstone to the F selector.
…eletes

The delete capture (DeletedRecordScope) now keeps the row's stored
FacetOf stamps, each only where both ends sit on the ONE-1645 table by
their stored types, as the selector's read mirror honors a stamp. An
unknowable target or a failed read keeps no stamp. The field is
serde-default and skipped when empty: an older capture reads none
(Stored change: keep).

TombstoneExport takes the selector's facet filter and carries a
bodyless tombstone to a facet-narrowed selector only where every
captured stamp names a selected facet, as it seeds a kept row and
withholds one with an unselected stamp. A row with a scope facet and no
stamp, or reached only by closure, stays off.
@greptile-apps

greptile-apps Bot commented Nov 20, 2026

Copy link
Copy Markdown

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 5 billable files and costs up to $1.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 43 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 152 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 971c524 and ab6b703.

Files selected for processing: 5

  • crates/oneiron/src/deletion/tombstone_scope.rs
  • crates/oneiron/src/settings/device_only.rs
  • crates/oneiron/src/sync/selector/authorize/filter.rs
  • crates/oneiron/src/sync/selector/tombstones.rs
  • crates/oneiron/tests/selector_facet_tombstone_after_hard_delete.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…tones branch

Both add a field to DeletedRecordScope and its capture tuple, and both
change TombstoneExport::selects: the capture keeps entity_type and
facet_of, and selects now takes the whole capture to judge facets,
worlds and bands.
Blind review round 1 of #10024 (REVIEW-10024):

- A purged row's tombstone stays home when the row carried the words of a
  world kept off the destination. The delete capture keeps the row's
  carried worlds (settings::carried_worlds_in, serde default: keep), and the
  export withholds the tombstone as the device-only check withheld the live
  row, whose InWorld edges and sources the delete took.
- A NOTE, ASSET or caption is held at the one world the grant's and the
  selector's world ceilings both hold (note_world::position_at), as a kept
  row is (FIX-LIST 9433), so a NOTE in W and X carries its delete under a
  World(W) selector and under a grant narrowed to W.
- A copy to another vault carries no tombstone: its federation admission
  refuses every one (reject_federated_tombstones), so one failed the whole
  selector answer, and the guest codec drops them all.
REVIEW-10024 P1-2: the federation admission of another vault refuses every
tombstone, so one in a selector answer failed the whole answer. The member's
open and F windows exported to PeerMachine::Unknown carry none.

This branch has not been deployed

No deployments
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.

1 participant