Repository navigation
Run a saved query by id or title, narrow it at run time, negate filters, and filter into object values - #3578
Conversation
Pragmatic code review: PR #3578 (issue #3554)Review type: initial review (no prior reviews or comments on the PR). Verdict: COMMENT. No blocker. One Important finding (1) gives silently wrong queue membership for subtype nodes and should be fixed in this PR; the rest are smaller. The SQL-safety work is sound. I tried to get a property or sort name out of the JSON path literal and could not: every route to SQL goes through Requirements check
Findings🟡 Important1. A negated filter matches every subtype row whose field is inherited, because the property bucket is the target type's name, not the field's owner. A subtype's node keeps an inherited field in the base type's bucket.
The Recommendation: resolve the bucket from the field's owner. Verified by: reading the builders and the storage rule (stated in 🟢 Suggestions2. Save-time validation does not check identifier characters. 3. A saved query with no stored limit returns 50 rows from 4. A bad run-time filter value reaches the agent as a hard tool error. 5. A negated nested filter starts its walk from nearly every node. 6. An archived related node still counts. Nitpicks
What is good
|
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: COMMENT (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Review addressed (commit 21c963c)
Addressed
Not changed
Re-review: needed. Finding 1 changed how the query service builds property conditions. |
Pragmatic code review (re-review): PR #3578, commit 21c963cReview type: re-review of Verdict: APPROVE. The Important finding is fixed correctly and the new tests pin it. Nothing in this commit blocks the merge. Four suggestions below, none of them a regression. Previous review summary
Status of each previous finding
Finding 1: what I checked
TestsRan: Read, not run against the old code (that needs a file edit): each would fail on
SuggestionsA. 🟢 A sort on an inherited field still returns the wrong rows, not only the wrong order. The response says this is "ordering only". With a limit it is not. Scenario: a saved query on It predates this PR, so it does not block. But B. 🟢 Nothing tests the save-time identifier check. No test creates a query node with I checked the regression risk of the new call and found none: a query with no C. 🟢 The agent still gets 50 rows from an unlimited query with no sign of the cut, and has no ceiling at all. Finding 3's scenario was "how many are ready?" answered 50. That question is asked of the agent, and the agent path is unchanged: 80 ready tasks,
Recommendation: either split the two (a D. 🟢 Each property filter resolves the type's schemas again. A plain property filter on a typed target used to cost no schema read. It now calls Wildcard form, performance. No concern worth a change. The correlated subquery only runs for a row whose own bucket has no value (COALESCE stops at the first non-NULL), and it is a primary-key prefix probe on Nitpicks
Verified by running versus reading
|
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (re-review): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Re-review addressed (commit 709fb38)
Not changed: A. A sort on an inherited field of a subtype target still reads the target type's own bucket. It predates this PR and needs a scope on the sort item, a wire struct. Re-review: not needed. The changes are a test, a per-query cache and a note on the tool result. |
|
Merge queue: #3578 was taken out of the queue — it conflicts with main in: packages/daemon/src/services/node_service.rs, packages/skill/references/cli.md. Merge or rebase origin/main, resolve the conflicts, push, and re-run |
…rs, and filter into object values
f117026 to
07afff7
Compare
Closes #3554. Implements ADR-094 §1 (build order step 1): a saved query can be run by id or title, narrowed at run time, and its filters can negate and reach into object values.
What changed
QueryFiltergains one optionalnegateflag. The query service compiles a negated filter as(<condition>) IS NOT TRUE, so a node with no value for the field is kept ("status is not done" keeps a task with no status; a negatedexistsis "has no value"). On arelatedfilter it means "the path reaches no node matching the nested filter", and the nested filter can be negated too.propertyand a sort'sfieldaccept a dotted path (repository.url). Each segment is held to the identifier characters before SQL is built, and a path of several segments is checked against the schema's declaredfields(inherited ones included) when the query is saved and each time it runs. A wildcard query refuses a path.query_ops::run_saved_query_nodes, theRunSavedQueryRPC,nodespace query run <id|title> [--filters] [--limit], and the agent'srun_querytool. Run-time filters are ANDed with the stored ones; a run-time limit lowers the stored limit and never raises it; nothing is written to the query node. A title matching no query, or several, fails saying which and lists the ids.run_queryis in the tool registry withnodespace query runas its CLI command, has a seeded tool node, and is offered by the Research & Search skill.negateand dotted paths.SKILL.mdandreferences/cli.mddocumentquery run, narrowing, negation and object paths. The CLI-surface generator now lists a command's own arguments beside its subcommands (queryruns both ways).Things a reviewer should know
linkfield type (Add a link field type: a title and URL pair for schema fields #3541) has not landed. Paths resolve throughobjectfields' declared sub-fields. A link field'stitle/urlneed a small addition incheck_property_pathonce that type exists.run_queryjoins the Research & Search tool list, which changes the tools on the most common routed turn. Its effect on the local model was not measured.search_nodes's own schema is unchanged;negateis exposed to the model only onrun_query's filters.checked_definitionnow validates identifiers before resolving paths against the schemas, so a malformed name is reported as malformed rather than undeclared.Tests
bun run test:changedpasses (unit, browser, types:check, node-types:check, Rust workspace).New coverage: the two queue queries from the issue ("no unfinished blocker", "no unapproved plan", including tasks with no blocker and no plan), run by id and title, sorting / limit / relative dates on a run, narrowing leaves the stored query unchanged, none / several / wrong-type references, object paths in filters and sorts, undeclared paths refused at save and run, JSON-path breakout attempts, negated Play selectors (inline and via saved query), the RPC and CLI end to end, the agent tool through
GraphToolExecutor, and the app matcher.Docs (
components/query-node.md,architecture/data-layer.md) are updated in nodespace-docs and pushed with the merge.🤖 Generated with Claude Code