Skip to content

refactor(store): one schema owner — search SQL and serve queries move into store/, scoring inverts out#1795

Merged
jamie8johnson merged 5 commits into
mainfrom
audit-store-boundary
Jun 12, 2026
Merged

refactor(store): one schema owner — search SQL and serve queries move into store/, scoring inverts out#1795
jamie8johnson merged 5 commits into
mainfrom
audit-store-boundary

Conversation

@jamie8johnson

Copy link
Copy Markdown
Owner

refactor(store): one schema owner — search SQL and serve queries move into store/, scoring inverts out (CQ-V1.42-13/14)

The root-cause refactor behind this cycle's gate-in-dead-code P1: "FTS query against chunks" had two homes, and serve carried a third via pub(crate) pool leakage.

Nested-lead build: two sub-implementers on disjoint slices, lead-integrated and gated.

🤖 Generated with Claude Code

jamie8johnson and others added 5 commits June 11, 2026 17:58
… into store/, scoring inverts out

- serve/data.rs no longer runs raw sqlx against the store schema: all five
  builders' query bodies move into store/serve_queries.rs as typed-row methods;
  serve keeps only wire-shaping (injection flags, trust level, preview
  truncation, NodeRef/Node/Edge construction, BFS/dedup/degree). Zero sqlx in
  serve.
- RRF fusion (rrf_fuse, rrf_fuse_n, rrf_k, set_rrf_k_from_config) moves out of
  store/search.rs into search/scoring/fusion.rs as free functions — search owns
  fusion. The ASCII name-match helpers move to store/helpers/scoring.rs next to
  score_name_match_pre_lower.
- store/search.rs now imports nothing from crate::search, killing the
  knob / BoundedScoreHeap / rrf_fuse back-edges. It retains only store-owned SQL
  (search_fts, fts_match_ids, search_by_name) with the v27 needs_embedding gate
  intact.
- Pure code motion: bodies move verbatim, logic unchanged. v27 visibility gates,
  fused-score reuse path, and note-boost cell caching survive verbatim.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CI diffs the merge ref, so comments moved by the boundary refactor count
as added lines; their SEC-N markers tripped the provenance lint. Rewrote
each to state the invariant directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jamie8johnson jamie8johnson merged commit f409867 into main Jun 12, 2026
9 checks passed
@jamie8johnson jamie8johnson deleted the audit-store-boundary branch June 12, 2026 00:19
jamie8johnson added a commit that referenced this pull request Jun 12, 2026
…le deny ignores, dead derives (closes #1777, #1778, #1785) (#1796)

* fix: trivial sweep — stale deny ignores, unused Serialize derives, token-free banner logging, kind doc, verify-skill parser (closes #1777, #1778, #1785)

- deny.toml: prune stale RUSTSEC-2024-0388 (derivative) and RUSTSEC-2024-0384
  (instant) ignores — both crates left Cargo.lock with the keyring chain;
  SECURITY.md already lists only the live three, no change there.
- cross_project.rs: drop unused Serialize derives + orphaned serde attrs from
  CrossProjectCaller/CrossProjectCallee — the cross cores remap them to
  CallerEntry/CalleeEntry field by field, zero direct serialization sites.
- serve banner: print the tokenized URL only when stdout is a terminal; on a
  non-TTY stdout print the URL without the token plus an accurate hint that the
  token is per-launch and terminal-only — keeps the session secret out of
  journald/container logs. Pinned via auth_banner_tty/auth_banner_non_tty tests.
- kind.rs: correct the stale module-doc claim — graph commands route through it
  via detect_fallback/detect_kind_for_store.
- cqs-verify SKILL.md: notes-list parser uses r["count"] now that notes list
  returns {notes, count}; callers/callees parser lines verified against current
  shapes (both already use count).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs(audit): final triage flips — C1/C2/C3 lanes landed

CQ-V1.42-9 → #1793; CQ-V1.42-13/14 → #1795 (residual #1790);
API-V1.40-2/3/5/6/9 + DS-V1.40-8/10 → #1792; API-V1.40-10 closed
(keep-both verdict); PB-V1.40-9 refuted with live WAL-on-v9fs evidence.
Remaining open: PERF-V1.40-7, RM-V1.40-4, RM-V1.40-5 (easy perf trio,
polish-wave candidates).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jamie8johnson <jamie8johnson@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
jamie8johnson added a commit that referenced this pull request Jun 12, 2026
…pool/rt privatized, rrf re-export dropped (closes #1790) (#1802)

* refactor(store): complete search→store inversion — note-boost cache, pool/rt privatized, rrf re-export dropped (closes #1790)

Finishes the inversion deferred from the #1795 boundary refactor.

1. Note-boost cache relocates search-side. The store no longer names the
   boost-index type or runs the boost math: it holds an opaque
   `search::scoring::NoteBoostCache` cell and forwards invalidate()/clear().
   The cache build-from-notes logic and the `cached_note_boost_index`
   accessor move into `search::scoring::note_boost` and the search-side
   `impl Store` block. Invalidation semantics are unchanged — a note
   mutation clears the cell via `invalidate_notes_cache`, and `clear_caches`
   resets it alongside the notes cache. `OwnedNoteBoostIndex` no longer
   appears under src/store/.

2. `Store.pool` / `Store.rt` are now private. The only non-test cross-module
   reader was search/query.rs's brute-force scan. Its raw cursor SQL moves
   into a store-owned `fetch_brute_force_batch`, and the runtime is driven
   through a store-owned `block_on` wrapper, so search composes store async
   methods without touching the fields. Cross-module test fixtures use the
   `cfg(test)` `Store::pool` accessor plus `block_on`.

3. dispatch.rs reaches `set_rrf_k_from_config` through
   `cqs::search::scoring::` directly; the `store` re-export is deleted and
   the `scoring` module is now `pub`.

Scoring is bit-identical: two new pins capture exact post-boost scores for
boosted/demoted/neutral mentions through `search_filtered` and pin the
cache-refresh-on-note-change contract. Both pass identically before and
after the motion. Bodies move verbatim; only visibility, imports, and the
row-fetch seam change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: soften fetch_brute_force_batch ownership claim — store executes, search composes

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jamie8johnson <jamie8johnson@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
jamie8johnson added a commit that referenced this pull request Jun 12, 2026
* chore: v1.43.0 prep — version bumps (cqs 1.43.0, cqs-macros 0.1.1), CHANGELOG campaign splice, ROADMAP watch-mode flip, tears

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(release): sweep-PR changelog entries (#1797-#1801), tears rewrite, SECURITY banner-claim fix

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(release): #1802 changelog entry; drop scratch draft

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(release): stamp 1.43.0 section header

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore(release): recall gate passed — fixture re-pins, eval-number sync (50.0/71.6/87.2)

Same-corpus binary A/B: v1.42.0 and v1.43.0 produce bit-identical eval
results — zero retrieval change from the campaign. Delta vs the 2026-06-10
capture is corpus drift. Three golds re-pinned (rrf_fuse moved by #1795;
needs_reindex and display_similar_results_json deleted, re-pointed to
nearest current equivalents).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: jamie8johnson <jamie8johnson@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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