fix(import): repair the bulk import that cloned 38 repos but created zero DB rows #3527
ccantynzAI Reviewcommented 25d ago
AI Triage
(no summary)
Priority: medium Risk area: mixed
Suggested labels: (no label suggestions) Suggested reviewers: (no reviewer suggestions)
Suggestions only — nothing has been applied. The PR author stays in control.
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
The first real bulk run against
ccantynz-altcloned every repo to disk and created zero DB rows. Three fixes inimportOneRepo:ON CONFLICT vs partial index.
repos_owner_nameis partial (WHERE org_id IS NULL, migration 0004).ON CONFLICT (owner_id, name)without the predicate makes Postgres reject the whole insert — "no unique or exclusion constraint matching the ON CONFLICT specification" — and it threw after the clone landed. Now passeswhere: org_id is null.Orphan adoption. Destination dir present with commits but no DB row = a prior run died after the clone. Adopt it (insert the row, skip the re-download) instead of dying on "destination path already exists". Empty leftovers are removed and re-cloned.
Case-insensitive existing check. Pre-import repos stored with original casing (
ccantynz/Vapron) were invisible to the exact-match check, so run 1 cloned a duplicatevapron.gitbesideVapron.git. Now compareslower(name).bun testimport suites 11/11, tsc clean.🤖 Generated with Claude Code