Skip to content

fix(api): include truncation metadata in named-query responses - #832

Merged
scbrown merged 2 commits into
mainfrom
arnold/x45-ask-truncated-20261025
Oct 25, 2026
Merged

scbrown merged 2 commits into
mainfrom
arnold/x45-ask-truncated-20261025

Conversation

@scbrown

@scbrown scbrown commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Strict /ask consumers reject otherwise valid results because the response omits truncated. Return boolean false for complete named-query results and catalog responses, preserving existing query evaluation, result rows, and parameter handling. Named queries still return their complete evaluated result; a template's LIMIT is its selection, and /query's separate response ceiling is unchanged.

Controls cover catalog discovery, built-in populated and empty reads, stored queries returning more rows than max_sparql_rows, and logical LIMIT 1/LIMIT 0. The small catalog-branch consolidation keeps the existing source-size ratchet; the REST documentation and its source witness are updated.

Demo — readable transcript fallback (asciinema unavailable): actual library fixture with two names, base handler d6c403c2d16f31aacf4e9aa37e2b1ca1d6874fee versus candidate e08cc52ee68f13c9b46c163b61785b53c1dce0b4, using the same regression harness. The base response below fails the boolean assertion; the candidate passes, including one-row and empty selections. This demonstrates source behavior, not an installed server.

Base response:

{"columns":["name"],"count":2,"query":"complete_names","rows":[{"name":"Alice"},{"name":"Bob"}],"sparql":"SELECT ?name WHERE { ?s <http://example.org/name> ?name } ORDER BY ?name"}

Candidate response:

{"columns":["name"],"count":2,"query":"complete_names","rows":[{"name":"Alice"},{"name":"Bob"}],"sparql":"SELECT ?name WHERE { ?s <http://example.org/name> ?name } ORDER BY ?name","truncated":false}

Repeat on the candidate:

just test --lib mcp::tests::ask_truncation_marker_describes_complete_query_result_not_dataset_coverage -- --exact --nocapture

Validation: just check and documentation lint/build pass; MCP suite 283 passed, one existing ignored; repository-knowledge checks pass with two native-only checks skipped. The paired base control fails as expected, and both paired runs leave the HOME/resource guard clean. Hosted CI and independent review remain required.

@scbrown
scbrown merged commit 5fd4710 into main Oct 25, 2026
24 checks passed
@scbrown
scbrown deleted the arnold/x45-ask-truncated-20261025 branch October 25, 2026 04:47
@scbrown scbrown mentioned this pull request Oct 25, 2026
scbrown added a commit that referenced this pull request Oct 25, 2026
…to the S3b stream branch

Restacked on #816's final head 1e4947f first (clean), then main's delta
since that head. One real conflict, src/asof_share.rs: this branch
extracted the per-graph checks into resolve_graphs (shared with the
replication stream), and #831 changed the same loop to read frozen graphs
from their packs and refuse the graph-metadata graph. Resolution:

- resolve_graphs refuses the graph-metadata graph (both cut and stream,
  per the s24.1.1 ruling) and attached packs, and no longer refuses
  frozen graphs itself;
- the cut reads frozen graphs from their packs exactly as #831 does
  (pack re-verified inside the transaction, frozen_member);
- the stream keeps this branch's reviewed behaviour and refuses frozen
  graphs explicitly (refuse_frozen), now tested together with the
  metadata refusal.

The derived rest-api.md witness hash is recomputed from the merged file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BkdpDkAkbTvXvNbNacVpJb
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.

1 participant