Skip to content

feat(framework): Mention superlink to login against upon an authentication error - #7698

Draft
jafermarq wants to merge 3 commits into
mainfrom
improve-auth-cli-error-ux
Draft

feat(framework): Mention superlink to login against upon an authentication error#7698
jafermarq wants to merge 3 commits into
mainfrom
improve-auth-cli-error-ux

Conversation

@jafermarq

@jafermarq jafermarq commented Jul 28, 2026

Copy link
Copy Markdown
Member

Before it response said plainly "do flwr login" w/o specifying the SuperLinkConnection name:

uv run --python=3.11.14 --all-extras --all-groups flwr ls supergrid
Using SuperLink: supergrid (supergrid.flower.ai)
📄 Listing all runs...
╭─ Error ──────────────────────────────────────────────────────────────────────────────────────╮
│ Authentication failed. Please run `flwr login` to authenticate and try again.                │
╰──────────────────────────────────────────────────────────────────────────────────────────────╯

Now, it indicates which one to use (based on the command that triggered it: in this example flwr ls):

uv run --python=3.11.14 --all-extras --all-groups flwr ls supergrid
Using SuperLink: supergrid (supergrid.flower.ai)
📄 Listing all runs...
╭─ Error ──────────────────────────────────────────────────────────────────────────────────────╮
│ Authentication failed. Please run `flwr login supergrid` to authenticate and try again.      │
╰──────────────────────────────────────────────────────────────────────────────────────────────╯

Copilot AI review requested due to automatic review settings July 28, 2026 11:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the CLI UX for authentication failures by suggesting the specific SuperLink connection name to pass to flwr login, based on the command context (e.g., flwr ls supergridflwr login supergrid).

Changes:

  • Update flwr_cli_grpc_exc_handler to include the relevant SuperLink name in UNAUTHENTICATED error guidance.
  • Add a unit test to ensure the suggested login command includes the connection name.

Critical issues

  • The new use of click.get_current_context() in the gRPC exception handler can raise RuntimeError if the handler is executed outside an active Click/Typer context, masking the original UNAUTHENTICATED error. Additionally, calling read_superlink_connection() in the error handler can raise ClickException (e.g., missing default config), replacing the intended authentication guidance.

Simplicity/readability suggestions

  • None beyond addressing the critical issue above.

Consistency concerns

  • None identified.

Whether the PR should be split

  • No.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
framework/py/flwr/cli/utils.py Include SuperLink connection name in the UNAUTHENTICATED login suggestion.
framework/py/flwr/cli/utils_test.py Add coverage for UNAUTHENTICATED gRPC error messaging including connection name.

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

Comment thread framework/py/flwr/cli/utils.py Outdated
@jafermarq jafermarq changed the title feat(framework): Mention superlink to login against upon authentication error feat(framework): Mention superlink to login against upon an authentication error Jul 28, 2026
dstripelis
dstripelis previously approved these changes Jul 28, 2026
@jafermarq
jafermarq marked this pull request as draft July 28, 2026 11:54
@github-actions github-actions Bot added the Maintainer Used to determine what PRs (mainly) come from Flower maintainers. label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintainer Used to determine what PRs (mainly) come from Flower maintainers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants