You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements the fixes from the 2026-07-28 CALM read-tool self-audit (round-2
meta-audit corrections C1–C5, plus F3–F7). All findings were re-grounded
against .calm/index.db directly before fixing.
C1–C4 — derived-edge duplication (the severe one, ~62% of call_edges were
byte-duplicate rows on a long-lived index):
- Root cause: the SCIP overlay (scip::ingest::insert_missing_edges) re-inserts
the same formal edge every run — its within-run dedup set keys on the
target's symbols.line_start while the next run reloads under the SCIP
def-occurrence line (key-space mismatch), and neither call_edges nor
import_edges had a UNIQUE constraint. import_edges had an independent
instance of the same class (extractor emits byte-identical rows).
- Defense-in-depth fix: UNIQUE indexes on both tables
(call_edges: from_symbol,to_symbol,COALESCE(call_site_line,-1),edge_kind;
import_edges: from_path,COALESCE(to_path,''),module_name,COALESCE(symbols_used,'[]'))
make every insert path idempotent; all three production inserts now use
INSERT OR IGNORE, and insert_missing_edges counts only rows the constraint
accepted. One-off, guarded cleanup migration collapses pre-existing dups
(kept MIN(id) per logical edge). Verified on a copy of this repo's real DB:
call_edges 10412→10126, import_edges 584→551, both unique indexes created.
Payoff: correct edit_context risk + callers counts (stored caller_count was
already COUNT(DISTINCT)-protected, so hub/coreness were never affected) and
large token savings on affected symbols.
C5 — search precision: search_symbol now guarantees exact-whole-name
candidacy (a dedicated idx_symbols_name lookup, since a short exact name like
`path` could fall outside the FTS fetch window entirely) and folds coreness +
a decisive exact-name bonus into ranking, gated behind the existing noise
check. `search("path")` now surfaces the symbol literally named `path` (the
repo's highest-coreness hub) on top instead of PathMatcher/PathCache.
rank_multiplier / rrf_merge_n and their tests are untouched.
F3 — edit_context.blast_radius now confidence-filters `ambiguous` edges,
matching risk_assessment (they were disagreeing on the same response).
F4 — the shared NOT_FOUND caveat now names the stdlib/builtin/third-party
scope boundary and warns that hybrid surfaces usages, not definitions.
F5 — weak_cross_reference_languages gains an indexed_file_count denominator
and suppresses low-match-rate flags below a 10-file sample floor (a handful of
incidental scripts is not a cross-reference-quality signal).
F6 — c/cpp install_hint now explains build/translation-unit coverage, the
real lever on scip-clang match rate (per benchmarks/resolution).
F7 — direct test coverage for the CalmServer::search handler (kind dispatch,
suggested_next DAG, include_tests hard-filter) — previously only the core
algorithm was tested, not the server-layer glue.
Tests: cargo test --workspace green; all-languages+overlays green; clippy
-D warnings clean (default + all-languages); fmt clean; tool schema snapshots
regenerated for the new optional repo_overview/indexing_status field.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments