Skip to content

fix(lore): use live SQL coverage gate cached on vector_epoch - #120

Open
syf2211 wants to merge 1 commit into
mathomhaus:mainfrom
syf2211:fix/lore-appraise-live-coverage-gate
Open

fix(lore): use live SQL coverage gate cached on vector_epoch#120
syf2211 wants to merge 1 commit into
mathomhaus:mainfrom
syf2211:fix/lore-appraise-live-coverage-gate

Conversation

@syf2211

@syf2211 syf2211 commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Appraise's RRF semantic arm now computes coverage from live COUNT(*) queries (lore_vectors rows vs active entries), cached on meta.vector_epoch, instead of trusting drift-prone meta.vector_coverage_* counters. Also extends guild lore coverage-reconcile to reset both vector_coverage_num and vector_coverage_den.

Fixes #76

Motivation

When meta.vector_coverage_num/den drift from live state, appraise can report coverage below the 0.90 RRF gate and silently disable the semantic arm — even though vectors on disk are healthy and auto-backfill sees the corpus as fine. This is a silent retrieval-quality regression for paraphrased queries.

Changes

  • readCoverage / liveCoverageCounts: epoch-cached live SQL gate in appraise_rrf.go
  • embed.ReconcileNum: reset vector_coverage_num from live COUNT(*) FROM lore_vectors
  • coverage-reconcile command: reconcile both num and den, report before/after for both
  • Regression tests: stale-meta drift, epoch cache hot path, RRF engagement, ReconcileNum

Tests

go test ./internal/lore/... -count=1

All lore and embed tests pass.

Notes

  • Cache invalidates on vector_epoch bumps (vector writes / backfill). Denominator-only inscribe/seal changes may leave a brief stale window; this is documented and bounded, unlike the permanent meta-counter drift this fixes.
  • Health/dashboard readers still use meta counters; only the load-bearing appraise gate is made drift-immune per issue scope.

Appraise's RRF semantic arm was gated on meta.vector_coverage_*
counters that drift from live lore_vectors/entries counts. When stale
meta reported coverage below 0.90, the semantic arm was silently
disabled even though vectors on disk were healthy.

- Compute appraise coverage from live COUNT(*) cached on vector_epoch
- Add ReconcileNum and extend coverage-reconcile to reset num + den
- Add regression tests for drift scenario and epoch cache hot path

Fixes mathomhaus#76
@github-actions github-actions Bot added the area: lore Lore knowledge archive label Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: lore Lore knowledge archive

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] lore appraise: semantic arm gated off by stale meta counters even when vectors are healthy

1 participant