fix(ci): resolve ambiguous repo match instead of erroring#615
fix(ci): resolve ambiguous repo match instead of erroring#615wesm merged 6 commits intoroborev-dev:mainfrom
Conversation
When multiple repos share the same git remote identity (e.g. an
auto-clone AND a user checkout), GetRepoByIdentityCaseInsensitive
and findRepoByPartialIdentity now disambiguate instead of returning
an error. Auto-clones ({DataDir}/clones/) are preferred since CI
manages them and they won't have dirty working tree state. If no
auto-clone exists, the most recently created repo is returned.
This fixes the CI poller breaking on every poll cycle when users
have their own local checkout registered alongside the auto-clone.
roborev: Combined Review (
|
- Prevent cross-host repo confusion in findRepoByPartialIdentity: only auto-resolve when all matches share the same normalized identity. Different remotes (e.g. github.com vs ghe.corp.com) are genuinely ambiguous and still return an error. - Fix CreatedAt never populated in findRepoByPartialIdentity by selecting and parsing created_at from the query, so the newest-repo fallback in PreferAutoClone works correctly. - Add defensive sync-placeholder filtering in PreferAutoClone itself (root_path == identity rows are skipped) so it cannot select a non-filesystem path even if a caller omits the check.
roborev: Combined Review (
|
The partial-identity disambiguation compared full identity strings, so SSH (host:owner/repo) and HTTPS (https://host/owner/repo) remotes for the same host were treated as different repos. Extract a scheme-independent host/path key before comparing. Also fix the SameHostResolved test to actually use mixed URL schemes (SCP-style vs HTTPS) instead of two identical SSH URLs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Strip optional user@ prefix in normalizeIdentityKey so that git@host:owner/repo identities (as actually persisted) match their HTTPS counterparts. Use parsed.Host instead of parsed.Hostname() to preserve explicit ports and avoid false matches across different services on the same hostname. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Strip well-known default ports (443 for HTTPS, 22 for SSH, etc.) so that host:443/path and host/path normalize to the same key, while non-default ports like :8443 are preserved. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Always go through parsed.Hostname() to strip brackets uniformly, then re-add them for IPv6 literals and append only non-default ports. This ensures https://[::1]/repo and https://[::1]:443/repo produce the same key. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
roborev: Combined Review (
|
|
False positive. I'll merge this once CI passes |
Summary
GetRepoByIdentityCaseInsensitiveandfindRepoByPartialIdentitynow disambiguate instead of returning an error.{DataDir}/clones/) are preferred since CI manages them and they won't have dirty working tree state. If no auto-clone exists among the matches, the most recently created repo is returned.ambiguous repo match for "towardsthecloud/cloudburn-nextjs": multiple repos found with identity "git@github.com:towardsthecloud/cloudburn-nextjs.git"Diagram
flowchart TD A[GetRepoByIdentityCaseInsensitive] --> B{How many matches?} B -->|0| C[Return nil] B -->|1| D[Return match] B -->|>1| E[PreferAutoClone] E --> F{Any match under\nDataDir/clones/?} F -->|Yes| G[Return auto-clone] F -->|No| H[Return most recently\ncreated repo]