Repository navigation
fix(query): a failed query keeps its shape in the request log (aegis-raq1ok.1) - #834
Conversation
…raq1ok.1) query_core classified the shape of each query up front but attached it only on success, so every failure, a deadline 408 included, was logged with no query_shape and no result_size. In production 104 of 104 captured 408s on /query were unattributable while 0 of 27,064 successes were. AppError now carries an optional RequestUsage that into_response attaches; query_core sets it on every failure with the classified shape and result_size None. A failure returned no result, so its size is logged as null: unknown, never 0, which would claim an empty result. RequestUsage.result_size is therefore Option<usize>. The handler still returns Err for a failure, and the client-visible response (status and body) is unchanged. A/B on real servers, same data, config and overload probe: before (installed d6c403c) 0 of 84 408s carried a shape; after 90 of 90 (select, result_size null); 200s carried it in both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BzgSY2LpdGhBhb7D1nHbiF
|
Non-author Ian: full six-path source review COMPLETE at Checked shared query error annotation, preservation of Validation: server query selection 34 passed / 0 failed / 1 intentionally ignored, including an independent control for early unsupported-contract refusal, SELECT parse error, successful empty SELECT ( Native approval NOT ACCEPTED: current helper |
|
Ian binding-only END: native CONTENT |
…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
Why
The request log could not say what a timed-out query was.
query_coreclassifies each query's shape up front, but only the success paths attached it. Every failure, deadline 408s included, was therefore logged with noquery_shapeand noresult_size.In a 45-minute production capture, 104 of 104
/query408s had no shape, against 0 of 27,064 successes. That made the overload 408s unattributable (aegis-raq1ok.1).What
AppErrorcarries an optionalRequestUsage, whichinto_responseattaches.query_coresets it on every failure, using the shape it already classified.result_sizeis logged as null: unknown, never0, which would claim an empty result.RequestUsage.result_sizebecomesOption<usize>.Errfor a failure, so every caller and test that pinsErris unchanged. The response a client sees (status and body) is unchanged too.Evidence
A/B on real servers:
[quipu.search] request_timeout_ms = 100,[quipu.server] read_pool_size = 2), and the same 90-request overload probe.query_shapequery_shapeselect,result_size: null)The client-visible 408 bodies are identical between the arms (digits normalised).
Tests:
a_query_deadline_408_keeps_its_query_shape/querypast its deadline: stillErr, 408, withRequestUsage { Select / Ask, None }sparql_protocol_post_uses_the_existing_query_deadline(extended)a_failed_query_logs_its_shape_and_a_null_sizequery_shapeand"result_size": nullSabotage: dropping the error-path annotation turns both deadline tests red. The file was restored from a saved copy with its sha256 checked.
Gates on this head:
-D warnings -A missing-docsforfullandshacl,owl;Not in this PR
Failed and >1 s queries already log their text as plain stderr (
query <ms>ms: <first 300 chars>), outside the JSON request log. Reading the retained production log for that is a separate, scoped decision.🤖 Generated with Claude Code
https://claude.ai/code/session_01BzgSY2LpdGhBhb7D1nHbiF