Skip to content

Conversation

@ela-kotulska-frequenz
Copy link
Contributor

Previously, a strict tree (connected acyclic undirected graph) structure was required, but now components can exist without being connected to anything.

Previously, a strict tree (connected acyclic undirected graph)
structure was required, but now components can exist without
being connected to anything.

Signed-off-by: Elzbieta Kotulska <[email protected]>
@ela-kotulska-frequenz ela-kotulska-frequenz added the type:bug Something isn't working label Apr 30, 2025
@ela-kotulska-frequenz ela-kotulska-frequenz self-assigned this Apr 30, 2025
@Copilot Copilot AI review requested due to automatic review settings April 30, 2025 13:43
@ela-kotulska-frequenz ela-kotulska-frequenz requested a review from a team as a code owner April 30, 2025 13:43
@github-actions github-actions bot added part:docs Affects the documentation part:microgrid Affects the interactions with the microgrid labels Apr 30, 2025
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 updates the component graph validation to allow dangling components by modifying the error handling for unconnected components and adjusting error messages.

  • Update error message for cycle detection to more clearly indicate the presence of cycles.
  • Replace the exception for unconnected components with a logging warning to support dangling components.
  • Update release notes to reflect the changes.

Reviewed Changes

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

File Description
src/frequenz/sdk/microgrid/component_graph.py Modified validation logic to allow dangling components by logging warnings instead of raising errors, and updated error messages.
RELEASE_NOTES.md Updated release notes to include the change in component graph validation.
Comments suppressed due to low confidence (1)

src/frequenz/sdk/microgrid/component_graph.py:919

  • Fix the grammatical error by changing 'a least one connection' to 'at least one connection'.
raise InvalidGraphError("Graph must have a least one connection!")

raise InvalidGraphError("Graph must have a least one component!")
if sum(1 for _ in self.connections()) <= 0:
raise InvalidGraphError("Graph must have a least one connection!")

Copy link

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding a comment explaining why unconnected components now only trigger a warning rather than an exception, to clarify that dangling components are allowed.

Suggested change
# Allow dangling components (components with no connections) in the graph.
# These components are ignored during validation but logged as warnings
# to inform the user. This behavior is intentional to support use cases
# where some components might not be connected but are still part of the
# microgrid configuration.

Copilot uses AI. Check for mistakes.
@github-project-automation github-project-automation bot moved this from To do to Done in Python SDK Roadmap Apr 30, 2025
@ela-kotulska-frequenz ela-kotulska-frequenz deleted the dangling_component branch June 11, 2025 11:01
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:microgrid Affects the interactions with the microgrid type:bug Something isn't working

Projects

Development

Successfully merging this pull request may close these issues.

1 participant