fix(registry): resolve repo casing case-insensitively on sync - #604
Conversation
persistRegistrySnapshot keyed the upsert conflict target and the de-registration on the case-sensitive fullName primary key, while repo names arrive from multiple sources (registry vs GitHub-canonical) and the rest of the system resolves repos case-insensitively. A casing mismatch inserted a duplicate row and de-registered the wrong one (same class as JSONbored#223/JSONbored#225). Resolve each snapshot repo to an existing row by lowercased name before upsert, and de-register by lowercased comparison.
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
reviewbot · advisory review Reviewed 2 changed file(s) — two independent AI reviewers. Suggested action: 🛠️ Request changes. Address the suggestions below before merging. Reviewer A · Suggestions
Worth double-checking
Reviewer B · |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
gittensory · advisory review Reviewed 2 changed file(s) — two independent AI reviewers. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Worth double-checking
|
JSONbored
left a comment
There was a problem hiding this comment.
Please see latest review for requested changes and ensure CI is green when done.
Address review: (1) restore the empty-snapshot guard so a failed/empty registry fetch never de-registers every repo; (2) record each resolved canonical name within the sync loop so a case-variant duplicate in the same snapshot upserts the existing row instead of inserting a second case-only-different primary key. Add tests for both.
|
Thanks for the review — addressed in 7a8d110:
Added regression tests for both (empty snapshot preserves registrations; two case-variant entries collapse to one row). |
Closes #603.
persistRegistrySnapshotkeyed the upsert conflict target (onConflictDoUpdate({ target: fullName })) and the de-registration (notInArray(fullName, …)) on the case-sensitiverepositories.fullNameprimary key. But repo names arrive from multiple sources (the upstream registry vs GitHub-canonical webhook/API casing) and the rest of the system resolves repos case-insensitively (getRepositoryhas alower(fullName)fallback). On a casing mismatch the sync inserted a duplicate primary-key row instead of updating the existing one, and the case-sensitive de-registration nulled the registration on the other casing — splitting a repo into two rows so a registered repo could read back as unregistered. Same class as the already-fixed #223/#225 (case-sensitiverepoFullNamecomparison), at an unfixed site.Change
Verification
registry.test.ts7/7;tsc --noEmitclean; full suite green;sync.ts98% branch; global branch coverage holds (>= 97% gate).