Repository navigation
fix(sync): a facet-narrowed selector carries its stamped rows' hard deletes - #10024
Open
olety wants to merge 5 commits into
Conversation
…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.
|
Automatic reviews are disabled for this repository. Configure in Code Review Settings. |
|
Warning Review limit reached
This review includes 5 billable files and costs up to $1.25.
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. View limit details
|
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
TombstoneExportandDeletedRecordScope. 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
FacetOfstamps:scope.rsfacet_scope_by_sourcereads them from the window;entity_selector_decisionwithholds a row with any unselected or malformed stamp;filter.rsadds 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, andTombstoneExport::admitscarried 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:DeletedRecordScopegainsfacet_of: BTreeSet<ScopeId>, beside fix(sync): a band-narrowed selector carries its rows' hard deletes #10010'sentity_type. It holds the live row's storedFacetOftargets 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.sync/selector/tombstones.rs:TombstoneExport::newtakes the selector's facet filter in place of thefacetedbool, andFACETED_TOMBSTONE_EXPORTEDis 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.selectstakes the whole capture, so it judges facets, worlds and bands (fix(sync): a band-narrowed selector carries its rows' hard deletes #10010's capturedentity_type) from one row.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 passesfacets.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:
InWorldedges, so the device-only check could no longer see the world, and its tombstone (id, reason, time) left the device.DeletedRecordScopegainscarried_worlds: Option<CarriedWorlds>: the row's carried worlds, its sources' among them, captured at delete time by the samesettings::carried_worlds_inthe device-only check reads.filter.rswithholds a tombstone whose capture is kept by the destination's current flagged worlds (tombstones::device_only_by_capture), beside the live check.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).filter.rscarries no tombstone when the copy goes to another vault (BirthReach::OtherVault).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_positionholds a captured row whose kind takes live worlds (NOTE, ASSET, caption) at the same witness, withnote_world::position_atover the grant's and the selector's world ceilings.Stays off (fail closed):
Test
New file
crates/oneiron/tests/selector_facet_tombstone_after_hard_delete.rs(cfgoneiron_test_support, featuretest-hooks). It uses public API and the existinglabel_writers::open_member_vaultdoor, and follows #10010's band fixture.Fixture:
read_preset).put_edge(FacetOf -> F);FacetOf -> G.FIXTURE asserts check each CLAIM's stored
FacetOftargets.Then three authorized selectors export that window: open, F and G.
a_facet_narrowed_members_window_carries_its_stamped_rows_hard_delete: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 throughfiltered_window_doc_for_peer(.., PeerMachine::Unknown).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):opus-exportdoors/pin-facettombstones-green-r3): all 3 tests pass.opus-exportdoors/pin-facettombstones-red-r264377dc, which is this test file on fix(sync): a band-narrowed selector carries its rows' hard deletes #10010's head 971c524. It exits 101: the first test fails at its firstMISSED-DELETE:, and the other-vault test fails atREFUSED-ANSWER:. The guard test passes, as it does on main.The proof run is booked after READY and runs after the merge.
Notes
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.The member gate decides after that, as before. A copy to another vault carries no tombstone.
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 mirrorsentity_selector_decision'sunselectedwithhold.