Skip to content

EEBus: drop redundant Scenario middle word from constant names#29704

Merged
andig merged 1 commit intomasterfrom
refactor/eebus-scenario-constants-naming
May 6, 2026
Merged

EEBus: drop redundant Scenario middle word from constant names#29704
andig merged 1 commit intomasterfrom
refactor/eebus-scenario-constants-naming

Conversation

@andig
Copy link
Copy Markdown
Member

@andig andig commented May 6, 2026

Summary

Follow-up to #29701. Constant names like MGCPScenarioPower and EVCEMScenarioPowerPerPhase repeat the word Scenario even though every constant in this package is a scenario number. Drop the middle word so call sites read more naturally:

  • eebus.MGCPScenarioPowereebus.MGCPPower
  • eebus.MPCScenarioCurrentPerPhaseeebus.MPCCurrentPerPhase
  • eebus.LPCScenarioLimiteebus.LPCLimit
  • eebus.EVCEMScenarioPowerPerPhaseeebus.EVCEMPowerPerPhase
  • …etc for LPP, OPEV, OSCEV, EVSOC

The use-case prefix (MGCP, MPC, LPC, LPP, OPEV, OSCEV, EVCEM, EVSOC) keeps the namespace clear; the trailing word names the quantity. Scenario adds nothing because the type and the comment already say so.

No behavior change.

Test plan

  • go build ./charger/... ./meter/... ./server/eebus/... passes
  • go test ./charger/... ./meter/... ./server/eebus/... passes
  • gofmt -l clean

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • These renames change exported identifiers; if this package is consumed externally you may want to keep the old *Scenario* constants as deprecated aliases for a release cycle to avoid breaking downstream users.
  • Since all of these values represent scenario IDs, consider defining a dedicated type Scenario uint (or similar) and using it for the constants and relevant function signatures to improve type safety and self-documentation.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- These renames change exported identifiers; if this package is consumed externally you may want to keep the old `*Scenario*` constants as deprecated aliases for a release cycle to avoid breaking downstream users.
- Since all of these values represent scenario IDs, consider defining a dedicated `type Scenario uint` (or similar) and using it for the constants and relevant function signatures to improve type safety and self-documentation.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@andig andig merged commit 2a49668 into master May 6, 2026
13 checks passed
@andig andig deleted the refactor/eebus-scenario-constants-naming branch May 6, 2026 13:20
@andig andig added enhancement New feature or request labels May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant