Skip to content

perf: add revision-pinned retrieval serving index - #352

Merged
suguanYang merged 5 commits into
mainfrom
perf/wangbinqi/mapnav-timing-instrumentation
Aug 30, 2026
Merged

suguanYang merged 5 commits into
mainfrom
perf/wangbinqi/mapnav-timing-instrumentation

Conversation

@suguanYang

@suguanYang suguanYang commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add revision-pinned retrieval serving manifests, statistics, and namespace generations.
  • Use one coherent revision snapshot through classic/map-nav scoring, ranking, hydration, references, and connected assets.
  • Add persisted map-unit indexes, trigram term filtering, concurrent classic channels, duplicate-safe RRF, and request/episode-local reuse.
  • Guard publication, archive, namespace moves, and backfill races against stale serving data.
  • Add contract coverage, ADRs, the retrieval-serving plan, and a dedicated DevOps operations runbook.

Validation

  • make check (Ruff clean; Pyright 0 errors).
  • Focused retrieval contracts pass.
  • Local replay against a copied production-shaped corpus: classic request HTTP 200 in ~3.5s; default map-nav request HTTP 200 and completed with persisted serving indexes.
  • No prompts were changed.

DevOps operations

docs/design/retrieval-serving-index-plan.md now has a dedicated runbook covering:

  1. Read-only preflight inventory and rollback point.
  2. Additive migration order.
  3. Low-traffic trigram index rollout and lock monitoring.
  4. Controlled, bounded, idempotent active-revision backfill.
  5. Manifest/checksum/count/generation reconciliation.
  6. Legacy-versus-serving differential acceptance checks.
  7. Safe rollback and repair behavior.

Production migrations and backfill require explicit approval immediately before execution. Incomplete or invalid serving data falls back to the exact legacy reader.

import sqlalchemy as sa


revision: str = "4a5b6c7d8e9f"


revision: str = "4a5b6c7d8e9f"
down_revision: str | None = "3f4a5b6c7d8e"

revision: str = "4a5b6c7d8e9f"
down_revision: str | None = "3f4a5b6c7d8e"
branch_labels: Sequence[str] | None = None
revision: str = "4a5b6c7d8e9f"
down_revision: str | None = "3f4a5b6c7d8e"
branch_labels: Sequence[str] | None = None
depends_on: Sequence[str] | None = None
from alembic import op


revision: str = "5b6c7d8e9f0a"


revision: str = "5b6c7d8e9f0a"
down_revision: str | None = "4a5b6c7d8e9f"

revision: str = "5b6c7d8e9f0a"
down_revision: str | None = "4a5b6c7d8e9f"
branch_labels: Sequence[str] | None = None
Comment thread apps/api/alembic/versions/5b6c7d8e9f0a_add_term_trigram_indexes.py Dismissed
@suguanYang suguanYang changed the title perf: eliminate lazy MAP-NAV tree N+1 loads perf: add revision-pinned retrieval serving index Aug 30, 2026
@suguanYang
suguanYang merged commit 464ae7b into main Aug 30, 2026
6 checks passed
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