chore(search): add paced projection replacement and data retirement

Merged
IC
1mo ago
+2702-250

Summary

  • Follow #8528, now merged into staging. Add operator-run, checkpointed replacement of embedding_search that retains ordinary-KB vectors and retires indexed Search chunks in paced batches. Deploying this PR starts no maintenance.
  • Build shared HNSW indexes on the empty replacement and populate them incrementally. Validate retained data and concurrent changes before an explicit, fail-fast cutover; retire the backup and remove capture at separate operator gates. No final reindex or vacuum runs.
  • Require a verified direct PlanetScale primary connection, fresh primary/replica/application telemetry, bounded transactions and cooldowns. Preserve ordinary KBs, canonical document ACLs and live Search configuration. Stop after connection loss instead of reconnecting without the maintenance lock.
  • Require the code-removal release to be fully deployed and older workers drained. Start with single-page runs while watching telemetry; verify ordinary-KB retrieval, ACL denials, connector ingestion and live Search before begin-purge. The CLI help contains the command sequence and health-file contract.
  • Fence the entire schema-push command chain against retirement, refuse pushes once retirement starts, and disable the old bulk-cleanup CLI. Remaining legacy compatibility columns and tables need a separate writer/bootstrap cleanup and schema contraction.

Type of Change

  • Improvement

Testing

  • 23 real PostgreSQL cases with both schema-push and versioned-migration provisioning, covering concurrent writes, all vector widths, deferred repair, snapshot/lock refusal, late writes, dependency drift, CLI health/connection gates, schema-push contention and process connection loss. JSON reports use INTEGRATION_REPORT_PATH.
  • 61 focused health and schema-push unit tests. The corrected late-write precondition, both schema-push races, endpoint admission and lost-session checkpoint protection were verified failing before their fixes.
  • Database and explicit CLI type-checks, lint, all 54 audits, artifact generation, docs manifest, block registry and migration checks.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)