fix(v1.27 migration): qualify repo with owner so gh rename actually runs#1437
Open
agile-operators wants to merge 1 commit into
Open
Conversation
`gh repo rename --repo` and `gh repo edit` both require the "[HOST/]OWNER/REPO" form. The v1.27.0.0 migration was passing a bare repo name (e.g. `gstack-brain-Brandon`), which `gh` rejects with: expected the "[HOST/]OWNER/REPO" format, got "gstack-brain-Brandon" Both invocations suppressed stderr with `2>/dev/null`, so the failure surfaced only as the generic "repo may not exist or permission denied" warning — misdirecting users who actually have ADMIN on the repo. The step was then `mark_done`'d, so re-running the upgrade does not retry. The local pointer at ~/.gstack-artifacts-remote.txt ends up referencing a non-existent repo until the user notices. Reproduction (before fix): $ gh repo rename gstack-artifacts-Brandon --repo gstack-brain-Brandon --yes expected the "[HOST/]OWNER/REPO" format, got "gstack-brain-Brandon" Fix: resolve the authenticated user's login via `gh api user --jq .login` and qualify both the existing-repo check (`gh repo view`) and the rename/edit calls. Capture stderr from each attempt so the warning includes the real `gh` error instead of a generic guess. The fake-gh test fixture grows a single case for `gh api user` so the existing test matrix continues to drive the rename path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
v1.27.0.0migration (gstack-brain → gstack-artifacts rename) silently fails to rename users' GitHub repos because it passes a bare repo name togh repo rename --repoandgh repo edit, both of which require the[HOST/]OWNER/REPOform.Because stderr was suppressed with
2>/dev/null, this surfaced only as the generic warninggh rename failed (repo may not exist or permission denied)— misdirecting users who actually haveADMINon the repo. The step is thenmark_done'd, so a second/gstack-upgraderun does not retry. The local pointer at~/.gstack-artifacts-remote.txtends up referencing a repo that doesn't exist on GitHub until the user notices.I hit this today upgrading from v1.26.4.0 → v1.32.0.0 on a fully-authenticated
ghwith ADMIN on the legacygstack-brain-$USERrepo.What this PR changes
gh api user --jq .login.gh repo view) and the rename/edit invocations with$OWNER/$REPO.gherror instead of a generic guess.ghmock intest/migrations-v1.27.0.0.test.tsso existing tests still drive the rename path with the newgh api usercall.No behavior change for users where the migration would already be a no-op (
ghunauthenticated, repo already at the new name, or no legacy state).Test plan
bun test test/migrations-v1.27.0.0.test.ts— 11/11 passing locallybash -n gstack-upgrade/migrations/v1.27.0.0.sh— cleangh repo rename gstack-artifacts-Brandon --repo agile-operators/gstack-brain-Brandon --yes) — succeeded🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.