Repository navigation
fix: a retraction and an assertion of one fact at one t resolve the same way everywhere - #2153
Conversation
A commit written before the staging fix can retract and assert one fact at one t (a restating write of a subtyped big integer or a dateTime past the microsecond; a merge or revert before the net-change fold). Lanes resolved the pair differently: the full rebuild, the annotation arena and the history replay kept the assertion; the incremental dedup, the query overlay, novelty's fact state, core range, the stats fold and the batched ref deltas kept the retraction; others kept whichever op came first. So an answer depended on the path that served it, and a full rebuild changed answers the live view had shown since the write. `fluree_db_core::same_t` owns the rule: the assertion holds. `op_order` is the sort key a walk ends on the winner under, `supersedes` the streaming fold. Every lane goes through one of them: - index: `resolve_transitions`, lifecycle dedup (`dedup_group`, which now keeps the losing retraction as superseded history, so an incremental merge writes the row and sidecar a rebuild does), the k-way merge's dedup, the annotation arena's sorts and folds, the spatial replay (a tie-aware resolver; the cell order on disk is unchanged); - reads: `resolve_overlay_ops`, core `remove_stale_flakes` (which the binary scan now calls instead of its own copy), the batched ref deltas, fulltext's de-stale, `merge_latest_ref_objects`, export's untranslated fold, the attachment overlay; - novelty: `NoveltyFactState::record`, the stats fold, and the net-change accumulator merge and revert use (by rule, not by position in the commit). `apply_commit` keeps an assertion its own commit retracts, as `bulk_apply_commits` already does; - transact: `CurrentFacts`' key merge. The reasoning overlay no longer drops a stored retraction a derived fact restates at the query's t: the derived assertion holds by the rule. A commit built here may not hold such a pair: `build_commit` refuses one with a typed internal error naming the fact (`TransactError::SameTPair`), found by `FactIdentity::same_t_pairs` over the staged view's SPOT order. A view without both ops is passed over. Pushed, cloned, restored and imported commits don't pass through `build_commit`. Rebase replays a commit's flakes, so it resolves a pair to its assertion first (`resolve_same_t_pairs`).
Stages a pair as a pushed commit (the transactor no longer builds one) and requires the value present, once, live on the instance that took the push, reloaded, at t-1 and t, in the ledger's stats, after an incremental build and after a full rebuild: for a subtyped big integer and a dateTime, in the default and a named graph, with the value indexed, in novelty only, in a graph new to the index, and on a ledger never indexed. Also: a local commit holding a pair is refused with a typed internal error, a pushed one is taken verbatim, and a rebase replays one as its assertion.
# Conflicts: # fluree-db-api/src/branch_validation.rs
…ix/same-t-one-rule
The S2 section described an `idx:spatial` query that no query surface parses: JSON-LD, SPARQL and Cypher never build an S2 search, so a query written that way is read as ordinary triple patterns and returns nothing. It now says so, keeps what the index side does (incremental builds write the S2 cell index; a full reindex doesn't rebuild it; values since the last build aren't in it), and labels the query examples as the planned interface. The SPARQL troubleshooting note said `geof:sfWithin` evaluates as a filter; only `geof:distance` is implemented, and other `geof:` functions are reported as unknown. The design doc gets a status note.
…arses it Runs the `idx:spatial` query the geospatial docs plan (`within` and `intersects` over a polygon, indexed and in novelty only) and expects the polygon found. No query surface parses `idx:spatial` yet, so today every case returns `[]` while a plain read of the polygon succeeds. Ignored, with the reason, so whoever implements the query can un-ignore it.
A commit can retract one fact under two terms at one t: novelty can hold a big integer under two integer subtypes, which share an index key. The key pairing kept the first retraction of a key and ignored the rest, so resolving a legacy pair on rebase dropped one retraction and left the other paired with the assertion, and the staging check then refused the rebased commit. Every retraction of a key now pairs with its assertion.
A commit written before the staging check could hold a retraction and an assertion of one fact at one t. Either way it leaves the fact present, but reverting it has to restore what held before it, and the commit alone can't say whether that was the fact or nothing. The undo's net change resolved the pair to its assertion, and the stored-state filter then dropped it as already present, so reverting a pair over an absent fact kept the value. The accumulator now reports, for an undo, the facts whose deciding commit held such a pair, and the revert reads each one's presence at that commit's t - 1 (`CurrentFacts::at`): present, nothing is written for it; absent, it's retracted. One point read per pair, batched by t; a range with no pair does no extra work. Replay (merge, rebase) is unchanged.
A full rebuild's first stats pass counted every commit-log record by the sign of its op, so a same-t retraction and assertion of a fact absent before them netted to zero though the index holds the fact, and a retraction of a fact never asserted counted minus one. (Both predate the same-t rule: a commit pulled from elsewhere, or written before the staging check, can hold either.) The first pass now only observes records, for the sketches, last-modified t and historical datatype tags. The counts (graph, property, datatype, class) come from the second pass's k-way merge winners, one per fact the index holds, which is what an incremental build counts against. The sketch upload and finalize move after that pass. No extra pass or read.
Each fold the same-t rule decides now has a test that fails when that fold alone goes back to retract-wins or first-seen: - the cross-path matrix runs each pair stored assertion-first as well as retraction-first, since a fold that keeps the first op it sees passes one order by luck; - a pair over an absent value, pulled verbatim, reads present, counts once in an incremental and a full-rebuild index, and reverts to absent (a present-value control reverts to present); - a DELETE of a big integer that novelty holds under two subtypes, over an indexed ledger, names the pair the staging index-key merge has to see; - the fulltext novelty fold (now one function the test calls), the metadata reference fold and the export fold of untranslated facts each get a unit test of both orders; - a restating Cypher SET commits nothing, so it can't leave a pair.
Pairing every retraction of a key gave each key a Vec, one allocation per retracted key in every slot that retracts and asserts a value whose index key can merge terms (a double or big-integer upsert). One retraction per key is the usual case, so it's held inline in a SmallVec; a second one spills.
finish_with_pairs returns finish()'s output when nothing paired, so a revert range without a pair does no per-fact lookup.
Observing a record for the sketches went through the counting path with a delta of 0, so the first pass still updated the graph, datatype and class count maps for every record, now for nothing. The record's monotone part (sketches, last-modified t, historical tags) and its counted part are two small functions on the property accumulator; observing takes the first, counting a present fact the second, and the incremental path's signed counting both, with the one property lookup it had.
…ndex The positions of an undo's same-t pairs only mean something against the flake vector the fold produced, so the two are one value now, NetChange, in CollectedCommitData. stage_revert takes it whole instead of two arguments that could come from different places (which also brings it back under clippy's argument limit). Replay users read `net.flakes`.
bplatz
left a comment
There was a problem hiding this comment.
Approving. The one-rule consolidation is solid and well tested, and the spatial replay change also fixes a bug on main today (editing a polygon within its own cells dropped the subject).
There's one real bug inline (undo_same_t_pairs, range revert); the rest are smaller. @aaj3f please go through the inline feedback before merging.
| let mut keep = vec![true; inverted.len()]; | ||
| for (n, present) in present_before { | ||
| if present { | ||
| keep[n] = false; |
There was a problem hiding this comment.
Bug: "present before → write nothing" assumes the head still holds the fact. Revert the pair commit together with a later commit that deleted the value and it stays absent; it should come back. Reproduced for big integer and dateTime, both stored orders.
Fix: assert it instead (inverted[n].op = present;, drop the keep/retain). Staging treats it as a restatement when the head still holds it, same as a non-pair undo. With that, the probe below, the same-t file and the grp_ledger revert tests pass.
Probe (it_same_t_one_rule.rs)
#[tokio::test]
async fn range_revert_over_a_present_pair() {
for kind in [Kind::BigInt, Kind::DateTime] {
for order in [Order::RetractFirst, Order::AssertFirst] {
let dir = tempfile::tempdir().unwrap();
let path = dir.path().to_string_lossy().to_string();
let id = "it/same-t-range:main";
let commits = source_commits(kind, Path::NeverIndexed, None, order).await;
let pair = pulled(&path, id, commits).await;
let fluree = open(&path);
let delete = fluree.graph(id).transact()
.sparql_update(&format!("{PFX}DELETE DATA {{ ex:s ex:p {} . }}", kind.literal()))
.commit().await.unwrap().receipt.commit_id;
fluree.revert_commits("it/same-t-range", "main",
vec![CommitRef::Exact(pair), CommitRef::Exact(delete)],
ConflictStrategy::TakeSource).await.unwrap();
fluree.disconnect_ledger(id).await;
assert_eq!(values(&open(&path), id, None, None).await,
vec![kind.lexical().to_string()], "{kind:?} {order:?}");
}
}
}There was a problem hiding this comment.
Good catch, thank you, that's a real one. "Present before → write nothing" quietly assumed the head still held the fact, and a later commit in the same range can take that away. Went with your fix in 0b57271cf: the undo now writes the state before the pair either way (inverted[n].op = present, keep/retain gone), and staging takes it as a restatement when the head already agrees, same as any other undo.
Your probe is in as a_range_revert_from_a_pair_restores_what_held_before_it, widened a bit: big integer and dateTime, both stored orders, reverted from novelty and from an index, plus the absent-before side (a string and a big integer), which has to stay absent. Before the fix all 8 present-before cells come back []; with it they pass, along with the rest of the same-t file and the grp_ledger revert tests.
| // one fact at one `t`: staging cancels the two by fact identity, so a | ||
| // pair is a staging defect, refused rather than written. Commits that | ||
| // arrive whole (push, clone, restore, import) never pass through here. | ||
| check_no_same_t_pair(&view)?; |
There was a problem hiding this comment.
Worth a sentence in the PR: any staging lane that misses the identity now shows up as a 500 on a user write instead of a quietly kept pair. I couldn't find one, and fail-closed seems right; just making the trade explicit.
There was a problem hiding this comment.
Agreed, and I think fail-closed is the right side of it too. Added a sentence under the staging invariant in the PR body making the trade explicit. fwiw I re-checked the lane that landed on main since (#2144's FlakeAccumulator netting) after merging it in: it keys by FactIdentity and stages nothing for a fact both retracted and asserted, so it agrees with the check.
|
|
||
| /// Current facts of `ledger` as of `to_t` (at most `ledger.t()`): the | ||
| /// index read as of `to_t`, and novelty up to it. | ||
| pub fn at(ledger: &'l LedgerState, to_t: i64) -> Self { |
There was a problem hiding this comment.
named_by and the slot reads honor to_t, but whole_graph still reads at head. Revert doesn't hit it; either honor to_t there or say so in the doc so the next caller doesn't trip on it.
There was a problem hiding this comment.
Fair. Went with honoring it rather than documenting the gap (519b0234c): whole_graph passes to_t like the other reads now. At the head it's the same read as before, since range_with_opts fills to_t from the head when it's unset, so graph sync / CLEAR / DROP / COPY / MOVE don't change. whole_graph_reads_as_of_to_t pins it, and fails with the old options.
| .iter() | ||
| .filter_map(|p| { | ||
| spot.iter() | ||
| .find(|(_, f)| std::ptr::eq(*f, p.retraction)) |
There was a problem hiding this comment.
A linear find per pair makes this O(pairs × n). Fine for restating-write pairs, but a legacy merge commit can hold a lot of them. Carrying positions through same_t_pairs (or using a pointer set) avoids it.
There was a problem hiding this comment.
Yeah, fair for a legacy merge commit. same_t_pairs now hands back each retraction's position in the sequence it walked (SameTPair::retraction_at), so resolve_same_t_pairs maps it back through spot with one lookup per pair (519b0234c). resolving_pairs_drops_each_retraction_wherever_it_sits covers flakes out of SPOT order with term and key pairs mixed in, one of them behind another value of its slot (d8b6cd8cf), and fails if the position isn't mapped back through the sort or the run offset is dropped. The walk only picked up a running counter, and it runs in the staging check on every write that both retracts and asserts, so I measured it: a 600-flake insert, 400-flake integer and double upserts and a 20,000-flake upsert are all within ±0.5% in instructions, with the same allocations.
| /// A polygon inside the query region is found by `within` and | ||
| /// `intersects`, whether the index or novelty holds it. | ||
| #[tokio::test] | ||
| #[ignore = "no query surface parses idx:spatial yet; see the S2 spatial-query issue"] |
There was a problem hiding this comment.
Nit: this is an ignored test for a surface that doesn't exist yet. I'd park it in #2152 rather than land it here. The doc corrections are good to keep.
There was a problem hiding this comment.
Agreed, dropped it here (e5699f576) and kept the doc corrections. Parked its content on #2152 (#2152 (comment)) so whoever picks up the query surface can start from it.
| // flake the walk yields first, so this lane answers as | ||
| // `resolve_current_flakes`, `resolve_overlay_ops` and every | ||
| // index build do. | ||
| if supersedes((flake.t, flake.op), cur) { |
There was a problem hiding this comment.
Nit: this lane decides class-based policy grants, so a same-t rdf:type pair now grants. That's consistent with every read path, so fine, but maybe name the policy effect in the behavior table.
There was a problem hiding this comment.
Good call, named it in the behavior table: a subject whose rdf:type the overlay holds as a same-t pair now has that type in the batched ref lookup, so a class-based policy on that class applies to it, the same way every read path already sees the type.
# Conflicts: # fluree-db-novelty/src/lib.rs # fluree-db-transact/src/commit.rs
…ead holds Undoing a commit that held a same-t pair wrote nothing for a fact that was present before it, on the assumption that the head still held the fact. Reverting the pair's commit together with a later commit that deleted the value then left it absent instead of restoring it. The undo now writes the state before the pair either way, asserted or retracted, and staging takes it as a restatement when the head already agrees, as it does for any other undo.
It runs a query surface that doesn't exist yet. It belongs with the issue that tracks that surface rather than in this branch; the geospatial doc corrections stay.
resolve_same_t_pairs found each pair's retraction by a linear search of the sorted references, O(pairs x n), and a legacy merge commit can hold many pairs. same_t_pairs now names each retraction's position in the sequence it walked (SameTPair::retraction_at), so the drop is one lookup per pair. CurrentFacts::whole_graph read at the head while every other read there honors to_t, so a CurrentFacts::at reader got the head's graph. It reads as of to_t now; at the head that's the same read as before (range_with_opts fills to_t from the head when it's unset).
Pins the run offset in same_t_pairs' positions: a pair in a slot's second run of equal objects.
Clippy's type_complexity on the positioned retractions map; a type alias, no change in behavior.
|
Thanks for the careful review! Went through all six:
Also merged main ( |
Brings #2217 (SPARQL reads list members as values; CONSTRUCT writes lists), #2218 (schema writes judged by modify policy), #2208, #2169, #2168, #2153, #2149 and #2148 into next. Resolutions: - Nameservice: branch_records is the one branch listing (strict, retracted branches kept for GC) on every backend, resolved through next's bindings; Fluree::list_branches filters retracted ones. The lifecycle conformance suite reads live branches through a helper. DynamoDB's narrow listing is wired into its trait impl. - JSON-LD adapter: main's graph scoping (Walk, Scope, node_graph, selectors) with next's triple terms, @annotation, @reifies, blank-label and number datatype handling. to_graph_events writes a JSON-LD named graph under its @id and refuses a graph selector. main's f:reifiesGraph anchor is dropped: next writes an annotation as an rdf:reifies link in its graph. emit_quad_list_item takes (graph, index). - Bulk import: an annotation's link is written to the graph its slots name, and a triple-term statement in a named graph is spooled under that graph (both landed in the default graph); emit_quad_reified_triple is implemented. resolve_object_value keeps main's vector refusals and next's term-table path. - Ledger manager: a store that fails to load fails the load or keeps the reloaded ledger's state (main), over next's load_decoding_root and activation swap rule. - Novelty keeps main's KeptEffects without the retired arena's reifies capture. The pool's resolve_events_at and compaction's split_lifecycles follow fluree_db_core::same_t. - Retired annotation arena files stay deleted. - Tests from main adapted to next: one Fluree per storage directory, async genesis_ledger, storage-namespace content stores, u32 graph ids, a store broken by hiding a dictionary branch (next has no disk cache), a refused import leaving no ledger. next's tests that pinned bulk import refusing @graph and SPARQL's RDF list view now check what main changed them to.
Partially addresses #2090: with #2109 a restating write no longer commits a retraction and an assertion of one value at one
t, and with this PR a ledger that already holds such a pair reads it the same way on every path, so its answers no longer change at an index build. Novelty's term-keyed dedup, #2027's subtype in the index,BIND's integer datatype,-0.0/"1.50"after indexing andxsd:floatprecision remain.Follow-up: #2152 (the S2 spatial query surface).
Why
A commit can hold a retraction and an assertion of one fact at one
t. #2109 stops new writes from producing them, but ledgers written by earlier versions have them, from three places:DELETE/INSERTof the value,DELETE DATA x ; INSERT DATA x, an identical upsert or graph sync, a subtype change, a revert of a delete-then-insert;dateTimepast the microsecond, whose two terms reload identical because the commit keeps six digits;The commit doesn't record which op came last, so something has to decide, and today it's decided in more than twenty places that don't agree. The ones that matter most:
resolve_transitions), annotation arena, history replaydedup_group), which also dropped the loser outrightresolve_overlay_ops), core range (remove_stale_flakes)CurrentFacts' key mergemerge_latest_ref_objectsSo on an indexed ledger the live view and incremental builds read the value as absent, and a full rebuild reads it as present. Full rebuilds don't only happen on request:
build_index_for_recordfalls back to one when there's no base index (a new ledger, a clone, a restore), when the commit gap is over 10,000, and on any retryable incremental failure orIncrementalAbort. So answers could change on a ledger that never asked for a reindex, and a fresh replica built from commits could disagree with the origin it cloned. Measured onmainat57bf7a944(absent / absent / present: live, incremental, full) for every restating write shape above, and present / absent / present for a value written since the last build.What changes
One rule.
fluree_db_core::same_towns it: at onetthe assertion holds.op_order(t, op)is the sort key every walk uses (a walk in that order ends on the op that holds) andsupersedes((t, op), (cur_t, cur_op))is the streaming fold. Assertion, because every pairmainand v4.2.4 write was meant to keep the value, and because the lanes that already said "assertion" are the persisted ones (run records, the history sidecar's replay, the annotation arena), so no index on disk changes meaning.Every lane above that settles a pair by picking the op that holds goes through one of the two. (The first commit's message,
408542252, says every lane does. Two don't, and they're covered right after this list.) A few are worth calling out:dedup_groupnow keeps the losing retraction as superseded history instead of dropping it, so the incremental merge walks the same events a rebuild does and writes the same row and sidecar. The replay property suite now enumerates same-tpairs (in both stored orders, at every slot) and checks the incremental pipeline and the rebuild against one reference at every boundary.resolve_overlay_retractionswas a private copy of core'sremove_stale_flakesthat had drifted to the other answer. It's gone; the three call sites callresolve_current_flakes.Novelty::apply_commitdropped an assertion whose term novelty already held as asserted, even when the same commit retracted it. Under retract-wins that was harmless; under the rule it dropped the winner. It now keeps an assertion its own commit retracts, which is whatbulk_apply_commitsalready did, so the per-commit and bulk paths agree again (their docs say they should). Such assertions are held until the commit's retractions are known, so a commit without one pays nothing for it.(cell, subject, t)by the rule instead of taking the first one in sort order. The cell order on disk doesn't change.ReasoningOverlaydropped a stored retraction a derived fact restated at the query'st, because under retract-wins it would have hidden the derived fact. Under the rule the derived assertion holds on its own, so that workaround is removed.Two places that can't settle a pair by picking an op. Both read what the ledger holds instead:
maintoo, for a commit pulled verbatim or written before the staging check. The counts (graph, property, datatype, class) now come from the second pass's merge winners, one per fact the index holds, which is what an incremental build counts against. The first pass only feeds the sketches, last-modifiedtand the historical datatype tags.t - 1(CurrentFacts::at) and writes that state: the fact asserted if it was present, retracted if it wasn't. As with any undo, that's a restatement when the head already agrees, and a real change when a later commit in the range changed the fact again (revert the pair's commit together with a later delete and the value comes back). That's one point read per pair, batched byt, and a range with no pair does no extra work.Separately, since this touches spatial:
geospatial.mddescribed anidx:spatialquery for complex geometries that no query surface parses (a query written that way returns nothing). The S2 section now says it isn't available yet, keeps what the index side does, and labels the query examples as the planned interface. It also corrects a SPARQL note that saidgeof:sfWithinevaluates as a filter: onlygeof:distanceis implemented. The rest of that gap is #2152.A staging invariant. A commit built here may not hold such a pair.
build_commitchecks the staged view withFactIdentity::same_t_pairs(#2109's identity: by term, or by index key for a value whose key can merge terms) and refuses one with a typed internal error that names the fact,TransactError::SameTPair(500). #2109 removes every producer I know of, so this is a regression guard. It's a fail-closed trade, fwiw: a staging lane that misses the identity now shows up as a 500 on that write, rather than as a pair kept quietly. I couldn't find one, and #2144's netting, merged since, keys by the same identity and stages nothing for a fact both retracted and asserted. The check walks the staged view's SPOT order once, passes over a view that doesn't both retract and assert, and computes keys only for the kinds of value that can merge terms, in slots holding both ops.Commits that arrive whole (push, clone, restore, import) don't go through
build_commit, so old ledgers still replicate. Rebase is the one local lane that replays an old commit's flakes, so it resolves a pair to its assertion before staging (resolve_same_t_pairs, the same detection), which is what the pair meant. It drops every retraction an assertion pairs with, so a big integer retracted under two subtypes at once (novelty can hold both) resolves too. Merge nets its range to one op per fact, and revert does too, reading a pair's fact before its commit as above.Behavior changes
tpair of a value the index holdstpair of a value written since the last buildtand before itrdf:typethe overlay holds as a same-tpair, in the batched ref lookup class-based policy readsOne counter-case to be aware of: a v4.2.3-era
INSERT DATA x^^nonNeg ; DELETE DATA x^^integer(meant to remove the value) committed exactly the same flakes asDELETE DATA x^^integer ; INSERT DATA x^^nonNeg(meant to keep it). Nothing in the commit tells them apart, so with this PR that commit reads present everywhere, which is what a full rebuild already showed for it.mainand v4.2.4 don't pair that shape.Upgrade notes
fluree reindex), the same moment it comes back today. A reindex is now a deliberate repair for these values rather than a surprise.Tests
it_same_t_one_rule.rs(ingrp_index) stages the pair the only way a current ledger can get one: as a pushed commit, rebuilt from an exportedDELETE DATAcommit with its flakes set to the pair. Then it requires the value present, once, on every path: live on the instance that took the push, reloaded, att - 1andt, in the ledger's stats, after an incremental build (the first build, for a ledger never indexed) and after a full rebuild. That's for a subtyped big integer and adateTime, in the default and a named graph, with the value already indexed, in novelty only, in a graph new to the index, and on a ledger never indexed. Each runs with the pair stored retraction-first and assertion-first, since a fold that keeps whichever op it meets first passes one order by luck. Targets are file-backed withwithout_indexing(), so every build is the one the test asks for.The fresh-graph case at
t - 1after an incremental build relies on #2118's lifecycle walk for the new graph's branch, which is onmainnow and merged here.The same file covers the invariant (a hand-built view holding a pair is refused with the 500), the exemption (a pushed commit holding a pair is taken, as stored), and the rebase (a pair is replayed as its assertion). It also covers what a pushed pair can't reach:
a_pair_over_an_absent_value_counts_once_and_reverts_to_absentpulls one instead (import_commits_incremental), for a string and a big integer, in both orders, indexed and not. The value reads present and counts once in an incremental and a full-rebuild index, and reverting that commit leaves it absent. A control with the value present before reverts to present.a_range_revert_from_a_pair_restores_what_held_before_itreverts the pair's commit together with a later delete of the value. A value present before comes back (a big integer and adateTime, both orders, from novelty and from an index), and one absent before stays absent.a_delete_of_an_indexed_big_integer_names_a_pair_novelty_holdsdeletes an indexed big integer while novelty holds a pair of it under two subtypes. Staging's read has to merge the index row and both ops by key to find what to retract.a_restating_cypher_set_commits_nothing: a CypherSETto the value a property already holds commits nothing, so it can't leave a pair for a revert to undo.Below the api:
same_t_pairs_replay_alike_on_both_pipelinesputs a same-tpair, in both stored orders, at every slot of every op chain up to three long, over both base states. It checks the incremental pipeline (dedup → leaf merge → sidecar → replay) and the rebuild against one reference at every boundary, for presence and rowt.resolving_pairs_drops_each_retraction_wherever_it_sitspins the positions rebase resolves pairs by (flakes out of SPOT order, a pair behind another value of its slot), andwhole_graph_reads_as_of_to_tthatCurrentFactsreads every shape as of an earliert.test_polygon_edited_within_its_cells_is_foundbuilds a real spatial snapshot with a polygon, its retraction and a slightly edited polygon at onet, and queries it.Against #2109's head (
3ebb552b5), the matrix fails 43 cells (counted before the assertion-first cells went in): absent live, reloaded and after an incremental build on indexed values; absent after the incremental build for novelty-only values; adateTimepair absent even on a ledger never indexed; stats counting 0. The local commit with a pair is written, and the rebase replays the pair verbatim. The spatial test fails there too:withinfinds nothing after the edit.I also took each piece out on its own and watched its tests fail:
build_commitcheck;dedup_groupdropping the same-tloser instead of keeping it as history (the property test reports the lost interval);apply_commit's keep;a_fact_retracted_at_the_query_t_is_still_derivedfails, so it's the rule keeping that fact visible now).And each of the 20 places the rule touches, flipped back on its own to what it did before (an env-gated patch, not committed), fails at least one committed test. The run covered
it_same_t_one_rule, both reasoning tests and the lib tests of core, binary-index, novelty, indexer, transact, spatial, query and the api, 5,484 tests that all pass unflipped. 12 of the 20 failit_same_t_one_rule. The other 8 fail their own unit tests: novelty's fact state, the merge/revert netting, spatial replay, the batched ref deltas, export, fulltext,merge_latest_ref_objectsand the rebase's key pairing.Perf
resolve_overlay_opsandNoveltyFactState::recordsit on hot paths, so this was measured as instructions retired and allocations (the box was loaded), with interleaved passes of #2109's head against this PR beforemainwas merged. The fixture is 20k subjects with 8 churn commits in novelty.main: a full rebuild +0.10% and an incremental build +0.14%, inside run-to-run spread; inserts, integer upserts and 400-flake double upserts (which reach the key pairing) within ±0.1%, with the same allocations. A first cut of the rebuild counts cost +1.34% on the full rebuild, because the first stats pass still updated its count maps by zero; it doesn't touch them now.whole_graphreading as ofto_t), against the merge just before it: inserts, integer and double upserts and a 20,000-flake upsert within ±0.5% in instructions, allocations the same.Criterion (
query_hot_optional,query_hot_negation_count,query_hot_bsbm,reindex_incremental, run interleaved in both orders) moved more with the box's load than with the change: in the quieter round this PR was within ±4% and mostly faster, and in the loaded one #2109's head read slower. I'd treat that as no signal, and can rerun it on a quiet box if we want a wall-clock number.Gates
All with
--all-features, after mergingmain(eaa4c8e4b):cargo fmt --all -- --check: pass.-D warningson the touched crates--all-targets: pass.fluree-db-apisuite: 5,345 passed, including the cross-path matrix in both stored orders, the absent-value, range-revert, delete and Cypher tests, and fix(transact): write fidelity, part 2 — one fact identity, microsecond temporals, value reads #2109's eight multi-op matrix tests.cargo check --workspace --all-targets: pass.mdbook build: pass.testsuite-sparql(untouched).