Skip to content

Value-raw not honored for the single-sourced DIN energy-transfer field #76

Description

@JakeMG-INL

Problem

SimEVSEController.get_supported_energy_transfer_modes (app/secc/controller/simulator.py) single-sources the DIN energy-transfer mode from the message field tree (ADR-0006, #72). When the tree leaf fails EnergyTransferModeEnum(...) coercion it returns the raw value with this inline promise:

honor an illegal-but-encodable value as authored (red-team probing)

But the value then flows into ChargeService(energy_transfer_type=energy_mode) (app/secc/states/din_spec_states.py:~242) through the plain Pydantic constructor, which rejects the non-enum value with a ValidationError — aborting the SECC at ServiceDiscovery instead of advertising the crafted value. The ADR-0006 "lax build" seam (_lax_set in message_field_tree.py) that would honor value-raw emission is bypassed on this single-sourced path.

So the comment oversells: for this field the raw branch cannot deliver an illegal value on the wire, and a plausible authoring slip — using the enum name DC_EXTENDED instead of the value DC_extended — turns into a crash rather than a clean failure.

Impact

  • No regression and no shipped personality is affected: normal in-enum values (DC_extended, DC_core) work, verified by the full suite (815 passed) and the live virtual demo.
  • Only triggered by a hand-authored illegal/mis-spelled ServiceDiscoveryRes → ChargeService → EnergyTransferType leaf.

Options to consider

  • Route the single-sourced read through the same value-raw/lax-build path the tree application uses, so advertised == accepted holds even for illegal-but-encodable values (true to ADR-0006's value-raw intent).
  • Or, if value-raw on enum-typed wire fields is out of scope, correct the comment and fail loudly at load time with a clear message.

Surfaced during the /audit-issue review of #72.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions