Skip to content

feat(hotpath): fill query artifact/semantic/exact gaps - #786

Draft
ScriptedAlchemy wants to merge 1 commit into
codex/tracedecay-total-redesign-plan-reopenedfrom
cursor/hp-query-hotpath-gaps-f2d5
Draft

feat(hotpath): fill query artifact/semantic/exact gaps#786
ScriptedAlchemy wants to merge 1 commit into
codex/tracedecay-total-redesign-plan-reopenedfrom
cursor/hp-query-hotpath-gaps-f2d5

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Fills the remaining hotpath coverage gaps in crates/tracedecay-query (HP-query) only. Adds missing measures; no restriping of already-instrumented files, no Cargo.toml feature changes, no changes to src/bin/tracedecay_index_bench.rs (CI has no span-name assertions, so new spans flow through the existing hotpath-profile.yml workload automatically).

All labels follow query.<area>.<verb>. Hot per-row/per-shard paths use the crate's existing hotpath_metrics::measure_frequent 1-in-16 sampling helper (with _inner wrappers mirroring the existing score_record/score_row pattern); everything else uses #[hotpath::measure] attributes or measure_block!. Every macro remains a no-op without the opt-in hotpath feature.

Previously bare files

  • retrieval/lexical/projection/artifact/prepared.rs: query.artifact.prepare_page, query.artifact.prepare_receipt, sampled query.artifact.prepare_document
  • retrieval/lexical/projection/artifact/format.rs: query.artifact.index_verify, query.artifact.ngram.page_digest, query.artifact.finalization.receipt_absorb, query.artifact.open.receipt_decode, sampled query.artifact.ngram.encode_shard / decode_shard
  • retrieval/lexical/projection/artifact/postings.rs: query.artifact.ngram.project_query, sampled query.artifact.ngram.project_document
  • retrieval/lexical/projection/postings.rs: query.artifact.ngram.candidate_documents, query.lane.fuzzy.build_index, query.lane.fuzzy.terms_at_distance, sampled query.artifact.ngram.insert_document
  • retrieval/ports.rs: query.lane.checkpoint_digest (covers every lane's checkpoint), sampled query.lane.bind_evidence
  • code_search.rs: query.code_search.map_fallback_coverage span plus query.code_search.degraded_total / unavailable_total gauges on the progressive-degradation gate

Mixed-file leftovers (missing measures only)

  • exact.rs: query.lane.exact.parse_literals, query.lane.exact.enforce_batch, sampled query.lane.exact.readmit_row around the per-candidate central-authority re-admission
  • semantic.rs: query.lane.semantic.ann_rescore, exact_flat, assemble, and an embed_query measure block around the port call
  • fusion.rs: query.fusion.compact_lane, admit_lanes, attach_decisions, query.stream.digest_set, build_cursor, verify_cursor
  • artifact/builder.rs: query.artifact.create.schema, query.artifact.finalization.source_chain_verify
  • artifact/reader.rs: query.lane.lexical.select_documents, load_stats, query.lane.exact.select_documents, query.lane.fuzzy.load_vocabulary

Verification

  • cargo check -p tracedecay-query (feature off) — clean
  • cargo check -p tracedecay-query --features hotpath — clean
  • cargo clippy -p tracedecay-query --all-targets with and without --features hotpath — no warnings in this crate (only the pre-existing tracedecay-graph-db too-many-arguments warning)
  • cargo test -p tracedecay-query — 311 passed, 0 failed
  • Built the bench with the CI feature set (--no-default-features --features production,hotpath) and ran it with HOTPATH_OUTPUT_PATH: the new query.artifact.prepare_page span lands in the top-15 timing table (193 calls); remaining spans are recorded but below the table's entry cap
  • Commit subject passes commitlint (the --from origin/master range also flags a pre-existing base-branch commit, unrelated to this change)

Do not merge #707 as part of this PR; this branch only stacks instrumentation on top of it.

Open in Web Open in Cursor 

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 51aaea1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/hp-query-hotpath-gaps-f2d5 branch from da99dcd to 51aaea1 Compare August 31, 2026 22:06
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Performance Comparison codex/tracedecay-total-redesign-plan-reopenedcursor/hp-query-hotpath-gaps-f2d5

Total Elapsed Time: 5.08s → 5.05s (-0.6%)
CPU Baseline: 90.18µs → 90.17µs (-0.0%)
Benchmark ID: index-bench-timing

timing - Execution duration of functions.

+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| Function                                 | Calls                      | Avg                            | P95                            | Total                           | % Total                      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| tracedecay-index-bench                   | 1 → 1 (+0.0%)              | 5.08s → 5.05s (-0.6%)          | 5.09s → 5.05s (-0.8%)          | 5.08s → 5.05s (-0.6%)           | 100.00% → 100.00% (+0.0%)    |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| query.artifact.append_pages              | 13 → 13 (+0.0%)            | 180.58ms → 177.25ms (-1.8%)    | 244.45ms → 238.29ms (-2.5%)    | 2.35s → 2.30s (-2.1%)           | 46.17% → 45.59% (-1.3%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| 🆕 query.artifact.prepare_page           | 0 → 193 (+100.0%) ⚠️       | 0.00ns → 9.22ms (+100.0%) ⚠️   | 0.00ns → 13.35ms (+100.0%) ⚠️  | 0.00ns → 1.78s (+100.0%) ⚠️     | 0.00% → 35.22% (+100.0%) ⚠️  |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| query.artifact.batch.sqlite              | 13 → 13 (+0.0%)            | 123.20ms → 120.74ms (-2.0%)    | 167.77ms → 162.66ms (-3.0%)    | 1.60s → 1.57s (-1.9%)           | 31.50% → 31.06% (-1.4%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| query.artifact.batch.postings            | 13 → 13 (+0.0%)            | 108.08ms → 105.66ms (-2.2%)    | 147.98ms → 143.13ms (-3.3%)    | 1.41s → 1.37s (-2.8%)           | 27.63% → 27.18% (-1.6%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| code_index.workers.install               | 83 → 83 (+0.0%)            | 15.29ms → 15.10ms (-1.2%)      | 51.35ms → 52.33ms (+1.9%)      | 1.27s → 1.25s (-1.6%)           | 24.96% → 24.79% (-0.7%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| CodeIndexProductionOwnerV1::extract_file | 276 → 276 (+0.0%)          | 4.54ms → 4.52ms (-0.4%)        | 6.80ms → 6.66ms (-2.1%)        | 1.25s → 1.25s (+0.0%)           | 24.63% → 24.67% (+0.2%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| code_index.build.and_publish             | 2 → 2 (+0.0%)              | 516.67ms → 508.41ms (-1.6%)    | 521.67ms → 513.28ms (-1.6%)    | 1.03s → 1.02s (-1.0%)           | 20.32% → 20.12% (-1.0%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| domain.canonical.sha256                  | 114526 → 114526 (+0.0%)    | 8.53µs → 8.33µs (-2.3%)        | 13.97µs → 13.81µs (-1.1%)      | 976.81ms → 953.67ms (-2.4%)     | 19.21% → 18.87% (-1.8%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| query.artifact.finalization.advance_wake | 14 → 14 (+0.0%)            | 53.24ms → 53.14ms (-0.2%)      | 265.95ms → 266.73ms (+0.3%)    | 745.31ms → 743.98ms (-0.2%)     | 14.66% → 14.72% (+0.4%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| query.artifact.prepare_pages             | 13 → 13 (+0.0%)            | 47.27ms → 46.56ms (-1.5%)      | 68.03ms → 67.83ms (-0.3%)      | 614.54ms → 605.34ms (-1.5%)     | 12.09% → 11.98% (-0.9%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| code_index.chunk.index_file              | 276 → 276 (+0.0%)          | 2.09ms → 2.12ms (+1.4%)        | 3.06ms → 3.02ms (-1.3%)        | 576.62ms → 584.43ms (+1.4%)     | 11.34% → 11.56% (+1.9%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| code_index.extract.parser_artifact       | 276 → 276 (+0.0%)          | 1.92ms → 1.88ms (-2.1%)        | 2.91ms → 2.84ms (-2.4%)        | 529.79ms → 519.17ms (-2.0%)     | 10.42% → 10.27% (-1.4%)      |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| query.artifact.batch.parallel_prepare    | 13 → 13 (+0.0%)            | 36.76ms → 36.30ms (-1.3%)      | 52.99ms → 52.95ms (-0.1%)      | 477.94ms → 471.85ms (-1.3%)     | 9.40% → 9.34% (-0.6%)        |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| code_index.build.assemble                | 2 → 2 (+0.0%)              | 193.28ms → 189.47ms (-2.0%)    | 198.57ms → 203.29ms (+2.4%)    | 386.57ms → 378.93ms (-2.0%)     | 7.60% → 7.50% (-1.3%)        |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+
| 🗑️ code_index.chunk.build                | 276 → 0 (-100.0%) 🚀       | 1.28ms → 0.00ns (-100.0%) 🚀   | 1.83ms → 0.00ns (-100.0%) 🚀   | 353.16ms → 0.00ns (-100.0%) 🚀  | 6.95% → 0.00% (-100.0%) 🚀   |
+------------------------------------------+----------------------------+--------------------------------+--------------------------------+---------------------------------+------------------------------+

Generated with hotpath-rs

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.

2 participants