Skip to content

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

Merged
icecrasher321 merged 4 commits into
stagingfrom
codex/safe-search-data-retirement
Oct 1, 2026
Merged

icecrasher321 merged 4 commits into
stagingfrom
codex/safe-search-data-retirement

Conversation

@icecrasher321

@icecrasher321 icecrasher321 commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Follow chore(search): remove legacy indexed enterprise search #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)

@icecrasher321
icecrasher321 requested a review from a team as a code owner October 1, 2026 18:51
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 1, 2026 8:12pm UTC

Request Review

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Critical risk] Implements database schema migration and search index retirement.

The PR appears safe to merge based on this review; no new findings remain, and all previous threads are resolved.

Summary

This PR adds an operator-run, checkpointed replacement for embedding_search, with paced copying, validation, explicit cutover, and separate gates for backup removal and Search-data retirement. It also adds health and connection checks, fences schema pushes during retirement, and disables the legacy bulk-cleanup CLI.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Prepare empty replacement and capture writes] --> B[Copy and reconcile in bounded pages]
  B --> C[Validate and wait for cutover approval]
  C --> D[Swap projection; retain backup]
  D --> E[Explicitly retire backup]
  E --> F[Purge Search chunks and retire documents]
  F --> G[Finalize and remove capture]
Loading

Reviews (6) · Last reviewed commit: "fix(db): preserve test connection URL pa..."

Comment thread packages/db/maintenance/search-retirement.ts
Comment thread packages/db/maintenance/search-retirement.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 14 files

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread packages/db/scripts/retire-indexed-search.ts Outdated
Comment thread packages/db/maintenance/search-retirement.ts
Comment thread packages/db/scripts/push.ts Outdated
Comment thread packages/db/maintenance/search-retirement.ts
Comment thread packages/db/maintenance/search-retirement.integration.ts Outdated
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 14 files

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread packages/db/scripts/retire-indexed-search.ts
@gitguardian

gitguardian Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 14 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 14 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Fix all with cubic | Re-trigger cubic

Comment thread packages/db/maintenance/search-retirement.integration.ts Outdated
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 14 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Base automatically changed from codex/remove-indexed-enterprise-search to staging October 1, 2026 20:03
@icecrasher321
icecrasher321 force-pushed the codex/safe-search-data-retirement branch from 5f428d2 to 5593bea Compare October 1, 2026 20:07
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 14 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

@icecrasher321
icecrasher321 merged commit 491ab88 into staging Oct 1, 2026
32 of 33 checks passed
@icecrasher321
icecrasher321 deleted the codex/safe-search-data-retirement branch October 1, 2026 20:25

This branch was successfully deployed

1 active deployment
Preview — 5593bea1 Deployed Oct 1, 2026 by vercel[bot]
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