Repository navigation
Batch B (P1): collection member traversal (#1426) + member_of cycle guard (#1427) + FTS backfill (#1428) - #1457
Conversation
…loses #1426, closes #1427, closes #1428) Three related collection/search data-integrity fixes in the core data layer. #1426 — get_collection_members_recursive descended the subtree via `has_child`, but collection hierarchy is built from `member_of` edges, so the recursive arm matched nothing and only the seed collection's DIRECT members were returned — every sub-collection's members were silently dropped. Descend `member_of` parent→child (out_node→in_node) restricted to collection children, with a depth cap. #1427 — collection hierarchy is a DAG but nothing enforced it: `a member_of b` + `b member_of a` created a cycle (which, post-#1426, makes the recursive walk loop). Add `validate_no_member_of_cycle` and call it before creating a collection→collection `member_of` edge; reject with `collection_cycle` (the existing-but-unused error). No-op for ordinary content membership. #1428 — the external-content `node_fts` triggers only index future writes, so nodes predating the FTS table (user DBs are never reset) were absent from the index and never matched by `bm25_search_roots`. Backfill once with the idempotent FTS5 rebuild, gated on the indexed-doc count (`node_fts_docsize`) differing from `node` so a healthy DB doesn't re-index every startup — `count(*) FROM node_fts` is unusable here (external-content reads content rowids). Tests cover all three; full core suite green; free-users guardrail 7/7. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
APPROVE Reviewed all three bundled P1 fixes against #1426 — recursive collection members ( #1427 — member_of cycle guard ( #1428 — FTS backfill ( Mandate: shared core, but every change is additive bug-fix correctness, no Pro gating; free-users 7/7, lib 960/960 self-reported. Nits (non-blocking):
|
Summary
Phase 1 bug-sweep Batch B, core collection/search half — three related data-layer fixes (all in the community build).
#1426— recursive collection members followed the wrong edgeget_collection_members_recursivedescended the subtree withhas_child, but collection hierarchy is built frommember_ofedges, so the recursive arm matched nothing — only the seed's direct members were returned and every sub-collection's members were silently dropped.Fix: descend
member_ofparent→child (out_node→in_node), restricted to collection children, with a depth cap.#1427— no cycle validation on collectionmember_ofhierarchyvalidate_no_cycleonly coveredhas_child; collection hierarchy (member_of) had no guard, soa member_of b+b member_of acreated a cycle in the supposed DAG (which, post-#1426, loops the recursive walk).Fix: new
validate_no_member_of_cycle, called before creating a collection→collectionmember_ofedge; rejects with the existing-but-unusedcollection_cycleerror. No-op for ordinary content membership.#1428— FTS5 index never backfilledThe external-content
node_ftstriggers only index future writes, so nodes predating the FTS table (user DBs are never reset) were absent from the index and never matched bybm25_search_roots.Fix: one-time idempotent FTS5 rebuild, gated on the indexed-doc count (
node_fts_docsizeshadow table) differing fromnode— so a healthy DB doesn't re-index its whole corpus on every startup. (count(*) FROM node_ftsis unusable as the signal: for an external-content table it reads content rowids and always equals the node count.)Tests
cargo fmt/clippy -D warningsclean.test:free-users: 7/7 — community build behavior intact.Free/community impact
These ARE community-build fixes (core data layer) — additive correctness, no Pro/sync coupling; free-users guardrail green.
Closes #1426, closes #1427, closes #1428.