Skip to content

Conversation

@florian-wagner-frequenz
Copy link
Contributor

@florian-wagner-frequenz florian-wagner-frequenz commented May 22, 2025

This adds the capability for HMAC based signing into the reporting client.

@github-actions github-actions bot added the part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) label May 22, 2025
@florian-wagner-frequenz florian-wagner-frequenz force-pushed the hmac_signing branch 2 times, most recently from 1ecb907 to 67fc1d5 Compare May 23, 2025 09:19
@github-actions github-actions bot added the part:docs Affects the documentation label May 23, 2025
@github-actions github-actions bot added the part:tests Affects the unit, integration and performance (benchmarks) tests label May 23, 2025
@florian-wagner-frequenz florian-wagner-frequenz marked this pull request as ready for review May 23, 2025 11:01
@Copilot Copilot AI review requested due to automatic review settings May 23, 2025 11:01
Copilot

This comment was marked as outdated.

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 HMAC signing capabilities to the Reporting client.

  • Introduces a new parameter "sign_secret" in ReportingApiClient and updates its initialization.
  • Adds a new CLI option "--sign_secret" to enable HMAC support via the command line.
  • Updates tests and dependency versions to support the new HMAC functionality.

Reviewed Changes

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

Show a summary per file
File Description
tests/test_client_reporting.py Adds "sign_secret" test parameter and verifies its propagation to the base class.
src/frequenz/client/reporting/cli/main.py Introduces the CLI option "--sign_secret" for HMAC signing.
src/frequenz/client/reporting/_client.py Updates ReportingApiClient to accept and pass "sign_secret" to BaseApiClient.
pyproject.toml Updates dependency version of frequenz-client-base.
RELEASE_NOTES.md Adds new release note entries for the HMAC generation capabilities.
Comments suppressed due to low confidence (1)

RELEASE_NOTES.md:13

  • The release notes currently reference the 'key' argument for HMAC functionality; please update them to correctly mention the new '--sign_secret' CLI option and the 'sign_secret' parameter used for HMAC signing.
* Add HMAC generation capabilities.

class ReportingApiClient(BaseApiClient[ReportingStub]):
"""A client for the Reporting service."""

# pylint: disable=too-many-arguments, too-many-positional-arguments
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use disable= in its own line, that will disable the check for the rest of the file, not only for the next line, if you want to disable it only for the next line you need to use disable-next=.

Suggested change
# pylint: disable=too-many-arguments, too-many-positional-arguments
# pylint: disable-next=too-many-arguments, too-many-positional-arguments

Also I think in this case pylint has a point, and you should use positional-only arguments, specially for strings/bool that are really hard to read without a keyword on the call site.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, me being to meek about breaking the interface, but I am already doing it anyways.

Copy link
Contributor

Choose a reason for hiding this comment

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

We are at 0.x, so...

BREAK ALL THE THINGS!

We support two versions of protobuf-gencode. However, automated warnings
treated as errors will prevent the package from building correctly with
the newer version due to version mismatch.

Signed-off-by: Florian Wagner <[email protected]>
llucax
llucax previously approved these changes Jun 13, 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.

Approving as the key rename is really not related to this PR, so it can be done in a separate PR.

This adds the capability for HMAC based signing into the reporting
client. This also removes the need for ad-hoc api key management, as the
underlying `BaseApiClient` will automatically create an interceptor to
inject the key as metadata.

Signed-off-by: Florian Wagner <[email protected]>
@florian-wagner-frequenz florian-wagner-frequenz added this pull request to the merge queue Jun 13, 2025
Merged via the queue into frequenz-floss:v0.x.x with commit 8de3818 Jun 13, 2025
5 checks passed
@florian-wagner-frequenz florian-wagner-frequenz deleted the hmac_signing branch June 13, 2025 15:39
server_url: str,
key: str | None = None,
*,
auth_key: str | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please update the README w.r.t. these interface changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation 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.

3 participants