Skip to content

Keep upgrades working through the repo's move between orgs - #185

Merged
jeff-gusto merged 1 commit into
mainfrom
js/upgrade-survive-repo-move
Oct 28, 2026
Merged

jeff-gusto merged 1 commit into
mainfrom
js/upgrade-survive-repo-move

Conversation

@jeff-gusto

Copy link
Copy Markdown
Contributor

Summary

  • This repo is moving from Gusto/gusto-cli to BuildwithGusto/gusto-cli. The upgrade's release lookup read only the first Location off /releases/latest and expected it to name a tag. After the move, that first hop is the move's own redirect, so every installed binary would fail with release_lookup_failed. The old path's redirects also stop working some time after the move.
  • gusto upgrade and background auto-update now look for releases under BuildwithGusto/gusto-cli first, then Gusto/gusto-cli. A binary from this release on finds releases before the move, while the old path redirects, and after the redirects lapse. GUSTO_CLI_REPO still overrides this with one repo.
  • The lookup follows a short redirect chain (5 hops, https only) until a Location names a release tag. The download then comes from the repo the tag was found in, so nothing after the lookup depends on a redirect.
  • A pinned GUSTO_CLI_VERSION has no lookup, so its download tries each repo in turn. SHA256SUMS always comes from the repo that served the binary.
  • Only an HTTP answer (a 404, say) moves on to the next repo. A network error or timeout would fail the same way again, after another full timeout.

Binaries released before this change can't be fixed in place. They keep upgrading only if they pick up this release before the move, so it should ship soon.

Not in this PR:

  • Pointing install.sh, the cli.gusto.com/install.sh redirect, the help text and the README at the new repo. That follows the move.
  • Removing Gusto/gusto-cli from the list of repos to try, once every supported release looks under the new name first.

Linked issue

None.

Test plan

  • bun run test:all passes locally
  • Manual run of touched commands works against sandbox: not applicable, since upgrade doesn't call the Gusto API. Ran the real lookup against GitHub instead. BuildwithGusto/gusto-cli returned 404, the lookup fell back to Gusto/gusto-cli, and it resolved v0.4.0 with downloads from that repo.
  • --agent and --human output verified where touched: not applicable, since the envelope shape is unchanged. Only error messages and a stderr log line differ.
  • bun run lint, tsc --noEmit, bun run format:check
  • New tests cover new-repo-first, falling back to the old repo, a moved repo's two-hop redirect, relative Location, refusing an http redirect, a redirect loop, no fallback on a network error, the pinned download fallback (checksum included), and downloading only from the repo the lookup found.

DCO

  • Every commit is signed off (git commit -s) per the DCO

🤖 Generated with Claude Code

The release lookup read only the first Location off /releases/latest and
expected it to name a tag. Once the repo moves to BuildwithGusto, that
first hop is the move's own redirect, so every installed binary would
fail with release_lookup_failed. The old path's redirects also stop
working some time after the move.

- Look for releases under BuildwithGusto/gusto-cli first, then
  Gusto/gusto-cli, so a binary finds them before the move, during the
  redirect window, and after the redirects lapse.
- Follow a short, https-only redirect chain until a Location names a
  release tag.
- Download from the repo the tag was found in, so nothing after the
  lookup depends on a redirect. A pinned GUSTO_CLI_VERSION has no lookup,
  so its download tries each repo in turn, with SHA256SUMS always from
  the repo that served the binary.
- Only an HTTP answer moves on to the next repo. A network error or
  timeout would fail the same way again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jeff Stephens <jeff.stephens@gusto.com>
@jeff-gusto
jeff-gusto marked this pull request as ready for review October 27, 2026 21:12
@jeff-gusto
jeff-gusto requested review from a team and ashieh as code owners October 27, 2026 21:12
@jeff-gusto
jeff-gusto requested a review from tmfahey October 27, 2026 21:12
@jeff-gusto
jeff-gusto merged commit f3c384c into main Oct 28, 2026
8 checks passed
@jeff-gusto
jeff-gusto deleted the js/upgrade-survive-repo-move branch October 28, 2026 15:15
@jeff-gusto jeff-gusto mentioned this pull request Oct 28, 2026
10 tasks done
jeff-gusto added a commit that referenced this pull request Oct 28, 2026
## Summary

- Bumps the root package version and public version examples from
`0.4.0` to `0.5.0`.
- Prepares `v0.5.0` for the missing-scope error changes (#182) and the
upgrade changes that keep `gusto upgrade` and auto-update working
through the repo's move between orgs (#185). The upgrade change only
reaches installed binaries once they update to a release that contains
it, so this should be released promptly.

## Linked issue

None.

## Test plan

- [x] `env -u NO_COLOR bun run test:all` passes locally
- [x] Manual run of touched commands works against sandbox — not
applicable; this changes only version metadata and documentation
- [x] `--agent` and `--human` output verified where touched — not
applicable; this changes no output behavior
- [x] `tsc --noEmit`
- [x] `bun run lint`
- [x] `bun run format:check`
- [x] `bun run license:check`
- [x] `bun run build`
- [x] Compiled binary reports `0.5.0`

## DCO

- [x] Every commit is signed off (`git commit -s`) per the
[DCO](https://github.com/Gusto/gusto-cli/blob/main/CONTRIBUTING.md#developer-certificate-of-origin)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Jeff Stephens <jeff.stephens@gusto.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants