Skip to content

fix: classify a fork by owner alone, so renaming it doesn't disable fork detection - #6141

Merged
atomantic merged 1 commit into
atomantic:mainfrom
Bryandero98:fix/fork-detection-owner-only
Sep 4, 2026
Merged

fix: classify a fork by owner alone, so renaming it doesn't disable fork detection#6141
atomantic merged 1 commit into
atomantic:mainfrom
Bryandero98:fix/fork-detection-owner-only

Conversation

@Bryandero98

Copy link
Copy Markdown
Contributor

Summary

  • classifyOriginRemote() required both a different owner AND a matching repo name to classify an origin as a fork (server/lib/gitRemote.js).
  • Renaming a fork on GitHub (<owner>/PortOS -> <owner>/PortOS-Fork) silently flips isFork to falsegit/gh repo sync keep working through GitHub's slug redirect, but the fork panel, POST /api/update/sync-fork, the FORK_SYNC_REQUIRED update guard, and the divergence check all disappear with no warning.
  • Drops the repo-name requirement: isFork = isGithub && !ownerMatchesUpstream. Any GitHub origin under an owner other than upstream now classifies as a fork.
  • Tradeoff accepted deliberately, per the issue: a genuinely unrelated GitHub origin also classifies as a fork now — its failure mode is a clear gh repo sync error, not four silently missing features.

Test plan

  • gitRemote.test.js — updated the case that used to assert isFork: false for a differently-named repo under a different owner (now true, matching the new intended behavior), added a renamed-fork-of-PortOS case.
  • npx vitest run lib/gitRemote.test.js routes/update.test.js services/updateChecker.test.js services/updatePreflightParity.test.js — 128/128 passing, no regressions in the four downstream consumers the issue named.

Closes #5931

🤖 Generated with Claude Code

…ork detection

classifyOriginRemote() required both a different owner AND a matching repo
name to classify an origin as a fork. Renaming a fork on GitHub
(<owner>/PortOS -> <owner>/PortOS-Fork) silently flipped isFork to false —
git/gh repo sync keep working through GitHub's slug redirect, but the fork
panel, POST /api/update/sync-fork, the FORK_SYNC_REQUIRED update guard, and
the divergence check all disappear with no warning.

Drops the repo-name requirement: any GitHub origin under an owner other
than upstream now classifies as a fork. The tradeoff (a genuinely unrelated
GitHub origin also classifies as a fork) is accepted deliberately — its
failure mode is a clear gh repo sync error, not four silently missing
features.

Refs atomantic#5931
@atomantic
atomantic merged commit ac23aef into atomantic:main Sep 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fork detection breaks when the fork is renamed, silently disabling all four fork behaviours

2 participants