fix(db): fold seven Drizzle-schema identity tables into renameRepositoryIdentity#8424
Merged
loopover-orb[bot] merged 1 commit intoJul 24, 2026
Conversation
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8424 +/- ##
==========================================
- Coverage 92.42% 89.65% -2.78%
==========================================
Files 791 98 -693
Lines 79290 22864 -56426
Branches 23950 3894 -20056
==========================================
- Hits 73283 20498 -52785
+ Misses 4868 2187 -2681
+ Partials 1139 179 -960
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Contributor
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 LoopOver is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Drizzle half of the rename-orphan gap (companion to the raw-SQL half, #8380/#8409, now on main). Seven
src/db/schema.tstables carry arepo_full_nameidentity column with live writers but were never covered byrenameRepositoryIdentity, so a repo-rename webhook permanently disconnected a repo's BYOK provider key, Linear key, open bounties, review-suppression rules, pending agent approvals, issue-watch subscriptions, and command-feedback votes.Each uses the fold strategy its real constraint requires, verified in
schema.ts, reusing a shape already in the module:repositoryAiKeys,repositoryLinearKeysrepo_full_namePRIMARY KEYrepositoriesbountiesUNIQUE (repo_full_name, issue_number)issue_number, aspullRequests/issuesreviewSuppressionUNIQUE (repo_full_name, category, path_glob, pattern_hash)checkSummariesagentPendingActionsUNIQUE (repo_full_name, pull_number, action_class)pullRequestFilesissueWatchSubscriptionsUNIQUE (login, repo_full_name)login, ascontributorRepoStatsgithubAgentCommandFeedback(answer_id, actor_hash)repoSnapshotsTwo details verified rather than assumed:
idrewrites. UnlikepullRequests/issues/contributorRepoStats, none of these ids embed the repo name — five arecrypto.randomUUID()at their writer, andbounties.idis an external id (String(issue.id),src/bounties/ingest.ts). Rewriting it would corrupt an external key.isNullbranching in the per-tuple folds: unlikecheckSummaries.headSha, every fold column here isnotNull.Closes #8379
Test plan
describeblocks intest/unit/repo-identity-rename.test.ts, each asserting the fold keeps the old row's real data (key ciphertext, bounty status, the maintainer'sacceptedpending-action) rather than the post-rename fragment, and that near-miss rows survive untouched — a suppression rule differing only bypattern_hash, another only bycategory, a pending action differing only byaction_class, another bypull_number, a different watcher, a different repo's feedbackgithub_agent_command_feedbackasserts both rows survive (no unique index on that column, so nothing may fold)src/db/repo-identity-rename.ts: 157/157 lines, 43/44 branches — the single partial branch is the pre-existingrepoPartsternary at line 67, outside this diffnpm run typecheckclean