Skip to content

Execute saved queries on the backend instead of sorting in the browser (closes #2727) - #2742

Merged
malibio merged 4 commits into
mainfrom
issue-2727-backend-query-sorting
Sep 17, 2026
Merged

malibio merged 4 commits into
mainfrom
issue-2727-backend-query-sorting

Conversation

@malibio

@malibio malibio commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Closes #2727.

What this changes

A saved query was fetched by its targetType and then filtered, sorted and limited on the client, so query semantics had two implementations kept in agreement by hand. Priority ordering made the cost concrete: the frontend carried its own copy of the urgency rank table, pinned to nothing — no test spanned both languages, so a one-sided edit would have produced a silent disagreement between what the backend returns and what a query displays.

The sorting-capable path already existed end to end. ExecuteQuery (proto) → query_ops::execute_query_nodes → QueryService applies filters, ordering and limit in SQL. Only the Tauri command and the adapter method were missing — so this is a wiring change plus deletions, not new backend capability. No proto change.

Deleted

  • executeQueryDefinition / applyFilters / applySorting
  • TaskNodeHelpers.priorityRank and CORE_PRIORITY_RANKS (the unpinned TS rank table)
  • unevaluableFilters — went further than the issue asked. Its caveat told users parent/children filters couldn't be applied; QueryService evaluates all four relationship types in SQL, so delegating fixes the limitation the caveat existed to disclose.

Kept, deliberately

matchesFilter stays, re-scoped to the one question the backend cannot answer cheaply: whether a node created elsewhere (CLI, agent, another tab) belongs in an already-open view. Re-running the query per created node would cost a round-trip each time.

Its parent/children arm now returns false rather than passing through. Pass-through was right when it governed the whole result (better too wide than empty); for an append gate it is wrong. Declining is self-correcting — the next load includes the node — while passing it through shows a node the query may exclude, with nothing to fix it until a reload.

Sort field naming

Metadata sort fields are converted at the adapter boundary (modifiedAt → modified_at). This is not cosmetic. Verified against a live daemon:

sort field result
modified_at desc none, high, lowest, medium, highest, low ✅ correct
modifiedAt desc low, highest, medium, lowest, high, none ❌ creation order — the exact reverse

No error is raised: an unrecognized field becomes a structurally-NULL json_extract that orders every row equally. Property names are stored as authored and pass through untouched.

Verification

Live daemon on a fresh database, six tasks seeded in scrambled order:

ASC        : none, highest, high, medium, low, lowest   ← urgency rank, not alphabetical
DESC       : lowest, low, medium, high, highest, none
ASC limit 3: none, highest, high                        ← LIMIT picks the right rows
filter+sort: highest, high                              (in [high, highest])

Alphabetical order would have been high, highest, low, lowest, medium — plausible enough to read as intentional, which is why it went unnoticed before. The limit 3 case confirms SQL's ORDER BY applies before LIMIT, so the in-Rust re-sort agrees (the ordering question the issue flagged).

  • Frontend: 5181 passed (255 files)
  • Rust: 1517 passed, including query_service_test.rs's priority coverage
  • quality:fix clean — svelte-check 0 errors, clippy -D warnings
  • Full pre-push pyramid passed

Priority ordering remains verified per the issue's acceptance criterion. query_service_test.rs covers rank ascending/descending, the LIMIT interaction, wildcard scoping, and pins the SQL CASE to TaskPriority::rank(). New adapter-core.test.ts (10 tests) covers the encoding that carries a sort there — the genuinely new code.

Note

The pre-existing local database had to be reset: it predated the reverse_relationship_type column and failed schema bootstrap with no such column. Unrelated to this change, reproducible on clean main, and resolved per the project's reset-don't-migrate policy.

🤖 Generated with Claude Code

closes #2727)

A saved query was fetched by its `targetType` and then filtered, sorted and
limited on the client, so query semantics had two implementations that had to
be kept in agreement by hand. Priority ordering made the cost concrete: the
frontend carried its own copy of the urgency rank table, pinned to nothing —
no test spanned both languages, so a one-sided edit would have produced a
silent disagreement between what the backend returns and what a query displays.

The sorting-capable path already existed end to end: the `ExecuteQuery` RPC
reaches `query_ops::execute_query_nodes` and then `QueryService`, which applies
filters, ordering and limit in SQL. Only the Tauri command and the adapter
method were missing. This adds them and routes the saved-query load and the
filter-editor preview through that path.

Deleted, now that one implementation remains:
- `executeQueryDefinition` / `applyFilters` / `applySorting`
- `TaskNodeHelpers.priorityRank` and `CORE_PRIORITY_RANKS`
- `unevaluableFilters`, whose caveat no longer applies — `QueryService`
  evaluates parent/children relationship filters in SQL, so delegating fixes
  the limitation the caveat existed to disclose

`matchesFilter` stays, re-scoped to the one question the backend cannot answer
cheaply: whether a node created elsewhere (CLI, agent, another tab) belongs in
an already-open view, which would otherwise cost a round-trip per created node.
Its parent/children arm now returns false rather than passing through —
unverifiable is not the same as matching, and when the decision is whether to
*add* a node to a settled set, declining is self-correcting (the next load
includes it) while passing it through shows a node the query may exclude.

Sort field names are converted at the adapter boundary: a stored definition
spells metadata fields camelCase (`modifiedAt`), while `resolve_field` matches
the column name (`modified_at`). An unconverted name would not error — it would
become a structurally-NULL `json_extract` that orders every row equally.

Priority ordering remains verified: `query_service_test.rs` covers the rank
ascending and descending, its interaction with LIMIT, the wildcard scoping, and
pins the SQL CASE to `TaskPriority::rank()`. New `adapter-core.test.ts` covers
the encoding that carries a sort there.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@malibio

malibio commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

Automated Pragmatic Code Review — PR #2742

Verdict: APPROVE WITH COMMENTS — one real bug worth fixing before merge (silent truncation at 500), everything else is improvement-or-nit.

This is a clearly net-positive change. It deletes a duplicated query engine and routes saved queries to the single implementation that was already there, end to end. 452 added against 323 deleted, most of the additions being wire encoding and its tests. The reasoning in the code comments is unusually good — several of them explain why a decision was made in a way that will survive the next person to touch this file. Below, I worked through each of the seven judgment calls you flagged.


Findings

Critical / Blocker

1. [Blocker] fetchCapped cannot fire — the daemon clamps at 500, the viewer asks for 1000

packages/desktop-app/src/lib/components/viewers/query-node-viewer.svelte:252,258
packages/daemon/src/services/node_service.rs:976

Your suspicion is correct and I can confirm the mechanism exactly:

// node_service.rs:976
const MAX_EXECUTE_QUERY_LIMIT: usize = 500;
limit: if req.limit == 0 { None } else { Some((req.limit as usize).min(MAX_EXECUTE_QUERY_LIMIT)) }
// query-node-viewer.svelte
const FETCH_LIMIT = 1000;
limit: definition.limit ?? FETCH_LIMIT
fetchCapped = definition.limit === undefined && nodes.length >= FETCH_LIMIT;

A saved query with no limit sends limit: 1000, the daemon silently clamps it to 500, and nodes.length can therefore never reach 1000. fetchCapped is dead — permanently false on the saved branch. A user with 900 matching tasks sees 500 of them with no caveat at all, which is strictly worse than before: the old code fetched by type through queryNodes and at least attempted to flag truncation.

Note the old path was not correct either — MAX_QUERY_NODES_SIMPLE_LIMIT = 500 (node_service.rs:880) clamps queryNodes the same way, so the default branch at line 281 has the identical latent bug on main today. This PR doesn't introduce that half. But it does make the saved branch's caveat unreachable, and it's the natural place to fix both.

The clean fix is to stop having two numbers that must agree by coincidence. Either lower FETCH_LIMIT to 500 so the client's ask matches the server's ceiling (simplest, and makes >= FETCH_LIMIT meaningful again), or — better — have the backend report whether it truncated rather than inferring it from a row count. The count-based inference is inherently fragile: it is a client guessing at a server-side policy constant, which is precisely the class of cross-language duplication this PR exists to eliminate. Worth fixing here rather than filing, since the PR's own comment at line 257 asserts a property ("a query that asked for its own limit and got it is complete") that the code cannot actually deliver.

The second half of that line is sound, for the record: definition.limit === undefined correctly distinguishes "the query asked for N and got N" (complete) from "we imposed a cap" (partial). That reasoning is right. It's the FETCH_LIMIT comparand that's broken.


Suggested Improvements

2. [Improvement] shouldShowCreatedNode never appends for a parent/children-only query

packages/desktop-app/src/lib/components/query/query-node-model.ts:215

You asked specifically whether the flip to false is correct. Yes, for the new call site — and the asymmetry argument in the doc comment is the right one. When matchesFilter governed the whole result set, pass-through meant "too wide"; now it governs a single append into a settled set, and a wrong true paints a node into a view with nothing to correct it until reload, while a wrong false self-corrects on the next load. Declining is the right default.

But the edge case you anticipated is real. shouldShowCreatedNode uses .every(...), so a saved query whose filters are only parent/children returns false for every node, unconditionally. That gate is dead for such a query — live-append never fires at all.

How much this matters depends on reachability, and here the news is good: query-editor-model.ts:75-80 shows the builder only emits property filters; relationship filters survive round-trips only through the preserved pass-through, so they reach a definition solely from AI-generated or programmatically-created queries. So this is narrow. It's also a degradation to the pre-existing behavior (no live append until reload), not a correctness break — the node does appear on the next load, where SQL evaluates it properly.

I'd accept this as-is. Worth a one-line comment at the shouldShowCreatedNode .every(...) noting that an all-graph-filter definition disables live-append entirely, so the next reader doesn't have to re-derive it. If you want the behavior instead of just the note, the honest fix is to re-run the query on create for definitions containing graph filters — but that's the round-trip-per-node cost the module deliberately avoids, and YAGNI applies until someone builds such a query in the UI.

3. [Improvement] handleQueryPreview reports a capped count, and the label says "results"

packages/desktop-app/src/lib/components/viewers/query-node-viewer.svelte:458-464

limit: definition.limit ?? FETCH_LIMIT means the button reads "Preview (500 results)" for any query matching 500+ rows — and per finding 1, 500 is the real ceiling regardless of what's requested. For a preview, whose whole job is telling the author what their filters will select, a silently-saturating number is actively misleading: the author cannot distinguish "exactly 500 match" from "at least 500 match."

Two defensible semantics, and I'd argue for the second:

  • Matches-the-query (current): the preview shows what the saved query will display. Defensible, but then the capped case needs a "500+" rendering, not a bare "500."
  • Total matches (my preference): a preview answers "how many things satisfy these filters," which is the question the author is asking while authoring. The limit is a display concern, not a selection concern.

Either way the saturated case needs to be visually distinct. Minimum viable fix: render 500+ when nodes.length hits the cap. Ideally the backend would return a count rather than materializing rows just to call .length on them — fetching up to 500 full node payloads to display one integer is wasteful, and a COUNT(*) variant of ExecuteQuery would be the proper shape. That's reasonably filed as a follow-up rather than done here.

4. [Improvement] The 500 constant is triplicated in Rust with no shared definition

packages/daemon/src/services/node_service.rs:696, 880, 976

MAX_GET_ROOTS_LIMIT, MAX_QUERY_NODES_SIMPLE_LIMIT, MAX_EXECUTE_QUERY_LIMIT — three function-local consts, all 500, each with a comment referring to the others ("same clamp shape as ExecuteQuery's..."). This is pre-existing and not this PR's doing, but this PR adds the third and is the change that makes the constant matter to the frontend. A single pub const MAX_RESULT_LIMIT: usize = 500 that all three reference (and that the frontend's FETCH_LIMIT is derived from or at least documented against) would collapse the class of bug in finding 1 rather than fixing one instance of it. Reasonable as a follow-up issue.


Verified — no action needed

These are the remaining items you asked me to challenge. I checked each against source and found the reasoning holds.

unevaluableFilters deletion is correct. Verified against QueryService::build_relationship_condition (packages/core/src/services/query_service/mod.rs:668-701). All four RelationshipType variants — Children, Parent, Mentions, MentionedBy — produce real SQL subqueries against the relationship table. The caveat described a client-side limitation that genuinely no longer exists once execution moves to SQL; keeping it would have been a false warning. Deleting the user-facing string along with it is right.

encodeSortField's allowlist is exactly complete. resolve_field (mod.rs:424-441) tests ["created_at", "modified_at", "content", "node_type", "title"] — the same five, no more, no fewer. Anything else falls through to json_extract, so your empirical finding (unconverted modifiedAt silently yields creation order rather than erroring) is exactly what the code predicts: a structurally-NULL extract that orders every row equally, leaving the SQL default ordering to show through. That silent-degradation-not-error property is what makes this worth the test you wrote for it.

The adapter is the right layer. It is the boundary where the frontend's camelCase domain vocabulary meets the backend's snake_case wire vocabulary, and the filter-key conversion in buildExecuteQueryWire already lives there for the same reason. Putting it in the viewer would leak wire concerns upward; putting it in the backend would mean the daemon accepting two spellings for one field, which is worse.

One genuine fragility to note, though no change requested: the coupling between METADATA_SORT_FIELDS and resolve_field is exactly the cross-language duplication this PR set out to remove — a list in TypeScript that must agree with a list in Rust, pinned by nothing but a comment. It's much lower-stakes than the priority rank table was (five stable metadata columns vs. a semantic ordering table), and the failure mode is a silent no-op sort rather than wrong data, so I'm not blocking on it. But the comment at adapter-core.ts should probably say so plainly.

Serde shapes agree across all three transports. I checked this one carefully since three independent things must line up:

targetType filtersJson sortingJson limit
buildExecuteQueryWire (TS) ✅ string string | null number (0 = unset)
ExecuteQueryArgs (Tauri, rename_all = "camelCase") target_type ✅ Option<String> ✅ Option<String> ✅ u32, #[serde(default)] ✅
dev-proxy.ts route ✅ ?? null ✅ ?? null ✅ ?? 0 ✅
ExecuteQueryRequest (proto:639) target_type optional string optional string uint32, 0 = default

The camelCase rename maps targetType→target_type and filtersJson→filters_json correctly. The dev-proxy route mirrors the existing /api/query handler's shape line for line (node_service.rs:552-560 vs 575-580), so it's consistent with established convention rather than a new pattern. The daemon reads filters_json with Some(raw) if !raw.is_empty(), so "[]" and absent both land on empty — the TS side always sends a string here, which is fine.

The deny_unknown_fields reasoning in buildExecuteQueryWire's doc comment is correct and worth keeping: AgentFilterItem and AgentSortItem both carry it (query_ops.rs:35,64), so a stray camelCase key would be a hard 400, not a silent drop. Omitting absent optionals rather than sending null is the right call for the same reason.

Security: exposure widens, but not meaningfully, and the escaping holds. The framing is right — this PR does newly route user-editable query-builder filters to a format!-interpolating SQL path. Assessing each surface:

  • Identifiers (target_type, filter property, sort field) are guarded by validate_identifier (query_ops.rs:258-279), allowlisting [A-Za-z0-9_:-]. An allowlist on identifiers is the correct control, and this one is tight enough to exclude quotes, whitespace, parens and semicolons. Sound.
  • Values go through format_value (mod.rs:704-713), which handles only String/Number/Bool/Null and bails on anything else — so no object or array reaches string interpolation unstructured. Strings get escape_string, i.e. ' → '', which is the correct and complete escape for a SQLite single-quoted literal. SQLite has no backslash escape in string literals, so the doubling is sufficient; there's no mysql_real_escape_string-class charset hole here.
  • escape_string_for_like additionally escapes \, %, _ and orders the replacements correctly (quote first, then backslash, then wildcards — so the wildcard escapes aren't themselves double-escaped). Correct.
  • Node IDs in build_relationship_condition go through escape_string. Fine.

So: no injection I can construct, and the widening is more theoretical than practical given the builder emits only property filters over schema-known fields. Two things still worth saying. First, string interpolation is the wrong default even when the escaping is right — it's correct-by-audit rather than correct-by-construction, and every future operator added to QueryService is a fresh chance to interpolate without escaping. libsql supports bound parameters; values should use them, keeping interpolation for identifiers only, where binding isn't possible. That is a QueryService refactor well outside this PR's scope, but this PR is a good argument for filing it: the threat model just changed from "agent-authored queries" to "user-typed input," and format!-based SQL is a materially different risk under the latter. Second, the unsupported value type and missing value paths bail! with anyhow, surfacing as OpsError::Internal → a gRPC error string; worth a glance that query text isn't echoed into user-visible errors, though I saw nothing alarming.


Requirements Validation — Issue #2727

Criterion Status
NodeQuery carries sorting (and filters) ✅ Met, better than asked. Rather than widening NodeQuery — which would have given one type two modes — this adds a separate ExecuteQueryInput that mirrors the existing ExecuteQueryRequest. ISP-correct: queryNodes callers don't inherit fields they can't use.
Saved-query execution routes through QueryService ✅ Met. query-node-viewer.svelte:248.
applySorting / applyFilters / executeQueryDefinition deleted, plus TaskNodeHelpers.priorityRank and CORE_PRIORITY_RANKS ✅ Met, all five gone. Verified no dangling references.
Priority ordering still verified end-to-end ✅ Met — see below.
Query-view tests depending on client-side execution updated ✅ Met. query-node-viewer-materialize-race.test.ts stubs both queryNodes and executeQuery, which is the right belt-and-braces for a test whose subject is the group-by restore rather than the fetch path.

On the priority-coverage criterion specifically, since that was the one the issue flagged as at risk: the deleted TS tests covered ascending rank, descending, user-defined-last, absent-first, and non-task-type exclusion. The retained Rust suite in query_service_test.rs covers a strict superset:

test_sort_by_priority_ascending_uses_rank_not_alphabetical
test_sort_by_priority_descending_reverses_rank
test_sort_by_priority_places_user_defined_values_last
test_sort_by_priority_with_limit_ranks_in_sql
test_sort_by_priority_sorts_absent_before_present
test_sort_by_priority_with_limit_keeps_absent_priority_first
test_sql_priority_rank_matches_enum_rank
test_resolve_order_field_leaves_non_priority_fields_alone
test_wildcard_priority_sort_does_not_apply_task_rank

Every deleted TS case has a Rust counterpart, plus two LIMIT-interaction cases the TS suite never had (_with_limit_ranks_in_sql, _with_limit_keeps_absent_priority_first) — which is exactly the ordering-vs-LIMIT question the issue asked to confirm while doing this work.

No real coverage was lost, and the coverage that remains is better. The deleted tests were testing an implementation that no longer exists; keeping them would have meant keeping the duplicate. What they were really protecting — that a saved query displays priority in urgency order — is now protected at the only place that computes it, and pinned to TaskPriority::rank() by test_sql_priority_rank_matches_enum_rank. The issue's stated fear was "a one-sided edit produces a silent disagreement between backend and display"; after this change there is no second side to edit. That's the criterion satisfied at the root rather than at the symptom.

The new adapter-core.test.ts (10 tests) covers the genuinely new code — the encoding seam — including the failure mode that motivates it (a sort field spelled wrong degrades silently rather than erroring). Correctly scoped: it tests the pure functions directly with no transport, matching the project's extracted-logic convention.


CLAUDE.md Compliance

All clean. Scanned the full diff for each:

  • No lint suppression — no eslint-disable, @ts-ignore, @ts-expect-error, ts-nocheck, #[allow(...)].
  • No any — ExecuteQueryInput, ExecuteQueryWire, METADATA_SORT_FIELDS are all concretely typed. Readonly<Record<string, string>> on the lookup is a nice touch.
  • No #[allow(dead_code)], no #[deprecated].
  • No backward-compat or migration code — this is the model case for the greenfield policy: old path deleted outright in the same commit, no dual-mode, no feature flag, no transition shim. The PR description's note about resetting a stale local database is the correct application of reset-don't-migrate.
  • Logging — log.debug via createLogger; no raw console.* added.
  • No new .md files in this repo.
  • Bun-only, TypeScript tooling — the dev-proxy.ts change is TS, consistent with scripts/ policy.

Two small notes on the Rust: ExecuteQueryArgs has #[derive(Debug, Deserialize)] with public fields and no Serialize, which is right for a command input. The doc comment explaining why filters stay JSON strings rather than being re-modeled in proto ("Re-modeling it here would be a third copy to keep in step") is the kind of rationale that prevents someone from "fixing" it later — good.


Nitpicks

  • Nit: adapter-core.ts — METADATA_SORT_FIELDS maps content: 'content' and title: 'title' to themselves. They're documentation-as-code (this is the complete set resolve_field recognizes) rather than conversions, which is defensible, but a reader may wonder if they're vestigial. One clause — "listed for completeness; these two need no rename" — would settle it.
  • Nit: query-node-viewer.svelte:461 — trailing comma in the executeQuery({...}) argument object where the sibling call at line 252 has none. Cosmetic; quality:fix evidently tolerates both.
  • Nit: dev-proxy.ts:576 — targetType: body.targetType is the one field not given a ?? fallback, unlike its three siblings and unlike every field in the adjacent /api/query handler. It's correct (target type is genuinely required, and the daemon will reject an absent one), but the inconsistency reads as an oversight. Either add ?? '' for symmetry or note that it's required on purpose.
  • Nit: query-node-model.ts — the module doc and the section comment now both explain that execution moved to the backend, in similar words. Fine as is; if either is ever edited, they should be kept in step or one folded into the other.

Summary

Strong change, and a genuinely good deletion — removing a parallel implementation of query semantics is worth more than most features. The architecture is right (separate ExecuteQueryInput rather than overloading NodeQuery), the three-transport wire shapes actually agree, the security posture is unchanged-to-slightly-widened but sound, and the priority-coverage criterion is satisfied more robustly than before rather than papered over.

One thing to fix before merge: finding 1, the 1000-vs-500 mismatch that makes fetchCapped unreachable and silently truncates large result sets. Findings 2–4 are worth a comment or a follow-up issue, not a block.

Reviewed against the Pragmatic Quality framework: architecture, correctness, security, maintainability, testing, performance, dependencies.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated pragmatic-code-review: APPROVE WITH COMMENTS (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.

One blocker to resolve before merge: the viewer requests FETCH_LIMIT = 1000 while the daemon clamps at MAX_EXECUTE_QUERY_LIMIT = 500, so fetchCapped is permanently false on the saved branch and large result sets truncate silently with no caveat shown. Everything else is improvement-or-nit.

malibio and others added 2 commits September 17, 2026 16:14
…count honest

Reviewer finding 1 (blocker): `fetchCapped` could never fire. The daemon clamps
every query to 500 rows (MAX_EXECUTE_QUERY_LIMIT / MAX_QUERY_NODES_SIMPLE_LIMIT)
while the viewer asked for FETCH_LIMIT = 1000 and then tested `length >= 1000`,
so a saved query with 900 matches showed 500 of them and said nothing. The
clamp is silent, so a truncated result is indistinguishable from a complete one
by inspection — the row count is the only signal, and the two numbers being
compared were never the same number.

The root cause was a client guessing a server policy constant, which is the
class of cross-language duplication this PR exists to remove. So rather than
edit 1000 to 500, `MAX_QUERY_ROWS` is now named once in adapter-core (the layer
that already owns wire-contract knowledge), FETCH_LIMIT derives from it, and a
test reads the Rust source to pin the two together — a drift there now fails
here instead of silently disabling the caveat.

The truncation rule moved to `isResultTruncated`, extracted so it is pinned by
tests rather than inline. It also corrects a case the old inline condition got
wrong in the other direction: a query that asks for MORE than the ceiling is
clamped too, so "named no limit" was too narrow a test for system-bounded.
A query that asked for 25 and got 25 is complete; one that asked for 1000 and
got 500 is not.

Finding 3: `handleQueryPreview` capped its count at the definition's limit, so
the button read "Preview (500 results)" whether 500 or 50,000 matched. It now
counts what the filters select — the question being asked while authoring —
and the editor renders a saturated count as "500+" rather than asserting a
total the backend never confirmed.

Finding 2 (note only): documented that a definition filtered solely on
parent/children never live-appends, since matchesFilter declines graph filters
and the gate ANDs them. Narrow in practice — the filter editor emits property
filters only.

Nits: noted why METADATA_SORT_FIELDS maps content/title to themselves and that
it must track resolve_field; noted why dev-proxy's targetType has no `??`
fallback; trimmed wording duplicated between the module header and section
comment.

Skipped, with reasoning:
- Unifying the three Rust 500-constants behind one shared const: pre-existing,
  and touching daemon-wide constants is outside this PR. The new pinning test
  covers the drift risk that motivated it. Filing a follow-up.
- A COUNT(*) variant of ExecuteQuery so preview needn't materialize rows: real
  waste, but new backend capability and scope creep here. Filing a follow-up.
- Bound parameters in QueryService instead of string interpolation: the
  reviewer confirmed the escaping is sound and found no injection. A worthwhile
  refactor, but a separate change to a file this PR does not touch. Filing a
  follow-up.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Reviewer finding 4, reconsidered. I had planned to file this as a follow-up,
but issue-workflow.md says to establish the size before deciding and to fix
anything small while the context is loaded. It is three function-local consts
in one file, all 500, already referring to each other in prose — so fixing it
is cheaper than writing the issue describing it.

MAX_GET_ROOTS_LIMIT / MAX_QUERY_NODES_SIMPLE_LIMIT / MAX_EXECUTE_QUERY_LIMIT
become one module-level `MAX_ROW_LIMIT`. This is the constant the frontend's
MAX_QUERY_ROWS must agree with, and three separately-editable copies meant
"agrees with the daemon" was never a checkable claim — the previous commit's
pinning test had to match two of them by regex and would have missed a third
handler drifting. It now reads one `pub const`, and a rename or move fails the
test loudly rather than silently matching nothing.

No behavior change: every call site clamped to 500 before and clamps to 500 now.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@malibio

malibio commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

Review response

Addressed 4 of 4 findings plus all nits. Two commits: bf3fb9ec (findings 1–3 + nits) and 2e916a2c (finding 4).

Finding 1 (blocker) — fetchCapped unreachable ✅

Confirmed exactly as described: the daemon clamps at 500, the viewer asked for 1000 and tested length >= 1000, so the caveat could never fire and a 900-match query showed 500 rows silently.

Rather than edit 1000 → 500, I treated the root cause — a client guessing a server policy constant is the same class of cross-language duplication this PR exists to remove:

  • MAX_QUERY_ROWS is named once in adapter-core.ts (the layer already owning wire-contract knowledge); FETCH_LIMIT derives from it.
  • A test reads the Rust source and pins the two together, so drift fails loudly instead of silently disabling the caveat. Verified it fails when the daemon constant is changed.
  • The rule moved to isResultTruncated in query-node-model.ts, pinned by 6 tests.

This also corrected a second error in my original line, in the opposite direction. definition.limit === undefined was too narrow: a query asking for more than the ceiling is clamped too. So limit: 1000 → 500 rows is truncated but my condition called it complete. Now: asked-for-N-and-got-N is complete (however small N is); named-no-limit or asked-above-ceiling is system-bounded.

The default-view branch uses the same helper, fixing the latent instance that pre-dated this PR.

Finding 2 — parent/children-only definitions never live-append ✅ (documented)

Agreed on both counts: the flip to false is right for the new call site, and the .every(...) consequence is real. Documented on shouldShowCreatedNode rather than fixed, for the reason you gave — the alternative is the round-trip-per-node cost the module exists to avoid, and the filter editor emits property filters only, so such definitions arrive from AI/programmatic creation.

Finding 3 — saturating preview count ✅

Took your preferred semantics: the preview counts what the filters select, since that is the question being asked while authoring (limit is a display choice applied afterwards). The editor now renders a full page as 500+ rather than asserting a total the backend never confirmed.

The COUNT(*) point is right and filed as #2743 — it materializes up to 500 full node payloads to display one integer.

Finding 4 — triplicated 500 constants ✅ (fixed, not filed)

I had planned to file this. Reconsidered after re-reading issue-workflow.md, which says to establish the size before deciding and fix anything small while context is loaded — three function-local consts in one file was cheaper to fix than to describe.

MAX_GET_ROOTS_LIMIT / MAX_QUERY_NODES_SIMPLE_LIMIT / MAX_EXECUTE_QUERY_LIMIT → one pub const MAX_ROW_LIMIT. This also strengthens the finding-1 test: it now matches one pub const instead of two constants by regex, so a third handler drifting can't slip past. No behavior change.

Nits ✅

METADATA_SORT_FIELDS self-mapping explained (plus a note that it must track resolve_field and why that coupling is tolerable here); dev-proxy targetType no-fallback explained; trailing comma resolved by the rewrite; duplicated module/section wording trimmed.

Deferred, with reasoning

Verification

  • Frontend 5200 passed (256 files) — up from 5181, 19 new tests
  • Rust 1517 passed
  • quality:fix clean — svelte-check 0 errors, clippy -D warnings
  • Drift-detection test verified failing when the daemon constant is changed, then restored

🤖 Generated with Claude Code

@malibio

malibio commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

Automated Pragmatic Code Review — PR #2742 (RE-REVIEW)

Review Type: Re-review of 326c41ba..HEAD (bf3fb9ec, 2e916a2c) against the review of 326c41ba.

Verdict: APPROVE — the blocker is genuinely fixed, and fixed at the root rather than at the symptom. One stale doc comment is worth a one-line edit; everything else is nit-or-better.


Previous Review Summary

Count
Findings addressed 4 of 4 (1 blocker, 3 improvements) + all 4 nits
Not addressed 0
New issues found 1 🟡 (stale constant names in a doc comment) + 2 🟢

Two follow-ups filed (#2743 COUNT(*) preview RPC, #2744 bound parameters in QueryService) — both correctly scoped out, both matching what I suggested filing.


Finding-by-finding verification

1. [Blocker] fetchCapped unreachable — ✅ fixed, and fixed better than asked

I suggested either lowering FETCH_LIMIT to 500 or having the backend report truncation. You did neither and picked the better third option: name the number once, derive the client's ask from it, and pin the two languages together with a test. That converts a coincidence into an invariant, which is the actual defect class.

Verified end to end:

  • 📁 packages/desktop-app/src/lib/services/adapter-core.ts:283 — MAX_QUERY_ROWS = 500, single source on the TS side.
  • 📁 packages/desktop-app/src/lib/components/viewers/query-node-viewer.svelte:62 — FETCH_LIMIT = MAX_QUERY_ROWS. Client ask now equals server ceiling, so >= maxRows is reachable.
  • 📁 packages/daemon/src/services/node_service.rs:85 — pub const MAX_ROW_LIMIT: usize = 500.
  • Both branches (saved query at :260, default view at :290) route through isResultTruncated, so the latent instance that pre-dated this PR is fixed too.

Ran the two touched suites directly: 45 passed (adapter-core.test.ts 12, query-node-model.test.ts 33).

2. [Improvement] parent/children-only definitions never live-append — ✅ documented, correctly

📁 query-node-model.ts:296-301. The corollary is stated on shouldShowCreatedNode where a reader hits it, names the consequence ("refreshes on its next load rather than incrementally") and the reachability argument that makes it acceptable. This is exactly the one-line note I asked for, and the decision not to fix it is the right YAGNI call.

3. [Improvement] saturating preview count — ✅ fixed

Took the semantics I argued for. See (d) below for the detailed check — the rendering is correct.

4. [Improvement] triplicated 500 — ✅ fixed rather than filed

See (c) below. Your reasoning for fixing instead of filing (cheaper to do than to describe) is right, and it does strengthen the finding-1 test as you say: one pub const is a tighter regex target than two function-local ones.


Deep-dive on the areas flagged for scrutiny

(a) isResultTruncated logic — 🟢 correct, exhaustively

📁 packages/desktop-app/src/lib/components/query/query-node-model.ts:262-268

const systemBounded = requestedLimit === undefined || requestedLimit > maxRows;
return systemBounded && rowCount >= maxRows;

Worth saying plainly: you were right that your original condition was also wrong in the opposite direction, and this correction was never reviewed. I walked it exhaustively.

Case systemBounded rowCount >= max Result Correct?
limit absent, rowCount = 500 T T true ✅ ceiling bound it
limit absent, rowCount = 42 T F false ✅
limit = 25, rowCount = 25 F F false ✅ query's own bound
limit = 1000, rowCount = 500 T T true ✅ the case the old condition got wrong
limit = 1000, rowCount = 87 T F false ✅ clamp never bound it
limit = 500 (== max), rowCount = 500 F T false ✅ — see below
limit = 499, rowCount = 499 F F false ✅ full-for-its-limit, complete
rowCount > maxRows — T follows systemBounded ✅ unreachable; see below
limit = 0 F (0 > 500 false) — false ✅ — see below
limit = -5 F — false ✅ — see below

The three subtle ones, each of which I checked rather than assumed:

  • limit === maxRows exactly → false is the right answer, and the strict > earns it. Asking for exactly 500 and getting 500 is a query that got precisely what it requested; the clamp min(500, 500) was a no-op. Reporting "there may be more" there would be a false positive on a query that chose its own bound. Using >= would have been the easy mistake. Test at :275-277 pins this.
  • rowCount > maxRows is unreachable — both server paths clamp with .min(MAX_ROW_LIMIT) (node_service.rs:902, :994), so the daemon cannot return more. >= rather than === is nonetheless the right defensive spelling: if the daemon ever raised its ceiling without the test catching it, >= still flags rather than silently going quiet. Correct choice of comparator.
  • limit: 0 / negative / non-integer. 0 is not "no limit" on the TS side — QueryDefinition.limit is number | undefined (📁 src/lib/types/query.ts:52) and undefined is the sentinel; the 0 = unset convention lives only on the proto wire. A limit: 0 would be sent as 0, read by the daemon as unset, and return up to 500 rows, which isResultTruncated would then report as complete. That is a genuine (if theoretical) blind spot — but it is unreachable in practice: the editor has no limit input at all (📁 query-editor.svelte:111 passes query?.limit straight through), so limit only ever arrives from AI or programmatic definitions, and 0/negative/fractional are malformed inputs the daemon would treat as unset anyway. Not worth a guard; noting it so the next reader doesn't have to re-derive it.

Is the 6-test suite complete? Yes, for the logic as written. It covers both axes independently and both of the error directions the old code had (never-fires, and wrongly-complete). The only case it omits is limit === maxRows - 1 with a full page, which is the same equivalence class as limit = 25 / rowCount = 25. Adding it would be redundant. 📁 query-node-model.test.ts:245-280.

(b) The cross-language pinning test — 🟢 sound, not too clever

📁 packages/desktop-app/src/tests/services/adapter-core.test.ts:21-43

I went in skeptical of a TS test reading Rust source. It holds up, for a specific reason: there is no other mechanism available. The value crosses a language boundary at runtime only as an implicit policy (the clamp is silent — the daemon never sends the ceiling on the wire), so there is nothing a normal integration test could assert against. The alternatives are a comment (which is what just failed, producing the blocker) or codegen (disproportionate for one integer). Reading the source is the cheapest thing that actually fails.

Checking the mechanics honestly, one at a time:

  • Path survives CI / working-directory differences: ✅. resolve(__dirname, '../../../../daemon/src/services/node_service.rs') is anchored to the test file's location, not process.cwd(). The four levels up from src/tests/services/ land on packages/, then into daemon/… — verified the file is there. Since it is __dirname-relative, it is immune to whether vitest is launched from the repo root (bun run test → bun run --cwd packages/desktop-app test) or from the package dir. I confirmed __dirname is defined under this config by running the suite — it passes, which it could not do if __dirname were undefined. Only a physical move of either file breaks it, and that breaks it loudly.
  • Fails on rename or move: ✅. match is null, expect(match).not.toBeNull() fires with the message 'MAX_ROW_LIMIT not found in node_service.rs'. Moving it to another file breaks readFileSync → throws ENOENT → test fails. Making it non-pub breaks the regex (which requires pub const) → fails.
  • Is expect(match).not.toBeNull() enough of a guard? ✅ yes, and it is load-bearing. Without it, match?.[1] would be undefined, Number(undefined) is NaN, and expect(NaN).toBe(500) still fails — so the test would not silently pass either way. But it would fail with an inscrutable NaN !== 500 instead of naming the cause. The explicit assertion plus its custom message converts a confusing failure into a self-explaining one. That is the right call, and the comment above it says exactly why.
  • Whitespace tolerance: ✅. \s* around : and = means a rustfmt reflow cannot break it.

One residual weakness worth naming, no change requested: the regex would match the constant inside a comment or a string literal, and it takes the first match in the file. Neither is a realistic failure mode in a .rs file where the only occurrence is the definition (I grepped: one definition, and the doc comment above it deliberately spells the name without the pub const MAX_ROW_LIMIT: usize = prefix, so it does not collide). Fine as is.

Verdict: sound. It is the right amount of clever for a constraint that has no other enforcement point, and the failure modes all fail loudly.

(c) The Rust constant refactor — 🟢 verified, zero behavior change

📁 packages/daemon/src/services/node_service.rs

  • All three former call sites now use MAX_ROW_LIMIT: :712 (GetRoots), :902 (QueryNodesSimple), :994 (ExecuteQuery). Grepped the whole repo for the old names: no code references remain — only two prose mentions, one of which is a defect (see 🟡 below).
  • No behavior change: ✅. All three were 500; the new constant is 500; all three clamps are still .min(...) in the same position. Confirmed by reading each hunk rather than trusting the commit message.
  • DEFAULT_GET_ROOTS_LIMIT = 100 left intact: ✅ — 📁 :708, still function-local, still 100, still only in the req.limit == 0 branch. Correctly not folded in: a default (what you get when you ask for nothing) and a ceiling (the most you can get when you ask for a lot) are different concepts that happen to both be limits, and merging them would have been a real regression. Keeping it function-local is right too — it is GetRoots policy, unlike the ceiling which is service-wide.
  • pub is the right visibility: ✅. The doc comment names the TS mirror and the test that pins it. pub also means a future in-crate or CLI caller can reason about the ceiling instead of re-deriving it. pub(crate) would have been marginally tighter but would signal "internal detail" about a value that is deliberately part of the observable contract.
  • Module-level placement is right: ✅. It is now a property of the service, not of one handler, and the doc comment at :74-84 says so — including the non-obvious consequence ("callers must bound large reads with repeated limit/offset pages"). That comment is a genuine improvement over the three it replaced, which each described the clamp by pointing at one of the others.

🟢 Observation: two handlers in the same file do not clamp — 📁 :786 (Search) and 📁 :1019 (MentionAutocomplete) pass req.limit through unbounded. Both pre-date this PR and neither is on this PR's path, so this is not a finding against the change. But now that the doc comment on MAX_ROW_LIMIT says "the most rows any one row-returning RPC will return", that sentence is slightly broader than the code. Either narrow the wording to the three clamping handlers, or (better, separately) bring those two under the same ceiling.

(d) handleQueryPreview semantic change — 🟢 correct, including the template whitespace

📁 packages/desktop-app/src/lib/components/viewers/query-node-viewer.svelte:467-480

Always requesting MAX_QUERY_ROWS and ignoring definition.limit is right, and the comment gives the correct justification: while authoring, "how many things match these filters" is the question, and limit is a display choice applied afterwards. Ignoring it also makes the preview stable while the author edits filters, which the previous behavior was not.

📁 packages/desktop-app/src/lib/components/query/query-editor.svelte:234-235:

Preview ({previewCount}{previewCount >= MAX_QUERY_ROWS ? '+' : ''}
{previewCount === 1 ? 'result' : 'results'})

Checked each sub-question:

  • >= MAX_QUERY_ROWS is the right condition here — and note it is correctly >=, not the > used in isResultTruncated. Different questions: there, "did the system bound this?" (a self-chosen 500 did not); here, "could the count be higher than shown?" (at 500 rows returned, yes, always, because the preview always asks for exactly the ceiling). Getting these two comparators different in the same PR, each right for its own question, is the detail I most expected to find wrong. It is correct.
  • "1 result" still works: ✅. 1 >= 500 is false → no +; 1 === 1 → 'result'. Renders Preview (1 result).
  • Spacing across the template line break: ✅. The newline-plus-indentation between the '+' expression and the pluralization expression is collapsed by Svelte's whitespace handling to a single space, producing Preview (500+ results) — not 500+results and not a double space. It reads correctly; the line break is a formatter artifact, not a rendering bug.
  • No + on a short count: ✅ — Preview (42 results) is unchanged from before.

(e) The default-view branch — 🟢 consistent

📁 query-node-viewer.svelte:285-294. Passing limit: FETCH_LIMIT to queryNodes while telling isResultTruncated that requestedLimit is undefined looks contradictory at a glance, but it is exactly right, and the comment at :291-292 says why: the view names no limit of its own. FETCH_LIMIT is not the view's intent, it is this code asking for as much as the daemon will give — which is the definition of system-bounded. Passing FETCH_LIMIT there instead would land on the limit === maxRows case and report a truncated 500-row default view as complete, which is the blocker resurfacing in a new spot. The hardcoded undefined is correct, and FETCH_LIMIT === MAX_QUERY_ROWS keeps the ask honest.

(f) Regressions in previously-clean areas — 🟢 none

  • Wire encoding: untouched by both commits except the MAX_QUERY_ROWS export added above ExecuteQueryWire. buildExecuteQueryWire, encodeSortField and METADATA_SORT_FIELDS values are byte-identical; only doc comments changed. The 11 pre-existing encoding tests still pass.
  • Three-transport agreement: the only dev-proxy.ts change is a comment. No field shapes moved.
  • Security posture: unchanged. No new interpolation, no new input path, no new surface. The preview now always sends limit: 500 instead of a caller-supplied number, which if anything narrows the input surface slightly.
  • Priority-ordering coverage: untouched.

New Findings

🟡 Improvement

📁 packages/desktop-app/src/lib/services/adapter-core.ts:272-274 — the doc comment names two constants that no longer exist

 * asks for — `MAX_EXECUTE_QUERY_LIMIT` / `MAX_QUERY_NODES_SIMPLE_LIMIT` in
 * `packages/daemon/src/services/node_service.rs`, which clamp rather than reject.

Commit 2e916a2c deleted both names in favour of MAX_ROW_LIMIT, but this comment — written in bf3fb9ec, one commit earlier — was not updated. It is the only human-readable pointer from MAX_QUERY_ROWS back to its Rust counterpart, so a reader who greps either name finds nothing and is left to hunt.

This is small, but it is the same failure mode as the original blocker one level up: a comment asserting a cross-language coupling that has silently gone stale. The test catches the value drifting; nothing catches the prose drifting. Worth the one-line fix:

 * asks for — `MAX_ROW_LIMIT` in
 * `packages/daemon/src/services/node_service.rs`, which clamps rather than
 * rejects. Pinned to it by a test in `adapter-core.test.ts`.

(The Rust side's comment at node_service.rs:82-84 already names its TS counterpart and the pinning test correctly — this is just the return direction.)

Also stale, lower stakes: 📁 packages/cli/tests/cli_integration.rs:2323 still says "Requesting far more than MAX_QUERY_NODES_SIMPLE_LIMIT" in a test comment. Same one-word fix.

🟢 Nits

  • Nit: 📁 node_service.rs:74 — "the most rows any one row-returning RPC will return" overstates slightly, since Search (:786) and MentionAutocomplete (:1019) don't clamp. See (c).
  • Nit: 📁 adapter-core.test.ts:33 — resolve(__dirname, '../../../../daemon/…') is correct but four .. segments is hard to verify by eye. A brief // packages/desktop-app/src/tests/services → packages/daemon/... would let the next reader check it without counting. Purely optional; the test failing loudly on a wrong path already covers the risk.

Requirements Check — Issue #2727

All five acceptance criteria were verified met in the first review and nothing in these two commits regresses any of them. Re-confirmed:

Criterion Status
NodeQuery carries sorting (and filters) ✅ via ExecuteQueryInput — untouched by these commits
Saved-query execution routes through QueryService ✅ query-node-viewer.svelte:253
applySorting / applyFilters / executeQueryDefinition / priorityRank / CORE_PRIORITY_RANKS deleted ✅ re-grepped, still gone
Priority ordering verified end-to-end ✅ Rust suite untouched
Query-view tests updated ✅ plus 6 new isResultTruncated tests and 1 cross-language pin

The "worth confirming" note in the issue body — whether client-side limit slicing and the backend's LIMIT agree — is now answered more completely than at first review: isResultTruncated is precisely the statement of where they agree and where the system's ceiling overrides the query's intent.

CLAUDE.md Compliance — new commits

Scanned the diff of 326c41ba..HEAD specifically:

  • No lint suppression — no eslint-disable, @ts-ignore, @ts-expect-error, #[allow(...)], #[deprecated]. ✅
  • No any — isResultTruncated takes a named structural param, all fields concretely typed. ✅
  • No migration / back-compat code — the old constants were deleted, not deprecated or aliased; FETCH_LIMIT was redefined in place rather than kept alongside a new name. Textbook greenfield policy. ✅
  • No new .md files in this repo. ✅
  • No raw console.* added. ✅
  • Tooling — no scripts touched. ✅

Recommendation

APPROVE. Merge after the one-line comment fix at 📁 adapter-core.ts:272-274 (and optionally 📁 cli_integration.rs:2323) — neither needs a re-review.

The blocker is resolved at the root: a client guessing a server constant became one constant with a test that fails loudly on drift, which is the same move this PR made for the priority rank table. The isResultTruncated correction — self-derived, never reviewed until now — is correct on every boundary I could construct, including the two I most expected to be wrong (limit === maxRows exactly, and the deliberate > there versus >= in the editor's 500+ condition). The Rust refactor changes no behavior and correctly leaves DEFAULT_GET_ROOTS_LIMIT alone. Findings 2 and 3 landed as agreed, the two deferrals are correctly scoped, and nothing regressed in the wire encoding, transport agreement, or security posture.

Reviewed against the Pragmatic Quality framework: architecture, correctness, security, maintainability, testing, performance, dependencies.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Automated pragmatic-code-review (re-review): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.

All three findings were prose, not logic — no behavior change.

The 🟡 is the same failure mode as the original blocker, one level up: the
doc on MAX_QUERY_ROWS still named MAX_EXECUTE_QUERY_LIMIT and
MAX_QUERY_NODES_SIMPLE_LIMIT, which the very next commit deleted. The pinning
test catches a value drifting but cannot catch a name drifting, and that
comment is the only human-readable pointer from the TypeScript constant back to
the Rust one. It now names MAX_ROW_LIMIT and says the test exists, so a reader
who doubts the number knows where the guarantee lives. Same stale name fixed in
cli_integration.rs; a repo-wide grep confirms those were the only two.

Also corrected MAX_ROW_LIMIT's own doc, which claimed "any row-returning RPC".
Verified against the source: Search and MentionAutocomplete pass req.limit
through with no .min(), so the constant bounds the paged query surface
(GetRoots / QueryNodesSimple / ExecuteQuery) rather than the daemon as a whole.
Left as an overstatement it would have licensed the next person to assume a
ceiling that isn't there.

Added a path-trace comment to the cross-language test's four `..` segments,
noting the resolve is __dirname-relative and therefore invocation-independent.
Verified by running it from packages/desktop-app as well as the repo root.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@malibio

malibio commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

Re-review response

All 3 findings addressed in 4f4774b2. All three were prose — no behavior change.

🟡 Stale constant names in doc comments ✅

Right, and worth naming what this was: the same failure mode as the original blocker, one level up. The pinning test catches the value drifting but cannot catch the name drifting, and that comment is the only human-readable pointer from MAX_QUERY_ROWS back to the Rust constant. It now names MAX_ROW_LIMIT and states that the test exists, so a reader who doubts the number knows where the guarantee lives rather than trusting prose.

Fixed in both locations you found. A repo-wide grep confirms those were the only two:

$ grep -rn "MAX_EXECUTE_QUERY_LIMIT\|MAX_QUERY_NODES_SIMPLE_LIMIT\|MAX_GET_ROOTS_LIMIT" packages/ scripts/
(no matches)

🟢 MAX_ROW_LIMIT doc overstated its scope ✅

Verified your claim against the source rather than taking it on trust — search (node_service.rs:790) and mention_autocomplete (:1023) both pass req.limit through with no .min(). The doc now says the constant bounds the paged query surface (GetRoots / QueryNodesSimple / ExecuteQuery) and explicitly notes those two don't clamp.

Worth fixing rather than waving through: left as "any row-returning RPC," it would have licensed the next person to assume a ceiling that isn't there.

🟢 Path-trace comment on the four .. segments ✅

Added, noting the resolve is __dirname-relative and so invocation-independent. Verified by running the suite from packages/desktop-app as well as the repo root — 12 passed from both.

Verification

  • Frontend 5200 passed (256 files)
  • quality:fix clean — svelte-check 0 errors, clippy -D warnings
  • Full pre-push gate passed

Note on the two 🟢s

Both were optional and I took them anyway — each was a one-line edit where the context was already loaded, and both concerned comments that would mislead a future reader about a guarantee. That is the specific thing this PR exists to reduce.

🤖 Generated with Claude Code

@malibio
malibio merged commit 350bafc into main Sep 17, 2026
@malibio
malibio deleted the issue-2727-backend-query-sorting branch September 17, 2026 16:27
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.

Saved queries sort client-side, duplicating backend ordering rules in TypeScript

1 participant