Repository navigation
Exclude conversations from search_nodes in the query, not by refetching after it - #3548
Conversation
Pragmatic Code Review: PR #3548 (issue #3509)Review Type: Initial Review (no earlier reviews or comments on the PR) Verdict: APPROVE. The code change is correct and a clear net improvement. Three follow-ups are worth doing before merge, none of them a code defect: one new test does not prove what it claims, the test file's comments still describe the removed refetch, and the docs criterion is open. Requirements Check
What I tracedEvery statement carries the exclusion.
A user-defined type extending A side benefit not in the PR description: in the stem fallback, chats no longer take slots in the candidate cap ( The Code Review Findings🟡 1. The stem fallback test passes without the exclusion📁 Problem. Recommendation. Drop Principle. A regression test must fail when the behaviour it names is removed. The fallback is a separate statement, which is exactly where a dropped condition would go unnoticed. 🟡 2. Comments in the test file still describe the refetch📁 Problem. Three doc comments now describe behaviour that no longer exists:
Recommendation. Reword them to say the exclusion is part of the statement. "Pass unchanged" in the issue is about the tests' code and assertions; the file is already edited to add a test, and a comment edit changes no test. Principle. Comments explain why; a comment that describes a deleted mechanism misleads the next reader. 🟡 3. The docs criterion is open, and the PR closes the issue📁 Problem. Criterion 6 is unmet, and "Closes #3509" will close the issue on merge with it unchecked. The stated plan (update right after merge) is reasonable given the docs live in another repository, and this is not a node-type change, so no merge-gate check depends on the sheet. Recommendation. I do not treat this as blocking the code. Make the docs edit part of the merge step itself, not a later task: one sentence replaced on line 320 (the condition is in the statement on both engines, resolved through the ancestry table; no refetch). Tick the criterion only once it is pushed. Principle. Acceptance criteria are the definition of done; an auto-closed issue with an open criterion is how doc drift starts. 🟢 4.
|
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Review addressed (61073b5)Addressed
Not changed
After merge
Tests: the 12 agent Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The fixes are a test assertion, comments, and one private signature change in |
|
Merge queue: #3548 was taken out of the queue — the merge gate failed on it, on top of main. Reproduce by merging or rebasing |
…ng after it (closes #3509) search_nodes left conversations out after the fetch and refetched with a larger page when one came up short. Both of its engines now take the exclusion as a condition of the statement, resolved through the type ancestry table, so limit rows come back in one fetch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…n, fix stale test comments - The stem fallback test no longer passes a limit, so a chat the fallback let through is in the result. Checked by removing the exclusion from the fallback: the test fails. - Three comments in the test file described the removed refetch. - excluded_types_sql's doc no longer names a caller. - build_where_clause takes the exclusion, so it is again the one place that decides which rows match; build_where_clause_with is gone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
61073b5 to
cc40288
Compare
Closes #3509
What changed
search_nodesused to fetch a page, drop every conversation from it, and fetch again with a page four times larger when a full page came up short. It now leaves conversations out in the statement, solimitrows come back in one fetch.governance::excluded_types_sqlis public. It gives aNOT IN (SELECT node_type FROM type_ancestry ...)condition, so a subtype of an excluded type is excluded with no change to the caller._excludingvariant that takes the excluded types:SqliteStore::query_nodes_excluding(the title stem fallback included),NodeService::query_nodes_excluding,node_ops::query_nodes_excluding,QueryService::execute_excludingandquery_ops::execute_query_excluding. The existing functions call them with nothing excluded.GraphToolExecutor::run_node_querypassesCoreNodeType::AiChatto both engines.CONVERSATION_FETCH_HEADROOM,CONVERSATION_FETCH_GROWTH,NodePageQuery,fetch_node_pageand the refetch loop are gone.The exclusion is a function argument, not a field on
QueryDefinition,NodeQueryorQueryNodesInput. The first two are wire shapes, and the existing test file builds aQueryNodesInputliteral that the issue requires to pass unchanged.search_semanticneeded no change: chats are not embedded, so it has no conversation rows to drop.Tests
search_nodes_excludes_conversations.rspass unchanged. One test is added there for the title stem fallback.query_service_test.rs: the condition sits in the WHERE clause ahead of LIMIT, and excluded rows do not count against the limit.Still to do
architecture/data-layer.mdin nodespace-docs still describes the refetch. It is updated right after this lands.🤖 Generated with Claude Code