Change ElectricalComponentId from CID to ECID - #289
Merged
llucax merged 2 commits intoSep 22, 2026
Merged
Conversation
llucax
marked this pull request as draft
September 21, 2026 12:57
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation, tests, documentation, and release notes consistently apply the collision-free prefix.
Review effort: Balanced
Findings: None
What changed in this PR
Updates ElectricalComponentId to use the distinct ECID display prefix, eliminating conflicts with deprecated ComponentId.
Changes:
- Changes the prefix from
CIDtoECID. - Updates string-representation and import-order tests.
- Documents the user-visible compatibility impact.
| File | Description |
|---|---|
src/.../_ids.py |
Defines the new ECID prefix. |
tests/microgrid/test_ids.py |
Tests prefix uniqueness and warning removal. |
tests/.../test_problematic.py |
Updates component string expectations. |
tests/.../test_problematic_connection.py |
Updates connection string expectations. |
tests/.../test_inverter.py |
Updates inverter string expectation. |
tests/.../test_ev_charger.py |
Updates charger string expectation. |
tests/.../test_electrical_component_connection.py |
Updates connection string expectation. |
tests/.../test_electrical_component_base.py |
Updates base component expectations. |
tests/.../test_battery.py |
Updates battery string expectation. |
RELEASE_NOTES.md |
Explains the display-only compatibility change. |
docs/user-guide/typed-ids.md |
Documents the ECID prefix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
`ComponentId` (the deprecated v0.3.x compatibility class restored in frequenz-floss#287) and `ElectricalComponentId` both claimed the `str_prefix` "CID". Importing both triggered a `"Prefix 'CID' is already registered"` warning from `frequenz-core`'s `BaseId`, and two objects with the same numeric value would print identically (`CID42`) while comparing unequal and hashing differently, a subtle correctness hazard. The deprecated `ComponentId` keeps `CID` because that is its historical representation and changing it would defeat the compatibility it exists for. `ElectricalComponentId` moves to `ECID`. The prefix is output-only: `BaseId` uses it in `__str__` and the `str_prefix` property only. There is no parse-from-string path in `BaseId`, and IDs cross the wire as plain integers. This cannot break round-tripping, persistence or the protocol. The import-order test that previously asserted the duplicate prefix warning is updated to assert the warning is gone. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
llucax
force-pushed
the
electrical-component-id-prefix
branch
from
September 21, 2026 13:26
6b907b9 to
ae3ecca
Compare
ElectricalComponentId from CID to ECID
llucax
marked this pull request as ready for review
September 21, 2026 13:28
llucax
enabled auto-merge
September 21, 2026 13:28
llucax
disabled auto-merge
September 22, 2026 08:23
Marenz
approved these changes
Sep 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a long due update. It is hard because we've been using CID for a while now, but it is right because we now have electrical components and communication components, so CID is ambiguous.