fix(db): recover failed credential group index on migration retry - #7595
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR makes migration 0326 recover automatically from an invalid workspace credential-group index left by a failed concurrent build.
Confidence Score: 5/5The PR appears safe to merge; no outstanding correctness or repository-rule issue was identified. The migration narrowly recovers the expected invalid index, rejects unexpected recovery-name occupants, retains concurrent index operations, and has focused replay coverage for its important failure states. The follow-up connector assertion remains safe and tests the intended identifier contract more precisely.
|
| Filename | Overview |
|---|---|
| packages/db/migrations/0326_enterprise_organization_search.sql | Adds guarded, replay-safe recovery for the invalid workspace uniqueness index while preserving healthy indexes and existing rows. |
| packages/db/organization-search-migration.postgres.test.ts | Expands PostgreSQL migration tests across duplicate failure, repaired retry, interrupted recovery, and healthy-index replay scenarios. |
| apps/sim/lib/knowledge/orchestration/connectors.test.ts | Replaces substring matching with an exact connector-identifier inequality assertion. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Retry migration 0326] --> B{Recovery-named index exists?}
B -- Yes --> C{Invalid and owned by credential_group?}
C -- No --> D[Abort without dropping index]
C -- Yes --> E[Continue recovery]
B -- No --> E
E --> F{Original workspace index is invalid?}
F -- Yes --> G[Rename to recovery name]
F -- No --> H[Preserve original index]
G --> I[Drop recovery index concurrently]
H --> I
I --> J[Create workspace unique index concurrently if absent]
J --> K{Duplicate workspace groups remain?}
K -- Yes --> L[Uniqueness build fails; data remains]
K -- No --> M[Valid unique index restored]
Reviews (2): Last reviewed commit: "fix(test): compare connector identifiers..." | Re-trigger Greptile
|
@cubic-dev-ai review this PR |
@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete. |
Summary
Type of Change
Testing
Six PostgreSQL migration tests passed, covering duplicate failures, recovery after removing duplicates, interrupted recovery, and healthy-index preservation. All 58 connector orchestration tests passed. Database type checking, lint, all 46 audits, docs-manifest validation, and migration safety checks passed.
Checklist