Skip to content

Conversation

@Marenz
Copy link
Contributor

@Marenz Marenz commented Jul 15, 2025

This PR adds support for request signing via an optional secret and propagates that change through tests, the client library, and the CLI.

Copilot AI review requested due to automatic review settings July 15, 2025 14:22
@Marenz Marenz requested review from a team as code owners July 15, 2025 14:22
@github-actions github-actions bot added part:docs Affects the documentation part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) part:cli Affects the command-line interface part:test-utils Affects the test utilities part:dispatcher labels Jul 15, 2025

This comment was marked as outdated.

@Marenz Marenz force-pushed the sign_here_please branch from 8e794f9 to dafa6ed Compare July 15, 2025 14:50
@github-actions github-actions bot added the part:tests Affects the unit, integration and performance (benchmarks) tests label Jul 15, 2025
@Marenz Marenz requested a review from Copilot July 15, 2025 14:50

This comment was marked as outdated.

@Marenz Marenz enabled auto-merge July 16, 2025 09:14
Copy link
Contributor

@llucax llucax left a comment

Choose a reason for hiding this comment

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

LGTM in general, but I have a few comments.

mkdocs.yml Outdated
show_signature_annotations: true
show_source: true
signature_crossrefs: true
members_order: source
Copy link
Contributor

Choose a reason for hiding this comment

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

I would leave thing the same as they are configured in other repos. I think making this inconsistent across repos will make the docs harder to navigate to users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(or it will make this one repo easier and every other stays harder to navigate :P )

Copy link
Contributor

Choose a reason for hiding this comment

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

For me the side bar is an index, and as an index it should be sorted alphabetically. If you want to sort things in a more organized way, it might be better to have an overview at the module/class documentation.

Comment on lines 181 to 183
"--secret",
help="API signing secret for authentication",
envvar="DISPATCH_API_SECRET",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"--secret",
help="API signing secret for authentication",
envvar="DISPATCH_API_SECRET",
"--sign-secret",
help="API secret for signing",
envvar="DISPATCH_API_SIGN_SECRET",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uh.. you wanna rename the env variable?
what about the API_KEY then? Consistently it should become DISPATCH_API_AUTH_KEY

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that would be the ideal IMHO. If it is too disruptive by now, I would accept both for a transitional period, but again, not sure how possible that is using click's built-in env var management.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, it's only used by ppl directly and it's very easy to adjust to it. I can make it print a warning or so if that var is set. It's not like an API. Just a TUI.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, yeah, not that disruptive. Sounds good to me!

@Marenz Marenz force-pushed the sign_here_please branch from dafa6ed to 66be679 Compare July 22, 2025 08:36
@Marenz Marenz requested review from Copilot and llucax July 22, 2025 08:40

This comment was marked as outdated.

Marenz added 3 commits July 22, 2025 15:38
Signed-off-by: Mathias L. Baumann <[email protected]>
Signed-off-by: Mathias L. Baumann <[email protected]>
Signed-off-by: Mathias L. Baumann <[email protected]>
@Marenz Marenz force-pushed the sign_here_please branch from 66be679 to e47cb6f Compare July 22, 2025 13:38
@Marenz Marenz requested a review from Copilot July 22, 2025 13:39
Copy link

Copilot AI left a comment

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 adds support for request signing via optional secrets by updating the authentication mechanism from a simple key-based system to support both auth keys and optional signing secrets. Key changes include:

  • Replaces key parameter with auth_key and adds optional sign_secret parameter throughout the codebase
  • Updates CLI to support both deprecated --api-key and new --auth-key/--sign-secret options with proper deprecation warnings
  • Removes authentication/access control logic from the fake test service

Reviewed Changes

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

Show a summary per file
File Description
tests/test_cli.py Updates test environment to use new auth key naming
src/frequenz/client/dispatch/test/client.py Updates FakeClient constructor to use new auth_key parameter
src/frequenz/client/dispatch/test/_service.py Removes authentication logic and metadata parameters from all service methods
src/frequenz/client/dispatch/_client.py Updates DispatchApiClient to accept auth_key and sign_secret, removes manual metadata handling
src/frequenz/client/dispatch/main.py Adds CLI support for new auth parameters with deprecation handling
pyproject.toml Updates frequenz-client-base dependency version requirement
RELEASE_NOTES.md Documents new secret signing feature
Comments suppressed due to low confidence (1)

src/frequenz/client/dispatch/test/client.py:27

  • The auth_key value "what" is unclear and non-descriptive. Consider using a more descriptive test value like "test_auth_key" or "mock_auth_key".
        super().__init__(server_url="mock", auth_key="what", connect=False)

@Marenz Marenz force-pushed the sign_here_please branch 2 times, most recently from fff264b to 4a3020c Compare July 22, 2025 14:01
llucax
llucax previously approved these changes Jul 22, 2025
Copy link
Contributor

@llucax llucax left a comment

Choose a reason for hiding this comment

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

LGTM, only one small suggestion.

"--key",
help="API key for authentication",
"--api-key",
help="API key for authentication (deprecated, use DISPATCH_API_AUTH_KEY)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, nice, maybe include --api-key too.

Suggested change
help="API key for authentication (deprecated, use DISPATCH_API_AUTH_KEY)",
help="API key for authentication (deprecated, use --auth-key or DISPATCH_API_AUTH_KEY instead)",

@Marenz Marenz added this pull request to the merge queue Jul 22, 2025
@llucax llucax removed this pull request from the merge queue due to a manual request Jul 22, 2025
@llucax
Copy link
Contributor

llucax commented Jul 22, 2025

Removed from the queue in case you want to address it.

@Marenz Marenz force-pushed the sign_here_please branch from 4a3020c to 833e531 Compare July 22, 2025 15:04
@Marenz Marenz merged commit 769f2bd into frequenz-floss:v0.x.x Jul 22, 2025
5 checks passed
@Marenz Marenz deleted the sign_here_please branch July 29, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:cli Affects the command-line interface part:dispatcher part:docs Affects the documentation part:test-utils Affects the test utilities part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants