GeezerVison is showing github.com — atlas: trace capture — atlas-query-trace/v1 records, fail-closed trace write (#6027 follow-on 1) · Issue #9973 · developing-today/code
atlas: trace capture — atlas-query-trace/v1 records, fail-closed trace write (#6027 follow-on 1) #9973DescriptionFollow-on 1 of 5 from the #6027 design (doc/2026-11-10T20-41-01Z_design_atlas_retrieval_stats_feedback.md, merged via PR #8251). Parent program: #6018.
Scope (design §§2–3)
- Mint
query_id (UUIDv7) per executed search in the atlas search service; return it in every response envelope and print it in the CLI. Retries are separate executions linked by retry_of.
- Persist the per-query trace as
atlas-query-trace/v1 JSONL records: per-result stage scores (shard rank/score, merge rank + fusion score incl. the persisted FusedEntry rank_sources_json, rescore, final rank/served), resolved file/embed identity (source_file_id, embed_id, embed_content_hash, version, tier, provenance mark), parameters used, and pool counts. Results that entered a pool but did not survive still appear with served: false.
- Fail closed (design invariant 2): a trace write failure is a search failure, never a silently untraced success.
Acceptance
- A live search produces a trace record that parses against the §3 schema and lets an operator recover every served result's per-stage scores.
- Killing the trace sink makes search fail visibly (test).
- No change to ranking behaviour; trace overhead measured and reported on the PR.
Design: doc/2026-11-10T20-41-01Z_design_atlas_retrieval_stats_feedback.md §§2–3. Filed by queue-worker triage of #6027 (task 15280). Activitydeveloping-today commented on Nov 14, 2026 dezren39 commented on Nov 14, 2026 Implemented and merged — PR #10145 (merge 6a8fa5f), task 16846, lane any-d.
What landed, per design sections 2-3:
- atlas-core
trace module: atlas-query-trace/v1 record builder, TraceSink seam, production JsonlTraceSink (daily JSONL under ~/.local/state/atlas-search/traces/), UUIDv7 query_id minting, sha256 query-text hash.
run_search_traced / run_search_with_executor_traced share the exact run_search implementation; traced searches resolve details for EVERY pool entrant, persist the record before the response is released, and return query_id in the envelope. Fail-closed: a sink failure fails the search (pinned by test). The untraced envelope is byte-identical to before (also pinned by test).
- CLI runs traced (surface
cli, query text retained on the operator's own machine) and prints query_id in JSON and --text output; the service runs traced (surface service-api, hash-only) and surfaces sink failure as a search error.
- Records carry per-entrant stage scores (shard best-rank branch + rank + vector distance; merge fusion rank/score + persisted
rank_sources; rescore none — no rescore stage exists yet; final rank + served, non-surviving entrants at served: false), parameters, pool counts, duration, retry_of via the trace context.
Acceptance evidence:
- Live records verified from real CLI executions:
atlas-traces-2026-11-14.jsonl entries parse as v1 with per-stage scores recoverable per served result.
- Tests: atlas-core 61/61 (6 new trace tests incl. fail-closed), atlas-search 39 lib + 11 cli_parity green; the parity harness strips only the nondeterministic
query_id (asserting UUIDv7 shape) — every other byte still diffs against the Python-recorded envelopes; the raw-mode parity test now also asserts distinct executions mint distinct query_ids.
- Reviewers: Codex hit its usage limit and CodeRabbit stayed rate-limited through two windows — no findings were produced by either; merged on verified tests per fleet criteria, with this note as the record.
- Overhead: one extra detail lookup over the fused pool (bounded by the existing
pool parameter) + one file append; fixture traced searches record duration_ms 0-3 ms. Production Turso measurement is an operator follow-up — duration_ms is in every record for exactly that.
Documented gaps (in the PR and the module doc): resolved embed identity fields are null until the versioning design's detail columns land; per-shard pool attribution keys the single logical shard the backends present to fusion; section-4 ingestion registration of trace files is a later follow-on.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|