fix(db): fold seven Drizzle-schema identity tables into renameRepositoryIdentity - #8416
fix(db): fold seven Drizzle-schema identity tables into renameRepositoryIdentity#8416kai392 wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-24 12:35:24 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (conflicts with the base branch — resolve and open a fresh PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Summary
The Drizzle half of the rename-orphan gap (companion to the raw-SQL half, #8380/#8409). 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, and reuses a shape already present in the module:repositoryAiKeys,repositoryLinearKeysrepo_full_namePRIMARY KEYrepositoriesbountiesUNIQUE (repo_full_name, issue_number)issue_number, same aspullRequests/issuesreviewSuppressionUNIQUE (repo_full_name, category, path_glob, pattern_hash)checkSummariesagentPendingActionsUNIQUE (repo_full_name, pull_number, action_class)pullRequestFilesissueWatchSubscriptionsUNIQUE (login, repo_full_name)login, same ascontributorRepoStatsgithubAgentCommandFeedback(answer_id, actor_hash)repoSnapshotsTwo details worth flagging, both 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)from the Gitt snapshot,src/bounties/ingest.ts). Rewriting them would corrupt an external key.isNullbranching in the two per-tuple folds: unlikecheckSummaries.headSha, every fold column here isnotNullin the schema, so a plaineq()per column is correct.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 differing only bycategory, a pending action differing only byaction_class, another bypull_number, a different watcher's subscription, a different repo's feedbackgithub_agent_command_feedbackasserts both rows survive the rename (no unique index on that column, so nothing may fold)src/db/repo-identity-rename.ts: 132/132 lines, 37/38 branches — the single partial branch is the pre-existingrepoPartsternary at line 67, outside this diff (lines 366-445)npm run typecheckclean