Skip to content

perf(executor): sealed+delta adjacency store with watermark compaction (ADR-0551, ADR-0552) - #144

Merged
jexp merged 1 commit into
mainfrom
feat/sealed-delta-adjacency
Nov 11, 2026
Merged

jexp merged 1 commit into
mainfrom
feat/sealed-delta-adjacency

Conversation

@jexp

@jexp jexp commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Optimization: committed adjacency becomes a sealed hybrid-codec region plus a committed delta per (node, rel type, direction) chunk, folded at checkpoint by the existing GC pass — so a store stops paying live sorted entries for cold hops. Ports the sealed+delta store designed in ADR-0551/0552 into the engine under the adjacency seam.

Why

Measured on the LDBC SF0.1 store with the heap-census harness: the out+in adjacency census was 147.4 MiB, of which the per-hop live entries dominated. This PR cuts the compressed payload of that term from 85.6 MiB to 48.7 MiB. The container/slot floor around it (~69.7 MiB) is untouched, so the census lands at 119.0 MiB total — 1.24x from the baseline, not the 3x the destination aimed for. That gap is the floor, not the codec, and is filed as a follow-up (see below).

Changes

  • relate-executor/src/adjacency/: the new private store tier — bitpack and hybrid chunk codec, SealedAdj/SealedChunk, the TypedAdj delta, versioned tombstones with separate supersede and delete stamps, and watermark compaction (delta > 25% of sealed, never-sealed delta at the floor, reclaimable tombstone at the GC horizon) driven by gc_versions
  • reads merge delta-first then sealed in cmp_ts_desc order through one seam (graph/adjacency.rs); every reader — neighbor walks, incident_rels, redo_preflight, the research neighbor walk, the heap census — goes through it
  • deletes of sealed hops record versioned tombstones so a pinned snapshot keeps its frozen adjacency; a delete in a never-sealed chunk records its tombstone on an on-demand zero-hop chunk instead of letting the fold seal a ghost
  • the delete tombstone records without a delta-entry precondition — it lives in the sealed region, so a delete landing in the window adj_remove leaves between its two side-table removals still hides the hop; a reposition of a delta-only hop records no tombstone at all and no longer leaves an empty region behind
  • a zero-hop sealed region is due for the fold on a reclaimable tombstone and drops with the last one, so a sub-floor chunk churning delete or reposition no longer accumulates tombstones across checkpoints; the per-node length accessor takes the delta read guard before the sealed one, matching every sibling accessor (no lock-order inversion against the delete/reposition/GC paths)
  • the memory floor charges the sealed tier's slot arrays beside each region's floor — the term the heap census reads as slot_bytes — and a self-loop's delete charges both sides' on-demand regions
  • the chunk codec names its header and block-width invariants instead of fabricating a zero length or a zero width over them
  • the watermark fold holds the adjacency write guard per node, not across the whole map, so a concurrent reader stalls for one node's fold instead of the checkpoint's; the sealed tier's vectors fit their reservation, so the floor charge is the vectors' real heap
  • the sealed tier is a Graph-level side table keyed by node and direction, so a node that never folds pays nothing: TypedAdj stays 24 bytes and the pinned logical-memory shapes are byte-identical to main
  • the memory floor charges the sealed region at compressed size and the delta at live hop size, with write-path charge deltas; the census reports delta+sealed hops and sealed chunks from one model
  • the ADR-0552 8-property proptest reference-model suite pins the observable adjacency, unmodified across the rework
  • store.rs 941 → 791 lines as the adjacency policy moves to its own module

Verification

  • cargo test -p relate-executor — 1444 passed, 3 ignored
  • cargo test -p relate-executor --features research census — passes (census counts hops across a fold)
  • cargo test -p relate-storage — 481 passed
  • cargo test -p relate — 1488 passed
  • cargo test -p relate-datasets --test memory_shapes — 4 passed, pinned integers byte-identical to main
  • cargo fmt --all --check and cargo clippy --workspace --all-targets --exclude relate-python -- -D warnings — clean
  • cargo xtask check-boundaries — 42 packages, 0 violations
  • rust-review — its High (lock-order inversion) and Medium (unbounded zero-hop tombstones) are fixed in this head; the Low (codec short-buffer panic) is fixed with the codec invariants below
  • the findings the review rounds raised as substantive are fixed in this head, each with a test: the delete-tombstone window (adj_remove's two side-table removals), the floor's missing sealed slot-array charge, the self-loop's second on-demand region, the codec's fabricated zero length/width, the whole-map write-lock hold across the checkpoint fold, and the sealed vectors' unreserved capacity
  • scripts/premerge-check.sh 144 — the merged tree compiles
  • make query-latency (ADR-0245 bands) — not run; the ready-gate lane is the first to measure it
  • SF0.1 census at the 49 MiB bar — measured 119.0 MiB (payload 48.7 MiB + ~69.7 MiB floor); floor restructuring filed as LABS-1312

Deferred, with the reason stated on this PR: the stellar rounds reported 73 findings (2 High, 63 Medium, 8 Low) across two heads. Both High findings are the same shape — the (delta, sealed) pair threaded by hand through the reader and writer seams — which the end-of-feature audit also raised and judged not worth the churn on this branch; that cluster is now a ticketed work item rather than parked polish, and it is the head of the floor restructuring (LABS-1312). The remaining refactor-shaped findings (canonical-helper duplication, parallel state, representation leaks) sit on the review-tasks issue for this PR. Findings the rounds raised on files this PR never touches (exec/…, eval/quantifier.rs, overlay/writes.rs) are pre-existing code pulled in by the review's dependency expansion, left to stellar's own ledger.

Fixes LABS-270.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Security review (security-review skill)

Reviewed the sealed+delta adjacency rework (new relate-executor/src/adjacency tier, codec, tombstone/fold logic, and its integration into the adjacency read/write seams, GC, redo preflight, census, and restore tests). No authentication, secrets, network, file-path, or dependency changes are in scope; the codec bytes and tombstones are in-memory-only and never deserialized from durable storage (ADR-0551), and no unsafe is introduced. The security-relevant posture is the resource model of the new tombstone tier: two availability issues are flagged, both reachable from ordinary Cypher statements.

  • Medium — relate-executor/src/adjacency/mod.rs:101: tombstone lookup is a linear scan on both the delete path (SealedChunk::tombstone) and the per-hop read filter (visible_hops/hidden_at), making bulk deletes O(K²) and reads O(hops × tombstones).
  • Medium — relate-executor/src/graph/mod.rs:770: the new per-delete sealed-region estimate is refusable (not counted as tombstone_spill), so a relationship DELETE at the configured logical memory cap is refused, contradicting ADR-0529's delete-at-the-cap guarantee.

Security review: ⚠️ 2 issue(s) flagged inline

/// in the original chunk order.
pub(crate) fn decode_chunk(bytes: &[u8]) -> Vec<AdjHop> {
let n = chunk_len(bytes);
let mut rest = &bytes[4..];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Low] Error handling: chunk_len silently reports 0 for a short buffer (None => 0) while decode_chunk immediately slices bytes[4..], panicking on that same input.

Why this matters: the type permits the state — SealedChunk derives Default with empty bytes, so SealedChunk::default().len() is 0 but .decoded() / .visible_hops() panic with a bounds error rather than a codec invariant message, and the two functions disagree about what a short header means.

Suggested fix: read the header once with bytes.get(..4) and return an empty hop stream when absent (or drop the Default derive and make both paths share one expect("codec: chunk header") header read).

/// LABS-351 histogram maintenance both consume. No string re-interning:
/// the caller holds the interned type id.
pub(crate) fn out_chunk_len(&self, node: NodeId, type_id: u32) -> u64 {
let region = self.sealed_out.get(&node);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[High] Concurrency: sealed_out is read before out_adj, inverting the store's lock order.

Why this matters: every other path takes the delta guard first and the sealed guard second (adj_tombstone_deleted, adj_reposition, adj_remove, and compact_side/GC), so a thread here can hold the sealed_out read guard while waiting on out_adj while a concurrent delete/reposition/checkpoint holds the out_adj write guard and waits on sealed_out — an ABBA deadlock on the two IdVec RwLocks (reachable through the executor's public Graph API; relate currently serializes applies, so it is latent rather than impossible).

Suggested fix: take the delta guard first, e.g. let adj = self.out_adj.get(&node); let region = self.sealed_out.get(&node);, then call total_len on the borrowed pair.

// later hop on its own).
match sealed
.and_then(|s| s.chunk(type_id))
.filter(|chunk| chunk.len() > 0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] Memory lifecycle: the len() > 0 filter makes the reclaimable-tombstone gate unreachable for zero-hop chunks, so their tombstones are never reclaimed.

Why this matters: a delete/reposition on a never-sealed chunk records its tombstone on an on-demand zero-hop sealed chunk; with the delta below COMPACTION_DELTA_FLOOR the chunk is never due, so a low-degree (node, type) chunk that keeps one live hop while its other rels are deleted/re-added accumulates one charged tombstone per dead rel without bound (ADR-0551's "tombstone reclaimable at the horizon" gate is skipped for exactly these chunks).

Suggested fix: for a zero-hop chunk, run the fold when chunk.reclaimable(horizon) (the fold drops tombstones whose hop no longer exists) instead of falling through to the floor gate, or drop tombstones whose id has neither a sealed nor a live delta hop.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Rust review (rust-reviewer skill, full review)

Full rust-reviewer pass over the sealed+delta adjacency rework: the new adjacency/ tier (bit packing, hybrid codec, delta, fold/reclaim), the graph/ read and write seams, the memory/accounting model, and the ADR-0552 proptest suite. Ownership, lifetimes, unsafe (none in the diff), panic/expect paths, and idiomatic-Rust checks are clean — the codec's shifts stay inside the u128 accumulator, every expect names its invariant, and every reader takes the delta guard before the sealed one. One new admission-accounting gap remains; the previously reported snapshot-freeze stub is already documented as a deliberate deferral and is not re-reported.

  • Medium — relate/relate-executor/src/graph/mod.rs:760: estimate_adj_delta charges a fresh sealed region but not the tombstone a delete (or ts-reposition) records on an already-sealed chunk, so admission can land used_bytes past the logical cap.

Rust review: ⚠️ 1 issue(s) flagged inline

@github-actions github-actions Bot 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.

Stellar review round 1: 42 inline finding(s); see summary comment.

relate_ir::Direction::Both => {
len(&self.out_adj, &self.sealed_out) + len(&self.in_adj, &self.sealed_in)
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[High] branching (std-0): The diff threads a second parallel map through every adjacency accessor, so each of the eleven functions that now takes (map, sealed) re-derives the out↔sealed_out / in↔sealed_in pairing, and the th

Suggested fix: Model one direction's adjacency once: struct AdjSide<'a> { delta: &'a IdVec<TypedAdj>, sealed: &'a IdVec<SealedAdj> } with len/flatten/for_each_hop on it, plus Graph::sides(dir) -> impl Iterator<Item = AdjSide<'_>> yielding one side, or both for Both. The accessors then take a side, `Bot

finding F-1-1

/// chunks never folded has no entry there, and the checkpoint fold lands one
/// where it seals.
#[test]
fn sealed_side_table_entry_exists_only_where_a_fold_lands() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] structure (std-1): The file's own module doc scopes it to the adjacency-walk suites (LABS-801), yet this PR appends ~402 lines of a different concern — sealed-tier layout, tombstone, GC and charge-accounting tests — tak

Suggested fix: Move the sealed-tier tests (new lines 371–771) into a sibling graph/tests/adjacency_sealed.rs registered in graph/tests/mod.rs, the same carve-out precedent the sealed proptest file already follows; adjacency.rs keeps only the walk suites its module doc describes.

finding F-1-10

// A sealed position is superseded at `xmax` (ADR-0551); the
// new hop lands in the delta.
let adj_before = adj_floor(&self.out_adj, &self.sealed_out, start)
+ adj_floor(&self.in_adj, &self.sealed_in, end);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] structure (flag-busy-function): A 29-line adjacency reposition-and-charge special case is wedged between put_rel and rel_index_add in the already multi-step property-edit seam, so set_property_rel now interleaves property muta

Suggested fix: Extract the whole if old_ts != new_ts block into a reposition_rel_adjacency(&self, start, end, type_id, id, new_ts, xmax) helper owning both adj_reposition calls and the floor-delta charge, so the property-edit seam reads linearly and the one adjacency-reposition policy has one home.

finding F-1-11

insert_hop(v, AdjHop { ts, id: rid });
} else {
self.insert(type_id, rid, ts);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] branching (std-0): reposition re-implements insert's existing-vs-create split: the if arm is exactly insert's chunk_mut -> insert_hop path, and the else arm already calls insert. The comment says the ins

Suggested fix: Delete the branch and call the canonical helper unconditionally: self.remove(Some(sealed), type_id, rid); self.insert(type_id, rid, ts);.

finding F-1-12

// ts 0 hides nothing: a tombstone's xmax is always ≥ 1, so this is
// the raw physical adjacency in merged order.
let mut ids = Vec::new();
self.for_each_hop(sealed, 0, |hop| ids.push(hop.id));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] branching (std-2): flatten encodes "no visibility filter" as the magic read timestamp 0 and depends on tombstone stamps always being >= 1, an invariant the adjacency type does not enforce (its own tests pass xmax 0).

Suggested fix: Give flatten a raw read path that takes no read timestamp: merge the delta with SealedChunk::decoded() (or let the visit take Option<u64> where None means unfiltered) so the no-filter mode is explicit instead of a sentinel value.

finding F-1-13

for _ in 0..NODE_POOL {
nodes.push(g.create_node(vec!["N".into()], BTreeMap::new()).unwrap());
}
g.commit_write();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] comparison (flag-copy-paste): This proptest copies the full case harness of adjacency_matches_reference_model (lines 371-387) — the same Graph/NODE_POOL seeding, the same type_ids interning, the same ModelAdj+live initiali

Suggested fix: Extract one fresh_case()/drive(steps) helper in this module that seeds the graph, interns TYPES, and returns/feeds (Graph, nodes, model, live, type_ids); have both proptests call it, the confluence one only adding the fold step.

finding F-1-64

Some(head) => u32::from_le_bytes(head.try_into().expect("four bytes")) as usize,
None => 0,
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] comparison (flag-silent-fallback): The same 4-byte header is handled two ways: decode_chunk (line 97, &bytes[4..]) and every other codec failure refuse a short stream with a labeled expect, while chunk_len silently answers 0 ho

Suggested fix: Give the header one policy: either expect it in chunk_len (matching the codec's other expects) or return Option<usize> and make SealedChunk always hold the 4-byte empty encoding, so len() and decoded() cannot disagree.

finding F-1-65

//!
//! Not to be confused with [`crate::graph::adjacency`], the graph's
//! adjacency accessors (degree, neighbor iteration, snapshot-visible
//! traversal) that read and write this tier.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] structure (std-6): The branch adds a second adjacency module beside the existing graph::adjacency, and the confusion is already concrete: this module and graph/adjacency.rs both open with a "not to be confused with"

Suggested fix: Give the new tier a name that says which half it is (e.g. adjacency_store for the chunks, codec and fold) or nest it as graph::adjacency::store; then delete both disambiguation notes and the doubled adjacency import in graph/mod.rs.

finding F-1-7

bytes: encode_chunk(&[]),
tombstones: Vec::new(),
};
vec_heap(1, size_of::<(u32, SealedChunk)>() as u64)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] structure (flag-canonical-dup): The admission estimate hand-assembles the region a delete creates instead of asking the code path that creates it: the three terms must mirror SealedAdj::chunk_or_insert (inline empty encoding), `Se

Suggested fix: Derive the term from the real path — add a SealedChunk::empty() used by both chunk_or_insert and this estimate, or build the region (SealedAdj::default(), chunk_or_insert(0).tombstone(0, 1, Supersede::Deleted)) and return its floor_bytes() — so one fact, not two, describes the fresh region

finding F-1-8

}
true
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] structure (flag-missed-decomposition): This branch doubles the adjacency state into four parallel tables (out_adj/in_adj plus sealed_out/sealed_in) and then threads the delta/sealed pair by hand through every helper and accessor (flatten_a

Suggested fix: Put the per-direction pair behind one store-tier handle — struct AdjSide { delta: IdVec<TypedAdj>, sealed: IdVec<SealedAdj> } in crate::adjacency, with Graph holding out/in and the compaction cleanup running once per side — so the accessors and free helpers take &AdjSide/&mut AdjSide;

finding F-1-9

@github-actions github-actions Bot 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.

Stellar review round 1: 42 inline finding(s); see summary comment. (inline comments degraded to summary — see error above)

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Stellar review (stellar-review skill)

Round 4 · head 6fc71548 · scope: 1118/2675 units (1557 sealed from earlier rounds).

New findings

  • [Medium] structure (std-1) F-4-1: relate/relate-executor/src/graph/mod.rs:278-281 — graph/mod.rs is the crate's hub module and this PR grows it 1431 -> 1511 lines with the sealed tier's whole pricing family: two more stride helpers here, the sealed terms in structure_bytes, and a sec Fix: Move the adjacency/sealed pricing and estimate family — adj_slot/adj_value/sealed_slot/sealed_value, hop_counts, adj_floor, span_growth, bump_adj and estimate_adj_delta — into graph/adjacency.rs (which already owns the adjacency accessors and imports hop_counts) or a graph/adjacency_estimate.rs besi
  • [Medium] structure (std-6) F-4-2: relate/relate-executor/src/graph/mod.rs:599-604 — structure_bytes states its own composition rule a few lines below this hunk — "Each family's term lives with the family ... and composes here, at the oracle's one site" — and every sibling obeys it (d Fix: Add adjacency_structure_bytes() beside the adjacency accessors in graph/adjacency.rs (out_adj/in_adj slot arrays + floors, sealed slot arrays + region floors) and call it at the oracle beside the three sibling family terms, so the module that owns the adjacency layout also prices it.

Still open from earlier rounds

  • [High] branching (std-0) F-1-1: relate/relate-executor/src/graph/adjacency.rs:193-199 — The diff threads a second parallel map through every adjacency accessor, so each of the eleven functions that now takes (map, sealed) re-derives the out↔sealed_out / in↔sealed_in pairing, and the th
  • [Medium] structure (std-1) F-1-10: relate/relate-executor/src/graph/tests/adjacency.rs:371-375 — The file's own module doc scopes it to the adjacency-walk suites (LABS-801), yet this PR appends ~402 lines of a different concern — sealed-tier layout, tombstone, GC and charge-accounting tests — tak
  • [Medium] structure (flag-busy-function) F-1-11: relate/relate-executor/src/graph/entity_mutation.rs:270-274 — A 29-line adjacency reposition-and-charge special case is wedged between put_rel and rel_index_add in the already multi-step property-edit seam, so set_property_rel now interleaves property muta
  • [Medium] branching (std-0) F-1-12: relate/relate-executor/src/adjacency/delta.rs:70-74 — reposition re-implements insert's existing-vs-create split: the if arm is exactly insert's chunk_mut -> insert_hop path, and the else arm already calls insert. The comment says the ins
  • [Medium] branching (std-2) F-1-13: relate/relate-executor/src/adjacency/delta.rs:124-128 — flatten encodes "no visibility filter" as the magic read timestamp 0 and depends on tombstone stamps always being >= 1, an invariant the adjacency type does not enforce (its own tests pass xmax 0).
  • [Medium] branching (q-missing-model) F-1-14: relate/relate-executor/src/adjacency/delta.rs:201-206 — The filter(len > 0) collapses the tombstone-only sealed region — a real third state SealedAdj::chunk_or_insert creates — into None, and the same state is re-derived in remove (`chunk_len(...)
  • [Medium] branching (q-missing-model) F-1-15: relate/relate-executor/src/adjacency/delta.rs:274-277 — The guard asks whether a kept tombstone blocks a live delta hop with an O(delta x kept) nested scan even though delta_ids was built above, and it distinguishes a self-delete from a reposition/delete
  • [Medium] branching (std-3) F-1-16: relate/relate-executor/src/adjacency/delta.rs:291-295 — The fold's only commit call is duplicated in both arms of the fully-reclaimed branch, and both arms return true; only the delta-slot removal is conditional. A future change to the commit (charge acc
  • [Medium] branching (flag-canonical-dup) F-1-17: relate/relate-executor/src/adjacency/mod.rs:284-289 — SealedChunk::reclaimable already owns the "tombstone reclaimable at the horizon" policy (xmax <= horizon || deleted <= horizon), but reclaim re-splits the same two stamps into three conditionals
  • [Medium] branching (q-missing-model) F-1-18: relate/relate-executor/src/exec/ddl_notifications.rs:88-92 — The three-state ClauseName exists so name resolution is one policy, yet all four arms of this match re-walk it by hand: the two CREATE arms are the same three-line ladder around different builders,
  • [Medium] branching (std-3) F-1-19: relate/relate-executor/src/exec/ddl.rs:600-605 — The rule_disposition call immediately above already answers the conflict question - its own doc says it is the one computation so callers "cannot drift" - yet this function adds a second conflict pr
  • [High] branching (q-code-judo) F-1-2: relate/relate-executor/src/graph/mod.rs:1419-1422 — The sealed tier is a second table beside every adjacency map, and this diff threads the pair by hand through every reader and writer — adj_floor, hop_counts, estimate_adj_delta, `structure_bytes
  • [Medium] branching (q-missing-model) F-1-20: relate/relate-executor/src/exec/catalog_show/mod.rs:452-457 — An unparseable kind has no representation in this projection: from_str(...).ok()? inside a filter_map drops the whole constraint, so a store whose catalog carries an unknown or legacy kind tag s
  • [Medium] branching (std-0) F-1-21: relate/relate-executor/src/exec/kernels/nfa.rs:846-852 — This arm's body (852–863) is the same nested-quantifier block the Relationship arm's var_length branch already spells at 817–828 — admissible check, bounded-only max, unroll, current/len b
  • [Medium] branching (std-0) F-1-22: relate/relate-executor/src/exec/kernels/frontier_run.rs:93-97 — decode_consumer only ever constructs DistinctEndpoints or Capped, so this guard is dead, and the match on contract.consumer below (202–204) re-states the identical fact with unreachable!. Th
  • [Medium] branching (std-0) F-1-23: relate/relate-executor/src/exec/kernels/mod.rs:246-251 — KernelMode and KernelOutput are two enums over the same Rows/Exists vocabulary, hand-paired by chain::run and hub_star::run and unwrapped at both entries with mirrored unreachable! arms (the
  • [Medium] branching (flag-silent-fallback) F-1-24: relate/relate-executor/src/exec/mod.rs:489-493 — Columns come from the first row's visible keys, yet a later row that no longer binds one is silently padded to null — the exact unwrap_or(Value::Null) fabrication the repository bans. The same file
  • [Medium] branching (flag-parallel-state) F-1-25: relate/relate-executor/src/exec/kernels/nfa.rs:259-260 — leading and trailing are incremented on the two sides of the spine but never read apart: line 342 immediately folds them into one context that alone feeds min_hops/max_hops. Two counters for
  • [Medium] branching (q-missing-helper) F-1-26: relate/relate-executor/src/exec/kernels/frontier_match.rs:295-298 — The trail-enforcing mode set is spelled twice seven lines apart (289–292 and here) and both gates return the same decline, so adding a PathMode variant means editing two matches or one gate silently
  • [Medium] branching (std-2) F-1-28: relate/relate-executor/src/graph/adjacency.rs:106-111 — The per-node compaction walk lives in the caller, so it re-asks the fold's own due-ness question (due_chunks), materialises a Vec<u32> per node, and iterates with a retain that always returns `t
  • [Medium] branching (std-2) F-1-29: relate/relate-executor/src/graph/mod.rs:734-739 — The new delete arm re-implements the sealed tier's on-demand-region rule (SealedAdj::chunk_or_insert creates the zero-hop region; fresh_sealed_region_bytes prices it) inside the create-side estima
  • [Medium] structure (std-1) F-1-3: relate/relate-executor/src/adjacency/delta.rs:350-352 — This new file lands at 908 lines — 92 short of the 1k boundary — and 559 of those lines are the inline test module, while the 348-line production half mixes the live-chunk API (insert/remove/repositio
  • [Medium] branching (q-missing-helper) F-1-31: relate/relate-executor/src/graph/degree_stats_incident.rs:159-160 — incident_rels needs each hop's type id, so it hand-walks adj.chunks and calls for_each_hop_of, which re-looks-up the chunk it is already iterating (TypedAdj::chunk is a linear scan) — a second
  • [Medium] branching (flag-canonical-dup) F-1-32: relate/relate-executor/src/graph/tests/adjacency.rs:441-445 — The PR adds the canonical floor-chunk fixture (test_support::folded_floor_chunk) and this test hand-rolls the same 32-hop :T chunk, fold and interner.get_id("T"), while `delete_of_a_sealed_hop_r
  • [Medium] branching (flag-canonical-dup) F-1-33: relate/relate-executor/src/graph/tests/adjacency.rs:590-594 — This test also hand-rolls the 32-hop :T floor chunk that the PR's test_support::folded_floor_chunk fixture already builds and folds, although the setup it needs (a sealed floor chunk, then two del
  • [Medium] boundaries (std-6) F-1-35: relate/relate-executor/src/adjacency/delta.rs:70-74 — TypedAdj::insert (lines 38-48) already performs exactly this chunk_mut → insert_hop / new-chunk-with-fit_reserved match, so reposition spells the canonical hop-insert a second time; a change t
  • [Medium] boundaries (std-6) F-1-36: relate/relate-executor/src/adjacency/delta.rs:286-287 — Both hops (decoded from a chunk stored in cmp_ts_desc order) and delta (kept sorted by insert_hop) are already sorted, and this module ships the canonical merge for exactly this pair — `merge_
  • [Medium] boundaries (std-6) F-1-39: relate/relate-executor/src/adjacency/mod.rs:80-84 — The two-stamp-versus-horizon policy is spelled a second time per tombstone inside reclaim (mod.rs:281-289: t.xmax <= horizon / t.deleted.is_some_and(|d| d <= horizon) / the kept dual). Nothing d
  • [Medium] structure (std-6) F-1-4: relate/relate-executor/src/adjacency/delta.rs:15-18 — AdjHop is the vocabulary of all three tiers — codec.rs encodes it, mod.rs encodes/decodes and merges it, delta.rs stores it — but it is defined in the leaf delta.rs (together with `cmp_ts_de
  • [Medium] boundaries (std-5) F-1-40: relate/relate-executor/src/adjacency/delta.rs:274-277 — The write side has the typed Supersede enum (mod.rs:38) but SealedChunk::tombstone throws the kind away into deleted: Option<u64>; the fold guard then recovers "this tombstone is a reposition (o
  • [Medium] boundaries (flag-magic) F-1-41: relate/relate-executor/src/adjacency/delta.rs:124-129 — 0 is a sentinel for "no visibility filtering", correct only because tombstone stamps happen to start at 1 in another module's write path; the comment is the only thing holding that cross-module inva
  • [Medium] boundaries (std-4) F-1-42: relate/relate-executor/src/adjacency/mod.rs:222-224 — A pass-through wrapper adding no policy: codec is a private child of adjacency, so every caller (the three sites in this file, and the two delta tests at delta.rs:671/865) can already reach `codec
  • [Medium] boundaries (std-6) F-1-43: relate/relate-executor/src/eval/quantifier.rs:135-139 — eval_reduce hand-rolls the per-iteration update that AllReduceFold::step (lines 267-280) already owns: cancel sample, accumulator-allocation snapshot, pre-update accumulator + loop-variable bindin
  • [Medium] boundaries (std-6) F-1-44: relate/relate-executor/src/exec/call/mod.rs:202-206 — This is a second spelling of the CallScope → CIP-218 import-set rule that scope_seed (lines 154-159) already states and that call_subquery_row independently derives as seed.keys() (lines 235-2
  • [Medium] boundaries (std-5) F-1-45: relate/relate-executor/src/exec/catalog_show/mod.rs:451-456 — Inside the filter_map, an unparseable stored kind tag silently drops the whole constraint from the CURRENT GRAPH TYPE rendering. The catalog cannot actually hold such a tag (`Catalog::insert_constra
  • [Medium] boundaries (std-6) F-1-46: relate/relate-executor/src/exec/catalog_show/mod.rs:457-461 — The whole ConstraintDef → relate_model::Constraint struct literal is hand-spelled even though relate_catalog::ConstraintDef::to_model is the documented def→model crossing ("so the statement keep
  • [Medium] boundaries (std-6) F-1-47: relate/relate-executor/src/exec/catalog_show/constraints.rs:98-102 — The SHOW/mirror createStatement renderer re-spells backtick quoting with raw format! for the label, the properties ({variable}.{property}``), and the name, bypassing the canonical `catalog::back
  • [Medium] boundaries (std-6) F-1-48: relate/relate-executor/src/exec/aggregate_charge_tests.rs:71-76 — The DISTINCT retain/stream partition is spelled as two literal name lists, while the production rule is one predicate (exec/aggregate/stream.rs: streams = !distinct || matches!(kind, Min | Max) fi
  • [Medium] boundaries (std-7) F-1-49: relate/relate-executor/src/exec/bulk/run.rs:326-328 — The per-factor id vectors live in TargetsInner::{Set,Remove,Create} and are paired with BulkWrite::factors only positionally, across two structs. Every consumer re-establishes the alignment (zip
  • [Medium] structure (flag-busy-function) F-1-5: relate/relate-executor/src/adjacency/delta.rs:273-277 — fold_chunk carries six phases (take the delta, decode and clone the sealed side, the emptiness bail, reclaim, a two-pass tombstone filter, and the fold guard plus commit) in 63 lines, with two ~10-l
  • [Medium] boundaries (std-6) F-1-50: relate/relate-executor/src/exec/gpm/emit_tests.rs:29-38 — This is a verbatim second copy of kernels/frontier_rider_tests.rs::ring_graph, whose own doc says it is "the gpm/emit_tests fixture's shape". Two suites now pin their contracts against separate co
  • [Medium] boundaries (std-6) F-1-51: relate/relate-executor/src/exec/kernels/mod.rs:402-416 — The prepare-once / tick / admit loop has three spellings: this generic function, whose P is instantiated only as Admission and only from scan_admit; the three-line scan_admit pass-through that
  • [Medium] boundaries (std-6) F-1-52: relate/relate-executor/src/exec/kernels/frontier_run.rs:543-546 — boundary_vars is documented as "the one spelling of the boundary-variable fact every re-derivation site consults" and enumerates its three consumers; this is a fourth site that re-derives the same p
  • [Medium] boundaries (std-5) F-1-53: relate/relate-executor/src/exec/kernels/frontier_match.rs:800-802 — An unbounded nested quantifier is not a bug here — it is an unpriceable estimate, and this same function already answers that case with None two lines above (which frontier_engages turns into "eng
  • [Medium] boundaries (std-6) F-1-54: relate/relate-executor/src/exec/pivot_tests.rs:463-468 — node/plain_rel/path are a third copy of the crate's IR-constructor vocabulary — test_support::frontier owns the canonical named_node/one_hop_rel/path_pattern and is documented as the one
  • [Medium] boundaries (std-6) F-1-55: relate/relate-executor/src/exec/graph_stats_tests.rs:320-337 — This exact leading-MATCH destructure plus the two Option<String> start-order assertions are copy-pasted in four tests here (sampled_contains_floor…, sampled_contains_scan_floor…, `the_range_wind
  • [Medium] boundaries (std-4) F-1-56: relate/relate-executor/src/graph/adjacency.rs:105-111 — IdVec exposes only retain for a mutable walk, so the compaction hands it a predicate that is true by construction: the call can never filter, yet the other forty-odd retain calls in the execut
  • [Medium] boundaries (std-6) F-1-57: relate/relate-executor/src/graph/adjacency.rs:193-198 — typed_adj_len (lines 133-148) carries the identical len closure and the identical three-arm match dir; the diff added the sealed argument to both copies instead of resolving the side once. The
  • [Medium] boundaries (flag-parallel-tables) F-1-59: relate/relate-executor/src/graph/degree_stats_incident.rs:149-156 — The invariant "each delta map has exactly one sealed side table" is a single fact about Graph, but it is re-derived by hand at roughly two dozen sites (incident_rels, research::live_neighbors, `
  • [Medium] structure (std-6) F-1-6: relate/relate-executor/src/adjacency/delta.rs:33-35 — The chunk table is the type's entire representation, and exposing it makes every consumer outside the module encode the Vec<(type_id, …)> layout: for (type_id, _) in &adj.chunks in graph/degree_st
  • [Medium] boundaries (flag-canonical-dup) F-1-60: relate/relate-executor/src/graph/entity_mutation.rs:387-397 — "Both directions' adjacency floor" is its own policy with no helper, so it is written out four times in this file — delete_rel before and after (387-388, 396-397) and set_property_rel before and i
  • [Medium] boundaries (std-5) F-1-61: relate/relate-executor/src/graph/tests/restore.rs:434-434 — chunk_lens(sealed) computes its third element as sealed.map_or(0, ...), so passing None makes the sealed hop count 0 by definition and the assertion can never fail; the loop also never looks a
  • [Medium] boundaries (std-5) F-1-62: relate/relate-executor/src/graph/tests/restore.rs:357-357 — The ids come from all_node_ids_at(1), and node_checkpoint_bytes(id, 1) returns None exactly when no version is visible at ts — already excluded by the id walk, so the filter_map (here and it
  • [Medium] boundaries (flag-canonical-dup) F-1-63: relate/relate-executor/src/overlay/writes.rs:383-396 — shift_created_labels, shift_created_properties (408-421) and shift_created_rel_properties (433-446) are the same 14-line capture→measure→shift_workspace body with only the measure expression d
  • [Medium] comparison (flag-copy-paste) F-1-64: relate/relate-executor/src/graph/tests/adjacency_model_proptest.rs:399-405 — This proptest copies the full case harness of adjacency_matches_reference_model (lines 371-387) — the same Graph/NODE_POOL seeding, the same type_ids interning, the same ModelAdj+live initiali
  • [Low] structure (std-6) F-1-66: relate/relate-executor/src/adjacency/mod.rs:147-149 — Same representation leak on the sealed side: outside the module only emptiness and the chunk count are read (region.chunks.is_empty() in graph/adjacency.rs:62 and :100-101, s.chunks.len() in graph
  • [Low] branching (std-3) F-1-67: relate/relate-executor/src/adjacency/mod.rs:106-110 — The inner is_some branch only means "a delete may overwrite the stamp, a reposition may not"; Option::or states that in one expression and deletes a nested conditional from the write path.
  • [Low] branching (std-3) F-1-68: relate/relate-executor/src/exec/catalog_show/mod.rs:344-348 — The cypher5 null rule sits as a guard in front of a match that already dispatches Value::Null on its next line, so the null-name policy is split between a pre-check and an arm; a reader has to com
  • [Low] branching (std-2) F-1-69: relate/relate-executor/src/exec/kernels/mod.rs:359-363 — scan_admit is already a no-op on an empty candidate list (admit_each prepares nothing and loops zero times), so this branch only avoids a call that does nothing; scan_segment carries the same gu
  • [Medium] structure (std-6) F-1-7: relate/relate-executor/src/adjacency/mod.rs:7-9 — The branch adds a second adjacency module beside the existing graph::adjacency, and the confusion is already concrete: this module and graph/adjacency.rs both open with a "not to be confused with"
  • [Low] branching (flag-re-split-fact) F-1-70: relate/relate-executor/src/exec/kernels/nfa.rs:620-622 — quantified.min == 0 — the one "this group admits zero rounds" fact — is derived here and again eight lines later for ChainEdges.zero_rounds (line 628), so a reader must check both spellings agree.
  • [Low] branching (std-3) F-1-71: relate/relate-executor/src/graph/adjacency.rs:96-101 — The per-side sequence is spelled out twice and the sealed-region invariant (no entry without a chunk) is enforced by two instructions in the caller instead of by the function that owns the side, so an
  • [Low] boundaries (std-5) F-1-72: relate/relate-executor/src/adjacency/delta.rs:27-31 — The doc promises the delta entry always stays to hold the type's first-seen iteration slot, but remove (lines 98-103) drops the entry when the last delta hop goes and the sealed stream covers none,
  • [Low] boundaries (std-6) F-1-73: relate/relate-executor/src/exec/catalog_show/mod.rs:516-519 — Verbatim duplicate of the show helper later in the same test module (lines 681-683), for the same harness against the same default graph; two names for one behavior invite the two to diverge.
  • [Medium] structure (flag-canonical-dup) F-1-8: relate/relate-executor/src/adjacency/mod.rs:231-236 — The admission estimate hand-assembles the region a delete creates instead of asking the code path that creates it: the three terms must mirror SealedAdj::chunk_or_insert (inline empty encoding), `Se
  • [Medium] structure (flag-missed-decomposition) F-1-9: relate/relate-executor/src/graph/adjacency.rs:104-113 — This branch doubles the adjacency state into four parallel tables (out_adj/in_adj plus sealed_out/sealed_in) and then threads the delta/sealed pair by hand through every helper and accessor (flatten_a
  • [Medium] branching (std-0) F-2-1: relate/relate-executor/src/adjacency/codec.rs:72-77 — The codec's block framing — width byte, BitWriter, packed-length arithmetic — is spelled four times: this id-delta loop, the ts-gap loop directly above it, and the two mirrored while remaining > 0 l
  • [Medium] boundaries (std-6) F-2-10: relate/relate-executor/src/exec/ddl.rs:482-485 — The owner-constraint join already has one canonical owner: backing_constraint_by_name (relate-engine-api/src/redo/index.rs:351) is documented as "the one owner-constraint join every index reader res
  • [Medium] boundaries (std-5) F-2-11: relate/relate-executor/src/exec/bulk.rs:319-324 — delete_kind resolves every DELETE variable to its Factor (and fails the whole shape when it does not resolve), then throws the resolution away and stores the variable name in `BulkKind::Delete.t
  • [Medium] boundaries (std-5) F-2-12: relate/relate-executor/src/exec/dispatch.rs:928-933 — The only caller (the Clause::Match arm of run_clauses_mode) has already destructured this clause and passes patterns and where_clause as typed arguments, but not the match mode; the fold entry
  • [Medium] boundaries (std-6) F-2-13: relate/relate-executor/src/graph/census.rs:105-105 — heap_bytes re-spells the per-node adjacency floor that graph::adj_floor (graph/mod.rs:1419) already owns — map.get(node).map(floor) + sealed.get(node).map(floor) — and it cannot call that helper
  • [Medium] boundaries (std-5) F-2-14: relate/relate-executor/src/graph/census.rs:96-100 — Every sealed read is sealed.get(&id) for an id the delta map yielded, so the census never enumerates the sealed tier: nodes, sealed_chunks, hops and heap_bytes silently omit a region with no
  • [Medium] boundaries (std-7) F-2-15: relate/relate-executor/src/graph/adjacency.rs:58-62 — The delta-entry removal and the sealed-entry removal are two separate store operations after the pair's guards drop at the closing brace: a concurrent adj_tombstone_deleted can see the still-present
  • [Medium] boundaries (std-6) F-2-16: relate/relate-executor/src/graph/tests/restore.rs:416-426 — The new test defines a local observable snapshot that re-implements this file's adjacency() helper (lines 217-229) exactly minus the two degree columns, so the one "three-direction neighbors_at
  • [Medium] boundaries (std-6) F-2-17: relate/relate-executor/src/graph/tests/restore.rs:402-407 — The new test hand-spells the same writer→reader checkpoint handoff as checkpoint_load_and_wal_replay_build_adjacency_once: the identical node/rel row extraction (lines 282-291 vs 343-352) and the id
  • [Low] branching (std-3) F-2-18: relate/relate-executor/src/adjacency/delta.rs:334-339 — merge_chunk already emits a lone delta stream: with an empty sealed side its while guard is false and the tail for hop in &delta[i..] loop is exactly this None arm. So the no-sealed read path
  • [Low] branching (flag-one-off-bool) F-2-19: relate/relate-executor/src/graph/tests/adjacency_model_proptest.rs:106-107 — The direction is a bare bool in the map key and in four signatures (insert, reposition, ModelAdj::observable, the free observable), so call sites read model.insert(nodes[end], false, …) an
  • [Medium] branching (q-missing-model) F-2-2: relate/relate-executor/src/adjacency/delta.rs:257-258 — The "a never-sealed chunk seals only at the floor" watermark is the due gate's fact (chunk_due: _ => delta >= COMPACTION_DELTA_FLOOR), and the fold re-derives it here with inverted sense to decide
  • [Low] boundaries (std-6) F-2-20: relate/relate-executor/src/adjacency/mod.rs:127-133 — decoded() immediately above is exactly codec::decode_chunk(&self.bytes), so the one question "turn this chunk into its hop stream" has two spellings in the same impl block; any change to what deco
  • [Low] boundaries (std-4) F-2-21: testing/relate-query-latency/examples/heap_census.rs:230-232 — AdjacencyCensus::of counts chunks from the delta table only (adj.chunks.len()) and sealed_chunks from the sealed region — two disjoint, additive counts — yet the new parenthetical presents the
  • [Low] boundaries (std-4) F-2-22: testing/relate-query-latency/examples/heap_census.rs:238-240 — The in-direction copy repeats the same subset-shaped parenthetical over the same disjoint counts: c.r#in.chunks is the delta chunk table while c.r#in.sealed_chunks counts the separate folded regio
  • [Medium] branching (q-missing-model) F-2-3: relate/relate-executor/src/eval/quantifier.rs:196-200 — eval_all_reduce re-spells the canonical three-valued All fold that eval/fold.rs::fold_quantifier owns: a saw_null flag plus the manual early-false / null-records-unknown / else-true resolution
  • [Medium] branching (q-missing-model) F-2-4: relate/relate-executor/src/eval/quantifier.rs:164-168 — The evaluate-list / propagate-Null / type-error policy is spelled a third time in this file (also eval_quantifier and eval_reduce, differing only in the message), so the list-argument contract has
  • [Medium] branching (flag-nullable-mode) F-2-5: relate/relate-executor/src/exec/catalog.rs:191-195 — The typed CatalogProjection is immediately flattened into Option (None = Star, Some = Columns) and then re-matched at line 215, so the same two-variant vocabulary is decided in two places; a n
  • [Medium] branching (std-0) F-2-6: relate/relate-executor/src/graph/tests/adjacency_model_proptest.rs:167-170 — ModelAdj::insert already owns the find-or-push chunk insert, yet reposition spells the same match a second time after its removal, so the model's one hop-insert policy lives in two places — the pr
  • [Medium] branching (q-missing-helper) F-2-7: relate/relate-executor/src/graph/tests/adjacency_model_proptest.rs:323-327 — The Delete arm repeats this exact empty-guard, sort and modulo at 347–352, so the strategy's live-slot selection is maintained twice inside one match and a third slot-indexing op would copy it again
  • [Medium] boundaries (std-5) F-2-8: relate/relate-executor/src/adjacency/mod.rs:66-70 — These two fields are the struct's entire invariant — bytes must always be an encode_chunk stream, and the tombstone set is written only through tombstone — yet both are pub, so any module can
  • [Medium] boundaries (std-5) F-2-9: relate/relate-executor/src/adjacency/delta.rs:149-160 — The accessor answers a positional (u32, usize, usize) whose two counts are interchangeable usizes, and every production consumer immediately re-derives the one number it wants by summing the last
  • [Medium] branching (q-missing-model) F-3-1: relate/relate-executor/src/adjacency/mod.rs:128-131 — Once a chunk carries a tombstone, every adjacency read of it filters through this retain, and hidden_at (89-91) re-scans the whole tombstone vector per hop, so a chunk with H hops and T tombstones c
  • [Medium] boundaries (std-6) F-3-10: relate/relate-executor/src/adjacency/delta.rs:85-88 — The type-id → chunk-slot lookup has no single owner: chunk spells iter().find, chunk_mut spells iter_mut().find (its doc claims to be "the one find-chunk spelling" the hop policies route throu
  • [Medium] boundaries (std-6) F-3-11: relate/relate-executor/src/exec/graph_stats.rs:81-86 — rel_type_rows (162–167) is this same four-line body with only the store accessor swapped, so the "an absent/unresolved name prices at zero rows" fold is stated twice in one PatternStats impl and a
  • [Medium] boundaries (std-6) F-3-12: relate/relate-executor/src/exec/kernels/frontier_run.rs:295-300 — try_frontier_rows runs the identical per-seed pass at 189–218 — cancel tick, frontier::run under WalkBudget::standard() with the contract's pool, recorded_run's decline, and `tables = walked.r
  • [Medium] boundaries (std-5) F-3-13: relate/relate-executor/src/graph/adjacency.rs:37-42 — SealedAdj treats a zero-hop chunk as a first-class state (chunk_or_insert mints one for a delta-only delete, adj_remove writes one back, chunk_len reads it as 0), so the presence probe is true
  • [Medium] boundaries (std-4) F-3-14: relate/relate-executor/src/graph/mod.rs:735-738 — One concept — a side's sealed-tier estimate state — is carried as four parallel locals plus a shared regions set and then re-selected by `if incoming { (&mut sealed_in_span, &mut sealed_in_side) } e
  • [Medium] boundaries (std-6) F-3-15: relate/relate-executor/src/graph/mod.rs:745-748 — The module already owns this derivation: rel_live_identity (mod.rs:1111) is documented as "the rel's LIVE identity — its endpoints and type" and gc_rel_chain spells the same vers.last() + triple
  • [Medium] boundaries (std-6) F-3-16: relate/relate-executor/src/graph/tests/adjacency.rs:539-544 — Lines 536-550 hand-roll the exact sealed-floor fixture this PR adds as test_support::folded_floor_chunk — fresh endpoints, 32 ascending-ts :T hops, one write, the fold, then `interner.get_id("T"
  • [Low] branching (std-3) F-3-17: relate/relate-executor/src/adjacency/delta.rs:196-200 — The iterator already yields each (type_id, delta), but the map discards the delta and hands only the id to chunk_due, which re-fetches the same chunk with self.chunk(type_id) — a linear scan of
  • [Low] branching (std-3) F-3-18: relate/relate-executor/src/exec/dispatch.rs:818-823 — The With arm (802–810) and the Return arm (818–826) build the same seven-field ProjectSpec literal; the only difference is where_clause, so a new ProjectSpec field must be added in two arms
  • [Low] branching (std-3) F-3-19: relate/relate-executor/src/exec/ddl_notifications.rs:518-523 — The gate's evidence is unwrapped in two statements: rule exists only to be re-matched on the next line. Its twin already_exists_index_note (line 308) uses the combined `Gate::Skip(ExistingRule::In
  • [Medium] branching (flag-silent-fallback) F-3-2: relate/relate-executor/src/adjacency/delta.rs:206-209 — A due id the scan cannot find is silently skipped, so a stale or duplicated entry would leave a chunk unfolded with no error — the silent-drop shape the code-shape rules ban. Today due_chunks yields
  • [Low] branching (std-3) F-3-20: relate/relate-executor/src/graph/tests/adjacency.rs:721-726 — The match splits one Option chain into two arms only so None can answer 0, while the very next line already spells the flat form (map_or(0, |adj| adj.chunk(type_id).len())); the "no region or no c
  • [Low] branching (std-3) F-3-21: relate/relate-executor/src/graph/entity_mutation.rs:384-386 — The guard block's tuple is bound to a temporary and then destructured again, so the delete path reads as a two-step handoff that exists only to end the rels guard; the intermediate binding is a left
  • [Low] boundaries (std-5) F-3-22: relate/relate-executor/src/exec/kernels/rearival_tests.rs:537-537 — The case shape is a 4-tuple whose last two slots are interchangeable usizes (seed index and vocabulary pattern index), so a transposed destructure or constructor compiles and only the doc comment ab
  • [Low] boundaries (std-5) F-3-23: relate/relate-executor/src/exec/kernels/frontier_differential_tests.rs:175-182 — The frontier family already has the typed two-variant nfa::Pool for exactly this fact (every other driver — frontier_endpoints, compile_frontier — passes Pool), yet this helper re-encodes it a
  • [Low] boundaries (std-6) F-3-24: relate/relate-executor/src/exec/graph_stats.rs:152-157 — range_rows (122–127) spells the same two-level with_str name projection over the label/property pair, with only the store accessor (and the Absent policy above it) differing; the by-name estimate
  • [Medium] branching (flag-temp-branch) F-3-3: relate/relate-executor/src/exec/dispatch.rs:597-599 — profile_recorded (declared at line 196, set at 462 and 584) is a second copy of state metrics_tick already carries: each self-recording arm sets it only to stop the shared tail from recording the
  • [Medium] branching (std-2) F-3-4: relate/relate-executor/src/exec/dispatch.rs:505-509 — The void-procedure unit row is a call-layer fact (procedures.rs's void_optional_unit_row, already used by both the registry and ontology call paths), but the generic clause dispatcher re-infers it
  • [Medium] branching (std-2) F-3-5: relate/relate-executor/src/exec/catalog.rs:303-307 — The coupling invariant is stated as "both markers are always written together", but the restore enforces it with two independent matches: an absent SOURCE_CELLS short-circuits with continue before
  • [Medium] branching (std-2) F-3-6: relate/relate-executor/src/exec/count_stats.rs:198-201 — rp.direction is a typed enum already filtered to Outgoing | Incoming at line 183, yet the start/end order is decided by a second match spelled as Outgoing plus a wildcard, so every other variant
  • [Medium] branching (std-0) F-3-7: relate/relate-executor/src/graph/adjacency.rs:40-43 — This new guard splits adj_reposition into two modes chosen by probing the sealed tier's per-type chunk table from the graph layer, and the else arm hand-replays the delta-only half of `TypedAdj::r
  • [Medium] branching (q-missing-model) F-3-8: relate/relate-executor/src/graph/mod.rs:763-767 — The slot-array charge is one three-part protocol — a span, a first-seen node set, and the store's slot/overflow strides — but it is held as bare locals: the create arm already hand-pairs `out_sp
  • [Medium] boundaries (std-6) F-3-9: relate/relate-executor/src/adjacency/mod.rs:220-223 — SealedAdj::chunks is the one adjacency container grown by push without the crate's capacity helper (chunk_or_insert pushes the same way at 194-202), while SealedAdj::floor_bytes prices it with

Stellar review: ⚠️ partial round — the model run hit the review timeout; the passes not covered could still hold blockers, so this check fails and the next push or re-run reviews fresh

@jexp
jexp force-pushed the feat/sealed-delta-adjacency branch from 1eaaffe to 492ca81 Compare November 10, 2026 21:31
@jexp
jexp marked this pull request as ready for review November 10, 2026 21:31
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Spec-harness coverage — 🟡

  • 🟡 spec coverage 98.58% — 479 genuine failures (1.42% of the executed scenarios)
  • scenarios run: 33675 (passed 33196, failed 479)
  • bands: 🟢 zero failures · 🟡 failure share ≤ 10% · 🔴 beyond (ADR-0482 §4 — the light never fails the build)
  • suite runtime: 1m 18s
  • neo4j_expected_fail (not counted): 375
  • nondeterministic (not counted): 4
  • skipped (not counted): 2323
  • harness ref: 7e20ca499d0c6e51c7e70f195642c467f5e18f93
failure category count
error-class-mismatch 181
missing-validation 105
side-effects 51
result-mismatch 33
result-temporal-fidelity 29
syntax-error 28
notification-missing 19
type-error 12
other 10
semantic-error 8
setup-failed-syntax 2
setup-failed-type 1

Rerun spec-harness to refresh. Coverage below 100% never fails the build (ADR-0482 §4).

tombstones: Vec<Tombstone>,
horizon: u64,
) -> Vec<Tombstone> {
let mut sealed_dead: HashSet<RelId> = HashSet::new();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Low] Consistency: reclaim builds two std::collections::HashSet<RelId> for id membership, while fold_chunk (adjacency/delta.rs) builds the same kind of RelId set as crate::UsedSet (FxHashSet<RelId>) in the same fold pass.

Why this matters: two spellings of one id-set policy sit one call apart, so a later reader cannot tell whether the std set is deliberate; the crate keeps UsedSet at the root for exactly this (ADR-0355 / LABS-337), and the fold pays SipHash per tombstone on the checkpoint path.

Suggested fix:

let mut sealed_dead = crate::UsedSet::default();
let mut deleted_dead = crate::UsedSet::default();

and drop the now-unused std::collections::HashSet import in this module.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Loadtest baselines comparison

Note: loadtest comparison completed with no failing rows.


Loadtest baseline comparison

Frozen baselines vs current reports; bands match the compare-loadtests gate.

Status: ok

Pairs: fraud-loadtest: compared · identity-loadtest: compared

fraud-loadtest

baselines/fraud-loadtest.json → target/fraud-loadtest.json

Metric Baseline PR Δ Status
environment relate-loadtest-baseline/v1 relate-loadtest-baseline/v1 — match
errors 0 0 +0 ok
ops/s 3938.56 7178.75 +3240.19 (+82.3%) ok
p99 (worst: amount_band) 7.30 ms 6.48 ms -0.82 ms (-11.3%) ok
logical bytes 17,344,481 16,378,948 -965,533 (-5.6%) ok
Per-use-case p99 latency
Use case ops Baseline p99 PR p99 Δ Status
p2p_transfer 3,848 8.04 ms 7.17 ms -0.88 ms (-10.9%) ok
payroll_scatter 1,022 17.85 ms 9.72 ms -8.13 ms (-45.6%) ok
onboard_customer 844 8.53 ms 7.08 ms -1.45 ms (-17.0%) ok
mule_scatter 841 14.80 ms 9.67 ms -5.13 ms (-34.7%) ok
layering_cycle 883 15.10 ms 8.77 ms -6.33 ms (-41.9%) ok
recent_transfers 2,200 7.65 ms 6.50 ms -1.15 ms (-15.1%) ok
customer_portfolio 1,372 7.37 ms 5.92 ms -1.46 ms (-19.8%) ok
outgoing_volume 1,160 7.48 ms 5.67 ms -1.81 ms (-24.2%) ok
detect_fanout 828 25.78 ms 11.72 ms -14.06 ms (-54.5%) ok
detect_cycle 853 7.55 ms 5.94 ms -1.61 ms (-21.4%) ok
activity_page 1,113 7.48 ms 6.53 ms -0.95 ms (-12.7%) ok
search_customer 795 7.84 ms 6.28 ms -1.56 ms (-19.9%) ok
counterparties 1,120 7.45 ms 6.11 ms -1.34 ms (-17.9%) ok
payment_path 843 7.47 ms 6.59 ms -0.89 ms (-11.8%) ok
amount_band 861 7.30 ms 6.48 ms -0.82 ms (-11.3%) ok
flag_account 695 8.21 ms 6.23 ms -1.98 ms (-24.1%) ok
reverse_last_out 722 8.04 ms 6.84 ms -1.20 ms (-15.0%) ok

identity-loadtest

baselines/identity-loadtest.json → target/identity-loadtest.json

Metric Baseline PR Δ Status
environment relate-loadtest-baseline/v1 relate-loadtest-baseline/v1 — match
errors 0 0 +0 ok
ops/s 573.51 1239.39 +665.88 (+116.1%) ok
p99 (worst: group_roster) 7.72 ms 6.96 ms -0.75 ms (-9.8%) ok
logical bytes 7,167,614 7,393,325 +225,711 (+3.1%) ok
Per-use-case p99 latency
Use case ops Baseline p99 PR p99 Δ Status
provision_user 1,373 11.00 ms 8.00 ms -2.99 ms (-27.2%) ok
add_to_group 1,775 18.57 ms 9.99 ms -8.58 ms (-46.2%) ok
grant_role 1,079 18.52 ms 9.71 ms -8.81 ms (-47.6%) ok
attach_device 907 18.88 ms 10.08 ms -8.79 ms (-46.6%) ok
nested_grant 736 19.41 ms 9.74 ms -9.67 ms (-49.8%) ok
effective_access 2,173 25.25 ms 11.04 ms -14.21 ms (-56.3%) ok
org_walk 1,387 19.94 ms 9.78 ms -10.15 ms (-50.9%) ok
optional_manager 1,312 20.00 ms 9.66 ms -10.34 ms (-51.7%) ok
detect_nested_admin 810 19.97 ms 10.00 ms -9.98 ms (-50.0%) ok
detect_sod 817 19.60 ms 10.27 ms -9.33 ms (-47.6%) ok
stale_grants 827 15.06 ms 8.58 ms -6.48 ms (-43.0%) ok
search_directory 1,147 10.91 ms 7.59 ms -3.32 ms (-30.4%) ok
group_roster 1,047 7.72 ms 6.96 ms -0.75 ms (-9.8%) ok
access_review 801 20.02 ms 10.01 ms -10.01 ms (-50.0%) ok
reporting_path 794 30.98 ms 13.45 ms -17.53 ms (-56.6%) ok
disable_user 644 19.50 ms 10.11 ms -9.39 ms (-48.2%) ok
add_alias 710 19.99 ms 10.02 ms -9.97 ms (-49.9%) ok
revoke_membership 674 8.10 ms 6.95 ms -1.15 ms (-14.3%) ok
detach_device 538 14.79 ms 8.15 ms -6.64 ms (-44.9%) ok
clear_expiry 449 17.39 ms 8.90 ms -8.49 ms (-48.8%) ok

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Memory controls and workspace memory calibration

Warning: memory controls reported mixed.


Memory controls and workspace memory calibration

Status: mixed

sort — max_cgroup_to_logical_ratio

Verdict: improvement

Given: a fresh server per observation, admission on, a hold of 2500 ms, and 1 repeats. Families: sort, expand, aggregation, distinct, and create.

When: each observation parks its sessions on RETURN 1, then holds one workspace family at the target reservation. The shapes are one holder at 1.00 MB, 4.00 MB, and 16.00 MB, then the same 16.00 MB across two and four holders.

Then: each observation records VmRSS and cgroup deltas against the live held logical bytes. The child stays alive.

Outcome: Expected cgroup ratio 0.999x–1.082x. A reading may sit 5% outside that range. Measured 19.24 MB, ratio 0.874x.

Investigate whether this improvement is a false positive. When it is real, re-freeze the envelope with the create-loadtest-baselines workflow.

expand — max_rss_to_logical_ratio

Verdict: improvement

Given: a fresh server per observation, admission on, a hold of 2500 ms, and 1 repeats. Families: sort, expand, aggregation, distinct, and create.

When: each observation parks its sessions on RETURN 1, then holds one workspace family at the target reservation. The shapes are one holder at 1.00 MB, 4.00 MB, and 16.00 MB, then the same 16.00 MB across two and four holders.

Then: each observation records VmRSS and cgroup deltas against the live held logical bytes. The child stays alive.

Outcome: Expected RSS ratio 2.099x–2.147x. A reading may sit 5% outside that range. Measured 2.14 MB, ratio 1.004x.

Investigate whether this improvement is a false positive. When it is real, re-freeze the envelope with the create-loadtest-baselines workflow.

expand — max_cgroup_to_logical_ratio

Verdict: improvement

Given: a fresh server per observation, admission on, a hold of 2500 ms, and 1 repeats. Families: sort, expand, aggregation, distinct, and create.

When: each observation parks its sessions on RETURN 1, then holds one workspace family at the target reservation. The shapes are one holder at 1.00 MB, 4.00 MB, and 16.00 MB, then the same 16.00 MB across two and four holders.

Then: each observation records VmRSS and cgroup deltas against the live held logical bytes. The child stays alive.

Outcome: Expected cgroup ratio 2.072x–2.215x. A reading may sit 5% outside that range. Measured 34.00 MB, ratio 1.000x.

Investigate whether this improvement is a false positive. When it is real, re-freeze the envelope with the create-loadtest-baselines workflow.

aggregation — max_rss_to_logical_ratio

Verdict: regression

Given: a fresh server per observation, admission on, a hold of 2500 ms, and 1 repeats. Families: sort, expand, aggregation, distinct, and create.

When: each observation parks its sessions on RETURN 1, then holds one workspace family at the target reservation. The shapes are one holder at 1.00 MB, 4.00 MB, and 16.00 MB, then the same 16.00 MB across two and four holders.

Then: each observation records VmRSS and cgroup deltas against the live held logical bytes. The child stays alive.

Outcome: Expected RSS ratio 1.317x–1.395x. A reading may sit 5% outside that range. Measured 2.69 MB, ratio 1.562x.

This reading is above the frozen envelope. The compare warns and the job stays green until a new envelope is taken.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Memory shape

Note: loadtest comparison completed with no failing rows.


Memory shape

Status: ok

All memory shapes held. 🟢

base

Given: an empty relate serve, 1 integer properties on every node, text indexes 0, point indexes 0, range indexes 0, and a 32.00 MB logical ceiling.

When: the base shape is loaded to 0 nodes and 0 relationships, then checkpointed. The child RSS is sampled.

Then: the database holds those counts. The load finishes under the ceiling. Logical bytes, disk, attributed RSS, and the ratio stay inside the frozen boundaries.

Baseline: logical 0.00 MB – 0.00 MB, disk 0.00 MB – 0.00 MB, attributed RSS 0.00 MB – 0.00 MB, ratio 0.000x–0.000x. A reading may sit 5% outside the ratio, and 15% or 1.00 MB outside the sizes.

Validated: logical 0.00 MB, disk 0.00 MB, attributed RSS 0.00 MB, ratio 0.000x.

Report: logical, disk, attributed RSS, and the ratio held.

flat

Given: an empty relate serve, 1 integer properties on every node, text indexes 0, point indexes 0, range indexes 0, and a 32.00 MB logical ceiling.

When: the flat shape is loaded to 120000 nodes and 0 relationships, then checkpointed. The child RSS is sampled.

Then: the database holds those counts. The load finishes under the ceiling. Logical bytes, disk, attributed RSS, and the ratio stay inside the frozen boundaries.

Baseline: logical 26.02 MB – 26.02 MB, disk 1.95 MB – 1.95 MB, attributed RSS 36.49 MB – 36.93 MB, ratio 1.402x–1.419x. A reading may sit 5% outside the ratio, and 15% or 1.00 MB outside the sizes.

Validated: logical 26.02 MB, disk 1.26 MB, attributed RSS 37.16 MB, ratio 1.428x.

Report: logical, disk, attributed RSS, and the ratio held.

fanout

Given: an empty relate serve, 1 integer properties on every node, text indexes 0, point indexes 0, range indexes 0, and a 32.00 MB logical ceiling.

When: the fanout shape is loaded to 52016 nodes and 52000 relationships, then checkpointed. The child RSS is sampled.

Then: the database holds those counts. The load finishes under the ceiling. Logical bytes, disk, attributed RSS, and the ratio stay inside the frozen boundaries.

Baseline: logical 28.62 MB – 28.62 MB, disk 1.75 MB – 1.75 MB, attributed RSS 34.93 MB – 36.61 MB, ratio 1.220x–1.279x. A reading may sit 5% outside the ratio, and 15% or 1.00 MB outside the sizes.

Validated: logical 27.43 MB, disk 1.10 MB, attributed RSS 35.67 MB, ratio 1.300x.

Report: logical, disk, attributed RSS, and the ratio held.

ring

Given: an empty relate serve, 1 integer properties on every node, text indexes 0, point indexes 0, range indexes 0, and a 32.00 MB logical ceiling.

When: the ring shape is loaded to 46000 nodes and 46000 relationships, then checkpointed. The child RSS is sampled.

Then: the database holds those counts. The load finishes under the ceiling. Logical bytes, disk, attributed RSS, and the ratio stay inside the frozen boundaries.

Baseline: logical 29.99 MB – 29.99 MB, disk 1.77 MB – 1.77 MB, attributed RSS 35.30 MB – 35.89 MB, ratio 1.177x–1.197x. A reading may sit 5% outside the ratio, and 15% or 1.00 MB outside the sizes.

Validated: logical 29.99 MB, disk 1.20 MB, attributed RSS 36.14 MB, ratio 1.205x.

Report: logical, disk, attributed RSS, and the ratio held.

dense ring

Given: an empty relate serve, 1 integer properties on every node, text indexes 0, point indexes 0, range indexes 0, and a 32.00 MB logical ceiling.

When: the dense ring shape is loaded to 5000 nodes and 100000 relationships, then checkpointed. The child RSS is sampled.

Then: the database holds those counts. The load finishes under the ceiling. Logical bytes, disk, attributed RSS, and the ratio stay inside the frozen boundaries.

Baseline: logical 31.41 MB – 31.41 MB, disk 1.62 MB – 1.62 MB, attributed RSS 31.27 MB – 32.46 MB, ratio 0.996x–1.034x. A reading may sit 5% outside the ratio, and 15% or 1.00 MB outside the sizes.

Validated: logical 31.11 MB, disk 0.73 MB, attributed RSS 31.70 MB, ratio 1.019x.

Report: logical, disk, attributed RSS, and the ratio held.

@github-actions github-actions Bot 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.

Stellar review round 2: 11 inline finding(s); see summary comment.

out.push(width as u8);
let mut w = BitWriter::new();
for &delta in block {
w.write(delta, width);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] branching (std-0): The codec's block framing — width byte, BitWriter, packed-length arithmetic — is spelled four times: this id-delta loop, the ts-gap loop directly above it, and the two mirrored while remaining > 0 l

Suggested fix: Give the module one block-stream pair — encode_blocks(out, deltas, block) and decode_blocks(rest, count, block, apply) (ts: prev.wrapping_sub(raw); id: prev.wrapping_add(unzigzag(raw))) — and let encode_chunk/decode_chunk pass only the two transforms. The four loops and the duplicated wi

finding F-2-1

.map(|(_, delta, sealed)| (delta + sealed) as u64)
.sum::<u64>();
c.heap_bytes += adj.floor_bytes();
c.heap_bytes += adj.floor_bytes() + region.as_ref().map_or(0, |s| s.floor_bytes());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-6): heap_bytes re-spells the per-node adjacency floor that graph::adj_floor (graph/mod.rs:1419) already owns — map.get(node).map(floor) + sealed.get(node).map(floor) — and it cannot call that helper

Suggested fix: Give the store tier the combined measure — TypedAdj::floor_bytes_with(sealed: Option<&SealedAdj>) beside floor_bytes/chunk_lens — and have graph::adj_floor and AdjacencyCensus::of both call it, so the floor rule (delta plus sealed half) has one implementation.

finding F-2-13

let region = sealed.get(&id);
c.nodes += 1;
c.chunks += adj.chunks.len() as u64;
c.sealed_chunks += region.as_ref().map_or(0, |s| s.chunks.len()) as u64;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-5): Every sealed read is sealed.get(&id) for an id the delta map yielded, so the census never enumerates the sealed tier: nodes, sealed_chunks, hops and heap_bytes silently omit a region with no

Suggested fix: Walk both stores as first-class sources — a sealed.for_each pass (or a per-direction handle that owns the pair) adding the sealed nodes/chunks/hops/floor bytes — instead of deriving the sealed counts from the delta map's keys; then census_counts_hops_across_the_fold can pin that the two walks ag

finding F-2-14

adj.remove(region.as_deref_mut(), type_id, id);
}
map.remove_if(&node, |adj| adj.chunks.is_empty());
sealed.remove_if(&node, |region| region.chunks.is_empty());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-7): The delta-entry removal and the sealed-entry removal are two separate store operations after the pair's guards drop at the closing brace: a concurrent adj_tombstone_deleted can see the still-present

Suggested fix: Resolve the pair removal in one critical section — the per-side store handle (or a paired remove_if taking both guards) removes the delta and sealed entries atomically, so a tombstone cannot land in a region whose delta slot is being removed.

finding F-2-15

(id, expands)
})
.collect()
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-6): The new test defines a local observable snapshot that re-implements this file's adjacency() helper (lines 217-229) exactly minus the two degree columns, so the one "three-direction neighbors_at

Suggested fix: Delete the closure and compare adjacency(&opened) with adjacency(&writer); if the degree columns are noise, expose an expansions-only projection of adjacency()/NodeAdjacency and use it from both tests.

finding F-2-16

// position any more — a hop the chain GC already pruned — and the
// region goes with the last one. The delta hops stay as they are.
if hops.is_empty() && delta.len() < COMPACTION_DELTA_FLOOR {
let delta_ids: UsedSet = delta.iter().map(|h| h.id).collect();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] branching (q-missing-model): The "a never-sealed chunk seals only at the floor" watermark is the due gate's fact (chunk_due: _ => delta >= COMPACTION_DELTA_FLOOR), and the fold re-derives it here with inverted sense to decide

Suggested fix: Let the gate own the verdict: pass chunk_due's decision — or a small value that also names the reason (floor, ratio, reclaimable) — into the fold, and have the zero-hop arm consult that instead of re-comparing delta.len() against COMPACTION_DELTA_FLOOR.

finding F-2-2

match chunks.iter_mut().find(|(t, _)| *t == type_id) {
Some((_, hops)) => model_insert_hop(hops, (ts, id)),
None => chunks.push((type_id, vec![(ts, id)])),
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] branching (std-0): ModelAdj::insert already owns the find-or-push chunk insert, yet reposition spells the same match a second time after its removal, so the model's one hop-insert policy lives in two places — the pr

Suggested fix: After the remove-and-drop-emptied block (its chunks borrow has ended), call self.insert(node, out, type_id, id, ts); the duplicated match and its model_insert_hop call site disappear, and the insert path stays the single spelling of find-or-create.

finding F-2-6

return;
}
live.sort_unstable();
let id = live[(slot as usize) % live.len()];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] branching (q-missing-helper): The Delete arm repeats this exact empty-guard, sort and modulo at 347–352, so the strategy's live-slot selection is maintained twice inside one match and a third slot-indexing op would copy it again

Suggested fix: Extract one helper fn live_slot(live: &mut Vec<RelId>, slot: u16) -> Option<usize> that returns None when empty, sorts, and yields slot as usize % live.len(); both arms open with let Some(idx) = live_slot(live, slot) else { return; };, and Delete then takes live.remove(idx) while SetTs

finding F-2-7

/// The hybrid-codec hop stream, in `cmp_ts_desc` order.
pub bytes: Vec<u8>,
pub tombstones: Vec<Tombstone>,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-5): These two fields are the struct's entire invariant — bytes must always be an encode_chunk stream, and the tombstone set is written only through tombstone — yet both are pub, so any module can

Suggested fix: Make the fields private behind the module's own constructors (SealedChunk::new(hops, tombstones) for the encoding path and a shared SealedChunk::empty()), plus a read-only tombstones() for the assertions; the encoder-validity invariant then has one owner, as with the container-level leaks F-1-

finding F-2-8

sealed.map_or(0, |s| s.chunk_len(*type_id)),
)
})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-5): The accessor answers a positional (u32, usize, usize) whose two counts are interchangeable usizes, and every production consumer immediately re-derives the one number it wants by summing the last

Suggested fix: Give the iterator the per-chunk degree the callers ask for — impl Iterator<Item = (u32, usize)> computing delta.len() + sealed.chunk_len(type_id) once — or, if the split must stay, return a named ChunkLens { type_id, delta, sealed }; the three callers then drop their `|(_, delta, sealed)| delt

finding F-2-9

@jexp
jexp force-pushed the feat/sealed-delta-adjacency branch from 492ca81 to ac105d3 Compare November 11, 2026 00:10
}

fn compact_side(&self, delta: &IdVec<TypedAdj>, sealed: &IdVec<SealedAdj>, horizon: u64) {
delta.retain(|node, adj| {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] Concurrency: compact_side runs the whole fold inside IdVec::retain, which holds the map's single RwLock<Store<T>> write guard while every due chunk is decoded (SealedChunk::decoded) and re-encoded (put_chunk → encode_chunk).

Why this matters: gc_versions runs on the checkpoint timer with readers live, so one checkpoint blocks every concurrent adjacency read (try_for_each_hop_resolved_at, degree_out, …) for the sum of all folds; the rest of gc_versions deliberately re-enters the store one entry at a time via keys().
Suggested fix: mirror the per-id GC pattern — let nodes = delta.keys(); then delta.get_mut(&node) and fold that node, so the map guard is held per node instead of for the whole map.

let i = match self.chunks.iter().position(|(t, _)| *t == type_id) {
Some(i) => i,
None => {
self.chunks.push((

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] Memory accounting: these pushes into self.chunks (and the one in put_chunk, line ~222) never call fit_reserved, so the Vec keeps Rust's minimum reservation — 4 strides of a 56-byte (u32, SealedChunk) — while SealedAdj::floor_bytes charges vec_heap(len, stride) = one stride for a one-chunk region. The same holds for the tombstones vector put_chunk installs from a collect()ed kept.

Why this matters: vec_heap models capacity as reserved_len(len) and TypedAdj::insert / SealedChunk::tombstone keep that true with fit_reserved (the crate pins capacity() == reserved_len(len) in graph/tests/mod.rs), so the sealed tier here under-charges real heap by up to ~3 strides per region — the exact floor structure_bytes and the heap census report.
Suggested fix: crate::memory::fit_reserved(&mut self.chunks) after both pushes, and fit the incoming tombstones before storing it.

@github-actions github-actions Bot 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.

Stellar review round 3: 10 inline finding(s); see summary comment.

let mut hops = codec::decode_chunk(&self.bytes);
if !self.tombstones.is_empty() {
hops.retain(|h| !self.hidden_at(h.id, ts));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] branching (q-missing-model): Once a chunk carries a tombstone, every adjacency read of it filters through this retain, and hidden_at (89-91) re-scans the whole tombstone vector per hop, so a chunk with H hops and T tombstones c

Suggested fix: Give SealedChunk one tombstone-visibility lookup: collect the ids hidden at ts once (self.tombstones.iter().filter(|t| t.xmax <= ts).map(|t| t.id)) and filter the decoded stream against that set (or keep the tombstones id-sorted and binary-search), with hidden_at/visible_hops expressed on

finding F-3-1

let Some(ci) = self.chunks.iter().position(|(t, _)| *t == type_id) else {
return;
};
let v = &mut self.chunks[ci].1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-6): The type-id → chunk-slot lookup has no single owner: chunk spells iter().find, chunk_mut spells iter_mut().find (its doc claims to be "the one find-chunk spelling" the hop policies route throu

Suggested fix: Give each typed-chunk table one indexed lookup (fn chunk_index(&self, type_id: u32) -> Option<usize>) that chunk, chunk_mut, remove and fold_due all route through, and replace SealedAdj::chunk/chunk_mut/chunk_or_insert's find/iter_mut/position trio with the same helper, so the key or

finding F-3-10

// empty region — and its slot array — behind for nothing.
if sealed
.get(&node)
.is_some_and(|region| region.chunk(type_id).is_some())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-5): SealedAdj treats a zero-hop chunk as a first-class state (chunk_or_insert mints one for a delta-only delete, adj_remove writes one back, chunk_len reads it as 0), so the presence probe is true

Suggested fix: Ask the positional fact the comment states — region.chunk_len(type_id) > 0 — or push the supersede decision into the store (TypedAdj::reposition taking Supersede/Option<Supersede>, deciding for itself whether a tombstone is worth recording) so adj_reposition is one unconditional call and t

finding F-3-13

let mut sealed_out_span = self.sealed_out.span();
let mut sealed_in_span = self.sealed_in.span();
let mut sealed_out_side = HashSet::new();
let mut sealed_in_side = HashSet::new();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-4): One concept — a side's sealed-tier estimate state — is carried as four parallel locals plus a shared regions set and then re-selected by `if incoming { (&mut sealed_in_span, &mut sealed_in_side) } e

Suggested fix: Give each side one owned value — e.g. struct SideEstimate { span: usize, side: HashSet<NodeId> } (or a row that carries its own &mut accumulators) — and drive both loops from it; the if incoming re-selection and the bool row tag disappear, and the shadowed sealed name is gone.

finding F-3-14

let Some((start, end, type_id)) = self.rels.get(id).map(|vers| {
// Every version of one rel id shares its endpoints and type.
let newest = vers.last();
(newest.live.start, newest.live.end, newest.live.type_id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-6): The module already owns this derivation: rel_live_identity (mod.rs:1111) is documented as "the rel's LIVE identity — its endpoints and type" and gc_rel_chain spells the same vers.last() + triple

Suggested fix: Call the existing self.rel_live_identity(id) here (it returns exactly the triple, read the write-window way), and expose that accessor to gc_rel_chain (a &Chain<LiveRel> form so it works under the get_mut guard) instead of letting each site re-derive the chain identity.

finding F-3-15

a,
b,
"T".into(),
BTreeMap::from([("ts".into(), Value::Int(i))]),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-6): Lines 536-550 hand-roll the exact sealed-floor fixture this PR adds as test_support::folded_floor_chunk — fresh endpoints, 32 ascending-ts :T hops, one write, the fold, then `interner.get_id("T"

Suggested fix: let (a, b, _, type_id) = crate::graph::test_support::folded_floor_chunk(&g); and drop the hand-rolled create loop and fold (keep floor for the delta hops' ts values); the later compact_adjacency_at_watermark(0) stays as the test's own second fold.

finding F-3-16

for type_id in due {
if let Some(ci) = self.chunks.iter().position(|(t, _)| t == type_id) {
changed |= self.fold_chunk(sealed, ci, *type_id, horizon);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] branching (flag-silent-fallback): A due id the scan cannot find is silently skipped, so a stale or duplicated entry would leave a chunk unfolded with no error — the silent-drop shape the code-shape rules ban. Today due_chunks yields

Suggested fix: Assert the invariant (let ci = self.chunks.iter().position(...).expect("a due chunk still exists")) or fold in one pass over self.chunks with due-ness decided per entry so no id lookup can miss; do not keep a branch whose only outcome is a silently skipped fold.

finding F-3-2

if sealed
.get(&node)
.is_some_and(|region| region.chunk(type_id).is_some())
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] branching (std-0): This new guard splits adj_reposition into two modes chosen by probing the sealed tier's per-type chunk table from the graph layer, and the else arm hand-replays the delta-only half of `TypedAdj::r

Suggested fix: Move the mode into the store tier the way adj_remove already takes its sealed side: TypedAdj::reposition(sealed: Option<&mut SealedAdj>, …) where the tombstone is recorded only for an existing chunk_mut(type_id) (SealedAdj::supersede, one documented policy sitting beside chunk_or_insert),

finding F-3-7

(&mut sealed_in_span, &mut sealed_in_side)
} else {
(&mut sealed_out_span, &mut sealed_out_side)
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] branching (q-missing-model): The slot-array charge is one three-part protocol — a span, a first-seen node set, and the store's slot/overflow strides — but it is held as bare locals: the create arm already hand-pairs `out_sp

Suggested fix: Extract the protocol once — SlotSpan { span: u64, seen: HashSet<NodeId>, slot: u64, overflow: u64 } with grow(&mut self, node) -> i64 — and instantiate one per store (SlotSpan::of(&self.out_adj), the sealed pair likewise), so each arm carries [SlotSpan; 2], iterates its two rows, and the `if

finding F-3-8

match self.chunk_mut(type_id) {
Some(slot) => *slot = chunk,
None => self.chunks.push((type_id, chunk)),
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] boundaries (std-6): SealedAdj::chunks is the one adjacency container grown by push without the crate's capacity helper (chunk_or_insert pushes the same way at 194-202), while SealedAdj::floor_bytes prices it with

Suggested fix: Call crate::memory::fit_reserved(&mut self.chunks) after the None-arm push in both put_chunk and chunk_or_insert (or route both growths through one insert helper that fits), so the table's capacity is the reserved_len(len) its floor_bytes charges.

finding F-3-9

…n (ADR-0551, ADR-0552)

Committed adjacency becomes a sealed hybrid-codec region plus a committed
delta per (node, rel type, direction) chunk, with an in-flight overlay, so
a checkpoint folds hot deltas into a packed, compressed region instead of
keeping every hop as a live sorted entry.

- new private `adjacency` module: bitpack + hybrid chunk codec, the
  `SealedAdj`/`SealedChunk` tier, `TypedAdj` delta, tombstones with separate
  supersede and delete version stamps, watermark compaction (delta > 25% of
  sealed, never-sealed delta at the floor, reclaimable tombstone at the GC
  horizon) driven by the existing `gc_versions` pass
- reads merge delta-first then sealed in cmp_ts_desc order; deletes of
  sealed hops record versioned tombstones, so a pinned snapshot keeps its
  frozen adjacency; a delete in a never-sealed chunk records its tombstone
  on an on-demand zero-hop chunk rather than letting the fold seal a ghost
- the delete tombstone records without a delta-entry precondition: the
  tombstone lives in the sealed region, so a delete landing in the window
  `adj_remove` leaves between its two side-table removals still hides the
  hop; a reposition of a delta-only hop records no tombstone at all, so it
  no longer leaves an empty region behind
- a zero-hop sealed region is due for the fold on a reclaimable tombstone
  and drops with the last one, so a sub-floor chunk churning delete or
  reposition no longer accumulates tombstones across checkpoints; the
  per-node length accessor takes the delta read guard before the sealed one,
  matching every sibling accessor
- the memory floor charges the sealed tier's slot arrays beside each
  region's floor — the term the heap census reads as `slot_bytes` — and a
  self-loop's delete charges both sides' on-demand regions
- the watermark fold holds the adjacency write guard per node, not across
  the whole map, so a concurrent reader stalls for one node's fold instead
  of the checkpoint's; the sealed tier's vectors fit their reservation, so
  the floor charge is the vectors' real heap
- the chunk codec names its header and block-width invariants instead of
  fabricating a zero length or a zero width over them
- the sealed tier is a Graph-level side table keyed by node and direction,
  so a node that never folds pays nothing: `TypedAdj` stays 24 bytes and the
  pinned logical-memory shapes are byte-identical to main
- every reader (neighbor walks, `incident_rels`, `redo_preflight`, the
  research neighbor walk, the heap census) goes through the one merged seam
- the ADR-0552 8-property proptest reference-model suite pins the observable
  adjacency before and after the rework, unmodified

Verification: `cargo test -p relate-executor` 1444 passed; `--features
research` green (incl. the census fold test); `relate-storage` 481 passed;
`relate` 1488 passed; `relate-datasets` memory-shape pins unchanged and
passing; `cargo fmt --all --check` and the workspace clippy gate clean;
`cargo xtask check-boundaries` 0 violations.

Known shortfall: the SF0.1 out+in adjacency census lands at 119.0 MiB
(1.24x from the 147.4 MiB baseline) rather than the 3x the destination
aimed for — the compressed payload falls to 48.7 MiB but the container and
slot floor (~69.7 MiB) dominates. The floor restructuring is filed as a
follow-up; query-latency (ADR-0245 bands) was not run.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@jexp
jexp force-pushed the feat/sealed-delta-adjacency branch from ac105d3 to 6fc7154 Compare November 11, 2026 00:43
@oplane-bot

oplane-bot Bot commented Nov 11, 2026

Copy link
Copy Markdown

Oplane Security Review

Oplane identified security requirements relevant to this PR and checked the implementation against them. All requirements are satisfied. Review the generated threat model.

StatusRequirementSeverityAction
🟢 ImplementedInput Validation and Error Handling for Adjacency Chunk Decoding
OPLANE_REQ-00354795
Critical
🟢 ImplementedSnapshot Isolation Enforcement in Adjacency Reads
OPLANE_REQ-00354796
High
🟢 ImplementedResource Accounting for Compressed Sealed Regions
OPLANE_REQ-00354797
Medium

Change comment settings · Set up Oplane in your agent · Workflow guidance

/// reposition keeps the sealed stamp and adds the delete stamp: the
/// sealed position was superseded at the reposition, the relocated delta
/// hop dies at the delete.
pub(crate) fn tombstone(&mut self, id: RelId, ts: u64, supersede: Supersede) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] Denial of service: tombstone bookkeeping is a linear scan on both the write and the read path, so bulk deletes and repeated reads of a tombstoned chunk scale quadratically.

Why this matters: tombstone scans every existing tombstone per delete (iter_mut().find), so K deletes on one (node, type, direction) chunk cost O(K²) — one MATCH (n)-[r:T]->() DELETE r over a hub pays that while the write runs — and visible_hops/hidden_at (lines 89–90, 127–130) scans all K tombstones for every one of N hops, costing O(N·K) per neighbor expansion whenever the tombstones are not yet reclaimable (a pinned snapshot, or the window before the next checkpoint).

Suggested fix: key tombstones by id (a HashMap<RelId, Tombstone> beside the Vec, or keep it sorted and binary-search), and build one hidden-id HashSet per chunk per read instead of scanning the tombstone list per hop.

};
delta += span_growth(span, node, sealed_slot, sealed_overflow, side);
}
delta += crate::adjacency::fresh_sealed_region_bytes() as i64;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] Resource exhaustion: the new per-delete sealed-region estimate is refusable, so a relationship DELETE at the logical memory cap fails instead of committing.

Why this matters: this line adds fresh_sealed_region_bytes() to RedoDelta::total but not to tombstone_spill, so admit_redo_capacity sees a positive refusable delta on a delete and returns Error::Capacity; ADR-0529 and logical_graph_size_limit_delete_then_create_recovers require a delete at the cap to commit so space can be reclaimed, and the rel-chain spill is already exempt for exactly this reason.

Suggested fix: report the sealed-region growth as part of the delete's tombstone spill (thread it out of estimate_adj_delta into RedoDelta::tombstone_spill) so refusable subtracts it, matching the rel-chain spill.

let sealed = region
.as_ref()
.is_some_and(|region| region.chunk(type_id).is_some());
if !sealed && regions.insert((incoming, node, type_id)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] Memory accounting: estimate_adj_delta prices a delete's on-demand sealed region but not the tombstone that same delete records on an already-sealed chunk.

Why this matters: for a hop whose (node, type) chunk is already sealed, delete_rel still calls adj_tombstone_deleted, which pushes a Tombstone and can re-grow the vector — here sealed == true, so this loop skips the charge entirely. admit_redo_capacity only sees this estimate, so a batch of sealed-hop deletes (or a SET r.ts that repositions one, which has no estimate branch at all) is admitted with none of the bytes it retains and used_bytes can land past logical_graph_size_limit — the failure mode the stats/constraint entry terms exist to close.
Suggested fix: charge one Tombstone per delete when sealed is true (deduped per side/node/type in regions) and cover the reposition path; if deletes must stay unrefusable like the chain spill (ADR-0529), report the same term in tombstone_spill instead of total.

@github-actions github-actions Bot 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.

Stellar review round 4: 2 inline finding(s); see summary comment.

/// One sealed side-table id slot, the stride of the sealed stores' arrays.
fn sealed_slot() -> u64 {
std::mem::size_of::<Option<SealedAdj>>() as u64
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] structure (std-1): graph/mod.rs is the crate's hub module and this PR grows it 1431 -> 1511 lines with the sealed tier's whole pricing family: two more stride helpers here, the sealed terms in structure_bytes, and a sec

Suggested fix: Move the adjacency/sealed pricing and estimate family — adj_slot/adj_value/sealed_slot/sealed_value, hop_counts, adj_floor, span_growth, bump_adj and estimate_adj_delta — into graph/adjacency.rs (which already owns the adjacency accessors and imports hop_counts) or a graph/adjacency_estimate.rs besi

finding F-4-1

// prices, plus the slot arrays that hold them — the term the heap
// census reads as `slot_bytes`.
n = n.saturating_add(self.sealed_out.array_bytes());
n = n.saturating_add(self.sealed_in.array_bytes());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium] structure (std-6): structure_bytes states its own composition rule a few lines below this hunk — "Each family's term lives with the family ... and composes here, at the oracle's one site" — and every sibling obeys it (d

Suggested fix: Add adjacency_structure_bytes() beside the adjacency accessors in graph/adjacency.rs (out_adj/in_adj slot arrays + floors, sealed slot arrays + region floors) and call it at the oracle beside the three sibling family terms, so the module that owns the adjacency layout also prices it.

finding F-4-2

@jexp
jexp merged commit 101e848 into main Nov 11, 2026
41 of 44 checks passed
@jexp
jexp deleted the feat/sealed-delta-adjacency branch November 11, 2026 02:00
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