Skip to content

[BUG] Preserve supervision URL normalization through UI dispatch #2173

Closed

Description

@jerome-benoit

Context

Follow-up to #2160. Global configuration loading retains the URL value parsed by Zod, but the HTTP/WebSocket UI gate validates and then dispatches the original payload.

Discarding parsed UI values predates #2160. This issue tracks the remaining cross-entry-point inconsistency, not a new UI regression attributed to that PR.

Current behavior

At main commit 862aa9d6202fb875ed6c54fcddf0f201be112f50, getRequestPayloadValidationError() returns validation success or an error, without forwarding the parsed URL.

Zod URL parsing trims Unicode whitespace such as NBSP (U+00A0) and EM SPACE (U+2003). JavaScript’s new URL() does not apply the same trimming.

Observed behavior:

  • A leading NBSP passes the UI schema gate, then the real station setter throws a contextual BaseError.
  • A trailing NBSP passes the gate and produces an endpoint containing /OCPP16%C2%A0/<stationId>.
  • The corresponding parsed configuration URL contains /OCPP16/<stationId>, without the encoded whitespace.
  • Real WebSocket server probes confirm the changed request path. EM SPACE exhibits the same discrepancy.

Expected behavior

An accepted supervision URL has the same normalized meaning when consumed through global configuration and UI dispatch.

Validation must not approve a transformed value and then consume a different raw value.

Reproduction

  1. Prepare a valid ws:// supervision URL.
  2. Prefix it with U+00A0 and submit it through setSupervisionUrl.url.
  3. Observe schema acceptance followed by failure in station URL parsing.
  4. Submit the URL with trailing U+00A0.
  5. Observe the encoded whitespace in the station’s derived connection URL.
  6. Supply the same value through parsed global configuration and compare the normalized endpoint.

Scope

Ensure normalized supervision URL fields reach their consumers after successful validation.

Cover setSupervisionUrl.url and addChargingStations.options.supervisionUrls, including arrays.

Preserve unrelated PDU fields and optional-field presence. Do not replace every payload indiscriminately with a parsed object.

Do not silently normalize raw OCPP ChangeConfiguration values; that path has separate persistence semantics.

Acceptance criteria

  • Cover leading and trailing NBSP and EM SPACE.
  • Validated and consumed URL values agree across global configuration and UI entry points.
  • Preserve existing ASCII whitespace normalization.
  • Preserve unrelated payload fields and the distinction between omitted and explicitly provided optional values.
  • Exercise both URL updates and station creation options.
  • Verify the endpoint received by a real local WebSocket server.

Evidence and limits

The real UI validation function and real station setter were exercised on Node 24.22.1. Additional TCP probes used Node 26.12.1, ws 8.22.0 and zod 4.6.7.

No complete authenticated UI network session was exercised.

Related: #2160, #2168. No duplicate open issue was identified during this review.

Activity

  1. added
    bug
    webui
    simulator
    on Oct 29, 2026
  2. jerome-benoit commented on Nov 4, 2026

    @jerome-benoit
    ContributorAuthor

    Fixed in #2181 (merged as 9ef343e on 2026-11-03): UI dispatch now overlays the schema-parsed, normalized supervision URL values onto the original payload, and the station routes every supervision URL through the shared SupervisionUrlSchema (Unicode whitespace trimming, scheme enforcement). Accepted and consumed values agree across global configuration and UI entry points.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsimulatorwebui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions