fix(github): extend repo-rename identity migration to REES/parity tables - #5954
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-15 01:04:13 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 3 non-blocking
Concerns raised — review before merging
📋 Copy for AI agents — paste into your coding agent
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory 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://gittensory.aethereal.dev/docs/gittensory-commands 🟩 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.
|
bc0eb26 to
39f7753
Compare
39f7753 to
23a30fe
Compare
Summary
Follow-up to #5918 / #5950 / #5953. Extends
renameRepositoryIdentitytoreview_audit,contributor_gate_history, andsubmitter_stats— raw-SQL-only REES/parity tables, never added to the Drizzle schema (see each migration's own header comment), so these three blocks useenv.DB.prepare()directly instead of the query builder, matching how every real writer (parity-wire.ts,outcomes-wire.ts,contributor-calibration.ts,submitter-reputation.ts) already accesses them.What changed
review_audit,contributor_gate_history: PKidalone, no separate unique index.projectIS the repo full name at every live writer;target_id(${project}#${pullNumber}) andidboth embed it. Folds on theidcollision the rename would produce — same PK-collision-only shape aspull_request_reviews/collision_edgesfrom earlier PRs in this series.submitter_stats: noidcolumn —PRIMARY KEY (project, submitter)directly. Folds on the other half of the composite key,submitter.Deliberately out of scope
Two other raw-SQL REES tables:
review_targets: has no live writer anywhere in this codebase — explicitly confirmed orphaned bysrc/review/public-stats.ts's own comment ("the legacy review_targets ledger, which the convergence cutover orphaned"). Itsprojectcolumn is an agent/install-level slug that must never be renamed (not a per-repo value at all), and itsrepocolumn's real on-disk semantics for that historical, one-time-bulk-copied data can't be independently verified from current code alone — mutating identity columns on data no writer would ever repair carries real corruption risk for uncertain benefit.repo_chunks: a rebuildable RAG chunk/embedding cache (same reasoning fix(github): extend repo-rename identity migration to analytics tables #5953 used to exclude the AI/LLM caches), whoseproject/repocolumns hold the bare owner and bare repo name separately (not a single owner/repo string), and whoseidis a lowercased, truncated-to-64-chars hash of the two — a safe in-place string rename isn't mechanically available without risking a silently-corrupted truncated id.Both documented inline in the code so the omission reads as a deliberate call, not an oversight.
Test plan
npm run typecheck— cleannpx vitest run test/unit/repo-identity-rename.test.ts— 37/37 passing (7 new: a rename test for all 3 tables, a collision-fold regression test for each, plus an unrelated-row-untouched check forsubmitter_stats)npm run test:ci— full local gate, greennpm audit --audit-level=moderate— 0 vulnerabilitiesThis is the last PR in the repo-rename-migration series (#5918, #5950, #5953, this one) — together they cover every repo-identity-bearing table in the schema except the deliberately-excluded rebuildable caches noted above.