Repository navigation
Generalize get_multi_membership_edges into member_of_edges with caller-supplied filters - #3383
Conversation
Pragmatic code review (initial review, medium depth)Review Type: Initial Review Requirements Check
Code Review SummaryThe change is small, correct and idiomatic for this codebase. No bugs found. SQL equivalence (checked against
Placeholders and binding
Tests
FindingsCritical Issues
Suggested Improvements
Nitpicks
Recommendation: APPROVE |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment, since GitHub blocks self-approval). Full findings in the review comment above.
Address-review summaryReview verdict was APPROVE with no critical or improvement findings and two nits.
Checks after the change: Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: the only change since the review is a two-line comment with no logic change. Nothing in the diff the reviewer approved was altered. |
…shold and excluded member types The query now describes only the graph: every member_of edge whose member has at least min_memberships member_of edges and whose node_type is not in exclude_member_types. The threshold of two and the exclusion of person members move to the caller. Adds tests for the type exclusion, including several types and an unknown one, and for a threshold below one. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…the documented contract Comment-only. Every member has at least one edge, so a threshold of 0 already matches 1; the clamp is kept because the doc promises it. Co-Authored-By: Claude Sonnet 5 <[email protected]>
566b0de to
4b10804
Compare
Closes #3343
Part of the Pro/core boundary epic (#3298). Implements ADR-083 §4 decision 5-B (proposed).
What changed
SqliteStore::get_multi_membership_edges()becomesSqliteStore::member_of_edges(min_memberships, exclude_member_types).member_ofedge, as(member_id, collection_id), whose member has at leastmin_membershipsmember_ofedges and whosenode_typeis not inexclude_member_types.personmembers. A caller reproduces the old result withmember_of_edges(2, &["person"]).?1and is clamped to at least 1. The excluded types bind as?2.., one placeholder each, and theNOT INclause is only added when the slice is non-empty.Failed to read member_of edges).member_of_edges(2, &["person"]).Tests (
collection_service.rs)All three compare edges as sets, since the order is unspecified.
member_of_edges_with_threshold_two_skips_single_membershipsis the old test, renamed and rewritten in graph terms.member_of_edges_excludes_listed_member_typesadds the local person and a content node to two collections. With(2, &[])both nodes' edges appear. With(2, &["person"])exactly the person's edges disappear. An unknown type excludes nothing.member_of_edges_threshold_below_one_behaves_as_one:(0, &[])equals(1, &[]), and both include a single-membership node's edge.Deviation from the issue text
The exclusion test also asserts
&["person", "text"]excludes both nodes' edges. The issue's stated risk is a placeholder numbering error in the dynamicNOT INlist, and a single-type test cannot see one, so this case is what covers?3and beyond.Mutation checks
Each mutation was applied to the production SQL/code alone, the three tests were run, and the change was reverted.
member_of_edges_excludes_listed_member_typesfails on "the person's edges are absent"; the other two pass> 1member_of_edges_threshold_below_one_behaves_as_onefails on "a threshold of 1 includes a single-membership node's edge"; the other two pass>= 1member_of_edges_with_threshold_two_skips_single_membershipsfails on the edge-set equality; the other two passmember_of_edges_excludes_listed_member_typesfails on "every listed type is excluded"; the other two passThe
.max(1)clamp on the threshold is not distinguishable by any test: everyGROUP BYgroup has at least one row, so>= 0and>= 1return the same rows. It is kept because the documented contract says a threshold below 1 behaves as 1, and that holds either way.Verification
nextest run -p nodespace-core --lib member_of_edges: 3 passed.cargo fmt -p nodespace-core, andcargo clippy -p nodespace-core --all-targets -- -D warnings -D clippy::unused-async: clean.bun run test:changed: passed (test:scriptsand the Rust workspace nextest run). Frontend and skill tiers were not reached by this diff.git grep -n get_multi_membership_edgesprints nothing across the repository.Pro-boundary ratchet
scripts/check-pro-boundary.tsis not onmainyet (its PR is still open), so there is noBASELINESto edit here. I measured the effect with the ratchet's ownMARKERSfrom that PR's branch, counting the two changed files atorigin/mainagainst this branch:cloudSyncHooks: 4 -> 0 (the method, the old test's doc, its name, and its call).Whoever lands second should tighten
cloudSyncHooksby 4 inBASELINES. The embedding-seam removal touches the same marker, so both PRs would edit the same baseline line and the merge queue would eject the second one on conflict. The check is one-way, so leaving the ceiling where it is fails nothing.Risks and rollback
A placeholder numbering error would fail loudly in the tests. Rollback is a revert of this PR.
🤖 Generated with Claude Code