Skip to content

fix(apps): open app URL without config#4989

Merged
tomr-a5 merged 1 commit into
masterfrom
tom/flyctl-4215-apps-open-app-flag
Jul 9, 2026
Merged

fix(apps): open app URL without config#4989
tomr-a5 merged 1 commit into
masterfrom
tom/flyctl-4215-apps-open-app-flag

Conversation

@tomr-a5

@tomr-a5 tomr-a5 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What

Allow fly apps open -a <app> to open the default https://<app>.fly.dev/ URL when flyctl cannot load app config.

Why

Supplying -a currently still fails if no local/remote app config can be loaded, which makes the app flag feel ignored for a command whose main job is to open the app URL.

How

  • Keep using config-derived URLs when local or remote app config is available
  • Ignore local config that belongs to a different app than the selected app
  • Fall back to the default Fly app hostname only when app config is unavailable
  • Print a warning before falling back, while keeping the raw remote-load error in debug logs
  • Share relative-URI handling across both paths
  • Add focused tests for fallback, warning output, relative URI handling, local config, mismatched local config, remote config, missing app name, and no-public-service behavior

Tests

go test ./internal/command/apps -run TestRunOpen -count=1 -v
go test ./internal/command/apps -count=1
go test ./internal/command/... -count=1
go test ./... -run '^$' -count=1
go test ./... -count=1

Fixes #4215

@tomr-a5 tomr-a5 self-assigned this Jul 8, 2026
@tomr-a5 tomr-a5 force-pushed the tom/flyctl-4215-apps-open-app-flag branch 2 times, most recently from 465e5dc to 2c515f8 Compare July 8, 2026 19:09
@tomr-a5 tomr-a5 force-pushed the tom/flyctl-4215-apps-open-app-flag branch from 2c515f8 to 57a0ed3 Compare July 9, 2026 16:51
@tomr-a5 tomr-a5 marked this pull request as ready for review July 9, 2026 18:49
@dangra dangra requested a review from Copilot July 9, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables fly apps open -a <app> to still open the app in a browser when no local/remote app config can be loaded, by falling back to the default https://<app>.fly.dev/ URL (with a warning), while preserving config-derived URL behavior when config is available.

Changes:

  • Add fallback behavior and warning output when remote app config can’t be loaded, and ignore mismatched local config when -a selects a different app.
  • Refactor URL-opening logic into a shared helper to consistently apply relative-URI handling.
  • Add focused unit tests covering fallback, warning output, relative URI parsing, local/remote config paths, and no-public-service behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/command/apps/open.go Adds config-load fallback to default app hostname, ignores mismatched local config, and centralizes URL opening/relative-URI handling.
internal/command/apps/open_test.go Adds targeted tests validating fallback behavior, warning output, relative URI handling, and local vs remote config selection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tomr-a5 tomr-a5 merged commit cc51c22 into master Jul 9, 2026
29 checks passed
@tomr-a5 tomr-a5 deleted the tom/flyctl-4215-apps-open-app-flag branch July 9, 2026 20:12
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.

fly apps open does not load -a flag

3 participants