Skip to content

Conversation

@shsms
Copy link
Collaborator

@shsms shsms commented Nov 18, 2025

No description provided.

Add placeholder test until there are actual tests

Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
@shsms shsms requested a review from a team as a code owner November 18, 2025 15:14
@shsms shsms marked this pull request as draft November 18, 2025 15:14
@github-actions github-actions bot added part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) labels Nov 18, 2025
Copilot finished reviewing on behalf of shsms November 18, 2025 15:16
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 implements a ComponentGraphGenerator class that generates component graphs for microgrids using the Assets API. The implementation replaces template/boilerplate code with production functionality.

  • Adds ComponentGraphGenerator class for fetching and constructing microgrid component graphs from the Assets API
  • Removes template code (delete_me function) and adds real test coverage for formula generation
  • Adds git-based dependencies for frequenz-microgrid-component-graph and frequenz-client-assets

Reviewed Changes

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

File Description
src/frequenz/gridpool/_graph_generator.py New module implementing ComponentGraphGenerator class with graph generation logic
src/frequenz/gridpool/__init__.py Exports ComponentGraphGenerator and fixes docstring typo
tests/test_gridpool.py Replaces template tests with actual test for formula generation using mocked Assets API
pyproject.toml Adds git-based dependencies and removes TODO comments
Comments suppressed due to low confidence (1)

tests/test_gridpool.py:6

  • Import of 'asyncio' is not used.
import asyncio

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

For example: `grpc://localhost:1090?ssl=true`.
auth_key: The authentication key to use for the connection.
sign_secret: The secret to use for signing requests.
channel_defaults: The default options use to create the channel when not
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

Corrected 'use' to 'used' in the documentation.

Suggested change
channel_defaults: The default options use to create the channel when not
channel_defaults: The default options used to create the channel when not

Copilot uses AI. Check for mistakes.
with pytest.raises(RuntimeError, match="This function should be removed!"):
delete_me(blow_up=True)
async def test_formula_generation() -> None:
"""Test that the frequenz.gridpool package loads correctly."""
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

The docstring is misleading. This test validates formula generation from component graphs, not package loading. Consider updating to: 'Test formula generation from component graph.'

Suggested change
"""Test that the frequenz.gridpool package loads correctly."""
"""Test formula generation from component graph."""

Copilot uses AI. Check for mistakes.
dependencies = [
"typing-extensions >= 4.14.1, < 5",
"frequenz-microgrid-component-graph @ git+https://github.com/shsms/frequenz-microgrid-component-graph-python.git@c4a458e06e541846de0a25142d5b821dd7934f47",
"frequenz-client-assets @ git+https://github.com/shsms/frequenz-client-assets-python@bbf09104df24ddfac497e2a3dd66fe68cfdacd25"
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing trailing comma after the last dependency. For consistency and easier future modifications, add a trailing comma.

Suggested change
"frequenz-client-assets @ git+https://github.com/shsms/frequenz-client-assets-python@bbf09104df24ddfac497e2a3dd66fe68cfdacd25"
"frequenz-client-assets @ git+https://github.com/shsms/frequenz-client-assets-python@bbf09104df24ddfac497e2a3dd66fe68cfdacd25",

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +85
if any(c is None for c in connections):
raise ValueError("Failed to load all electrical component connections.")

Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

The None check at line 83 is unnecessary since the type hint indicates list_microgrid_electrical_component_connections returns a list of connections, not optional connections. If None values are genuinely possible, the type hints should reflect this. Consider removing this check or updating the type hints for clarity.

Suggested change
if any(c is None for c in connections):
raise ValueError("Failed to load all electrical component connections.")

Copilot uses AI. Check for mistakes.
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Copy link
Collaborator

@cwasicki cwasicki left a comment

Choose a reason for hiding this comment

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

Looks good!

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

Labels

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