]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/log
e-mobility-charging-stations-simulator.git
17 hours agochore(deps): update dependency typescript to v6 (#1750)
renovate[bot] [Wed, 25 Mar 2026 18:59:13 +0000 (19:59 +0100)] 
chore(deps): update dependency typescript to v6 (#1750)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
17 hours agofix(webui): add table-layout fixed to connectors table to prevent overflow on action...
Jérôme Benoit [Wed, 25 Mar 2026 18:56:25 +0000 (19:56 +0100)] 
fix(webui): add table-layout fixed to connectors table to prevent overflow on action panel open

17 hours agofeat: add connector cable retention lock/unlock simulation (#1754)
Jérôme Benoit [Wed, 25 Mar 2026 18:20:36 +0000 (19:20 +0100)] 
feat: add connector cable retention lock/unlock simulation (#1754)

* feat(types): add connector lock simulation types and UI protocol enums

* feat(core): add connector lock/unlock simulation methods

* feat(ocpp): set lock state on UnlockConnector command for both OCPP stacks

* feat(ui-server): add lock/unlock broadcast channel commands and MCP schemas

* feat(ui): add lock/unlock buttons to web UI

* test: add connector lock/unlock simulation tests

* docs: add connector lock/unlock simulation documentation

* feat(ocpp): auto-lock connector on transaction start, auto-unlock on normal termination

* fix(ui): reorder Locked column before Transaction in connector table

* fix: guard lock unlock on accepted stop, emit updated event, add null status warnings, fix resetConnectorStatus test

* [autofix.ci] apply automated fixes

* fix(ocpp): only auto-lock connector on accepted transaction start in OCPP 2.0.1

* fix(core): emit connectorStatusChanged instead of updated on lock state change

* test: add idempotency tests for lockConnector and unlockConnector

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
22 hours agofix(deps): update all non-major dependencies (#1753)
renovate[bot] [Wed, 25 Mar 2026 13:51:33 +0000 (14:51 +0100)] 
fix(deps): update all non-major dependencies (#1753)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
24 hours agofeat(ocpp-server): enhance OCPP 2.0.1 mock server for comprehensive E2E testing ...
Jérôme Benoit [Wed, 25 Mar 2026 11:38:55 +0000 (12:38 +0100)] 
feat(ocpp-server): enhance OCPP 2.0.1 mock server for comprehensive E2E testing (#1752)

* feat(ocpp-server): add boot status sequence for Pending→Accepted transition testing

* feat(ocpp-server): add configurable TriggerMessage type

* feat(ocpp-server): add configurable Reset type and ChangeAvailability status

* feat(ocpp-server): add command sequencing for multi-step CSMS workflows

* feat(ocpp-server): add groupIdToken and cacheExpiry to Authorize response

* feat(ocpp-server): add multi-variable SetVariables/GetVariables CLI support

* fix(ocpp-server): share boot_index across reconnections so sequence advances correctly

* fix(ocpp-server): schedule send_commands as background task so it runs after cp.start()

* fix(ocpp-server): correct CLI help text casing and validate boot-status-sequence

* chore: remove E2E test plan from PR branch

* refactor(ocpp-server): fix misplaced tests and harmonize style

* docs(ocpp-server): document all new CLI flags and transaction tracking

* fix(ocpp-server): harden input validation and connection cleanup

* fix(ocpp-server): clean up auth-mode choices and CLI edge cases

* fix(ocpp-server): validate cache-expiry, skip trailing commas, document yield semantics

* fix(ocpp-server): harmonize empty-entry handling and wrap CLI parsers in error handler

38 hours agorefactor: use try/catch instead of .catch() for stopMessageSequence error handling
Jérôme Benoit [Tue, 24 Mar 2026 21:21:21 +0000 (22:21 +0100)] 
refactor: use try/catch instead of .catch() for stopMessageSequence error handling

40 hours agofix: add OCPP 2.0 DataTransfer outgoing support and B03 boot retry in Rejected state
Jérôme Benoit [Tue, 24 Mar 2026 19:40:46 +0000 (20:40 +0100)] 
fix: add OCPP 2.0 DataTransfer outgoing support and B03 boot retry in Rejected state

Add DATA_TRANSFER to OCPP20RequestCommand enum, buildRequestPayload
passthrough, schema registration, and response handler (P02.FR.02).

Allow BootNotification retry when station is in Rejected state by
adding inRejectedState() to the internalSendMessage gate (B03.FR.06).

Fix mock server: use OCPPCommCtrlr component for HeartbeatInterval
in SetVariables, add customerIdentifier in CustomerInformation.

Add unit tests for promiseWithTimeout and DataTransfer outgoing.

41 hours agofix: prevent shutdown timeout with promiseWithTimeout helper
Jérôme Benoit [Tue, 24 Mar 2026 18:08:34 +0000 (19:08 +0100)] 
fix: prevent shutdown timeout with promiseWithTimeout helper

Extract a shared promiseWithTimeout<T>() utility from 3 divergent
Promise.race+timeout implementations. Use it in ChargingStation.stop()
to cap stopMessageSequence at 30s so the stopped event is always
emitted even when the OCPP server is unreachable, preventing the
60s Bootstrap shutdown timeout.

Also fix mock server SecurityEventNotification handler parameter name
and add OCPP 2.0.1 E2E test plan.

42 hours agodocs: fix inaccurate @returns in getChargingProfilesLimit
Jérôme Benoit [Tue, 24 Mar 2026 17:01:10 +0000 (18:01 +0100)] 
docs: fix inaccurate @returns in getChargingProfilesLimit

Return type can be undefined but JSDoc only documented the non-null case.

43 hours agodocs: harmonize JSDoc @param/@returns across entire codebase
Jérôme Benoit [Tue, 24 Mar 2026 16:54:43 +0000 (17:54 +0100)] 
docs: harmonize JSDoc @param/@returns across entire codebase

- Add missing dash separator to @param tags in OCPP20VariableRegistry
  and OCPPServiceUtils (35 occurrences)
- Fill empty @param descriptions in Helpers, IdTagsCache,
  OCPPRequestService, and Worker modules (23 occurrences)
- Replace type-only @returns with meaningful descriptions

43 hours agodocs: add JSDoc to ChargingStation public API methods
Jérôme Benoit [Tue, 24 Mar 2026 16:45:25 +0000 (17:45 +0100)] 
docs: add JSDoc to ChargingStation public API methods

Add concise JSDoc with @param and @returns tags to 29 public methods
following the project's established pattern (param - description).
Resolves all 45 jsdoc/require-param and jsdoc/require-returns warnings.

43 hours agorefactor: eliminate remaining non-null assertions in ChargingStation and OCPP16Servic...
Jérôme Benoit [Tue, 24 Mar 2026 16:26:31 +0000 (17:26 +0100)] 
refactor: eliminate remaining non-null assertions in ChargingStation and OCPP16ServiceUtils

- ChargingStation: replace 8 non-null assertions with optional chaining,
  nullish coalescing defaults, and null guards
- OCPP16ServiceUtils: add type narrowing guards for composite charging
  schedules, extract connector status variables with null checks,
  replace all 14 non-null assertions with safe access patterns

Zero non-null assertions remain across the entire src/ directory.

43 hours agorefactor: eliminate non-null assertions in 8 files (31 of 53 total)
Jérôme Benoit [Tue, 24 Mar 2026 16:19:37 +0000 (17:19 +0100)] 
refactor: eliminate non-null assertions in 8 files (31 of 53 total)

- AutomaticTransactionGenerator: extract connector status variables with
  null guards, use optional chaining for stationInfo and ATG config
- ChargingStation: replace stationInfo! with null guards and ?./?? defaults
- Helpers: replace stationInfo!.maximumPower! with ?./?? defaults
- IdTagsCache: replace stationInfo!.hashId with optional chaining
- ChargingStationWorkerBroadcastChannel: replace stationInfo!.hashId
- OCPP16IncomingRequestService: wrap firmware/diagnostics status in
  null guards, replace resetTime!/configurationKey! with safe access
- UIServerFactory: replace options!.host! with optional chaining
- Configuration: replace getConfigurationData()! with null guards

45 hours agorefactor: audit-driven improvements — use BaseError, fix barrel bypass, remove redund...
Jérôme Benoit [Tue, 24 Mar 2026 14:51:21 +0000 (15:51 +0100)] 
refactor: audit-driven improvements — use BaseError, fix barrel bypass, remove redundant console

- Replace throw new Error with BaseError in OCPP20CertificateManager and
  OCPP20VariableManager (3 occurrences)
- Move getMessageTypeString from OCPPServiceUtils to Helpers, resolving
  the barrel bypass in ErrorUtils — consumers import via charging-station
  barrel, tests moved to Helpers.test.ts
- Remove redundant console.warn in Helpers (logger.warn already called)
- Remove unused chalk import from Helpers

46 hours agorefactor: audit-driven quick wins — fix assert.ok misuse, naming conventions, and...
Jérôme Benoit [Tue, 24 Mar 2026 13:46:17 +0000 (14:46 +0100)] 
refactor: audit-driven quick wins — fix assert.ok misuse, naming conventions, and hardcoded defaults

- Replace 71 improper assert.ok(comparison) with assert.strictEqual/notStrictEqual
  in 10 test files per TEST_STYLE_GUIDE (assert.ok for boolean/existence only)
- Rename lastUpdated → lastUpdatedDate in auth interfaces and strategies
  to follow Date suffix naming convention
- Extract hardcoded 'ws://localhost' to OCPP20Constants.DEFAULT_CONNECTION_URL
- Replace setTimeout(resolve, 50) with proper httpServer.close() await
  in UIMCPServer integration test

2 days agofix(webui): remove deprecated baseUrl for TypeScript 6 compatibility
Jérôme Benoit [Tue, 24 Mar 2026 11:47:53 +0000 (12:47 +0100)] 
fix(webui): remove deprecated baseUrl for TypeScript 6 compatibility

TS6 deprecated baseUrl (TS5101). Since paths entries already use './'
prefix, they work standalone without baseUrl. Vite resolve.alias handles
runtime resolution independently.

2 days agorefactor(ocpp-server): audit-driven test improvements
Jérôme Benoit [Tue, 24 Mar 2026 11:20:08 +0000 (12:20 +0100)] 
refactor(ocpp-server): audit-driven test improvements

- Extract mock_valid_ws and rate_limit_charge_point fixtures (DRY)
- Replace inline blacklist AuthConfig with existing fixture
- Strengthen log assertions using caplog.records with level checks
- Add edge case tests: empty token in whitelist/blacklist modes
- Add test for unknown transaction event type (case _ branch)
Coverage: 90.18% → 90.98%, 159 → 162 tests.

2 days agorefactor(ocpp-server): harmonize shutdown tests with project conventions
Jérôme Benoit [Tue, 24 Mar 2026 11:07:03 +0000 (12:07 +0100)] 
refactor(ocpp-server): harmonize shutdown tests with project conventions

Move fixture near other fixtures, replace _patch_main tuple return with
contextmanager, parametrize SIGINT/SIGTERM, remove dead code helpers,
merge two test classes into one.

2 days agotest(ocpp-server): add graceful shutdown tests covering signal handling
Jérôme Benoit [Tue, 24 Mar 2026 11:03:17 +0000 (12:03 +0100)] 
test(ocpp-server): add graceful shutdown tests covering signal handling

Cover SIGINT/SIGTERM handlers, double-signal force quit, Windows
fallback via call_soon_threadsafe, and shutdown timeout warning.
Coverage: 80% → 90%.

2 days agofeat(ocpp-server): add graceful shutdown with signal handling
Jérôme Benoit [Tue, 24 Mar 2026 10:44:28 +0000 (11:44 +0100)] 
feat(ocpp-server): add graceful shutdown with signal handling

Handle SIGINT/SIGTERM for clean WebSocket close (code 1001) to all
connected charge points. Includes shutdown drain timeout, double-signal
force quit, and cross-platform Windows fallback via call_soon_threadsafe.

2 days agotest(mcp): add OCPP schema mapping consistency tests
Jérôme Benoit [Tue, 24 Mar 2026 01:21:55 +0000 (02:21 +0100)] 
test(mcp): add OCPP schema mapping consistency tests

Verify that every broadcast channel OCPP command has a corresponding
MCP tool schema and OCPP schema mapping entry. Ensures schema coverage
stays in sync with supported commands as a single source of truth guard.

2 days agochore: release main (#1748) v3.3
Jérôme Benoit [Tue, 24 Mar 2026 01:09:52 +0000 (02:09 +0100)] 
chore: release main (#1748)

* chore: release main

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2 days agofix(deps): update all non-major dependencies (#1749)
renovate[bot] [Tue, 24 Mar 2026 01:05:31 +0000 (02:05 +0100)] 
fix(deps): update all non-major dependencies (#1749)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2 days agorefactor(mcp): split MCP definitions by spec concern — Resources, Tools, ToolSchemas
Jérôme Benoit [Tue, 24 Mar 2026 00:58:12 +0000 (01:58 +0100)] 
refactor(mcp): split MCP definitions by spec concern — Resources, Tools, ToolSchemas

Rename MCPResourceHandlers.ts to MCPResources.ts (contains only MCP
Resources: station-list, station-by-id, template-list, OCPP schemas).

Extract log tools (readCombinedLog, readErrorLog) and their helpers
(getLogFilePath, tailFile) into MCPTools.ts (MCP Tools per spec).

MCPToolSchemas.ts unchanged (tool schema definitions).

Directory now reflects MCP spec separation of concerns:
- MCPResources.ts  — MCP Resources (spec §Resources)
- MCPTools.ts      — MCP Tools with custom logic (spec §Tools)
- MCPToolSchemas.ts — Tool schema definitions for OCPP commands

2 days agorefactor(broadcast-channel): extract response status registries from switch/case
Jérôme Benoit [Tue, 24 Mar 2026 00:43:04 +0000 (01:43 +0100)] 
refactor(broadcast-channel): extract response status registries from switch/case

Replace 11 repetitive switch/case blocks in commandResponseToResponseStatus
with two static registries:
- emptyResponseCommands: Set of commands where empty response = success
- acceptedStatusCommands: Map of commands to status check predicates

Custom cases (AUTHORIZE, START/STOP_TRANSACTION, HEARTBEAT,
TRANSACTION_EVENT) remain in switch for version-specific logic.

Adding a new command now requires 1 line in the registry instead of
a 5-line case block.

2 days agorefactor(broadcast-channel): extract passthrough() factory, remove 20 identical handlers
Jérôme Benoit [Tue, 24 Mar 2026 00:39:40 +0000 (01:39 +0100)] 
refactor(broadcast-channel): extract passthrough() factory, remove 20 identical handlers

Replace 20 identical BroadcastChannel handler methods (handleAuthorize,
handleDataTransfer, handleHeartbeat, handleStatusNotification, etc.)
with a single passthrough(RequestCommand) factory method that creates
a CommandHandler forwarding the request payload to requestHandler.

Retain only handlers with custom logic: handleBootNotification (merges
bootNotificationRequest), handleMeterValues (version-specific meter
value building), handleStopTransaction (adds meterStop).

Net reduction: -208 lines.

2 days agorefactor(ocpp): extract buildEmptyMeterValue helper for empty MeterValue construction
Jérôme Benoit [Tue, 24 Mar 2026 00:16:06 +0000 (01:16 +0100)] 
refactor(ocpp): extract buildEmptyMeterValue helper for empty MeterValue construction

Replace 4 inline { sampledValue: [], timestamp: new Date() } constructions
with buildEmptyMeterValue() helper in OCPPServiceUtils and OCPP16ServiceUtils.

2 days agofeat(ui-server): add MCP transport and deprecate HTTP (#1746)
Jérôme Benoit [Mon, 23 Mar 2026 23:59:59 +0000 (00:59 +0100)] 
feat(ui-server): add MCP transport and deprecate HTTP (#1746)

* feat(types): add MCP application protocol type

* chore(deps): add @modelcontextprotocol/sdk and zod

* refactor(ui-server): deprecate UIHttpServer in favor of MCP transport

* feat(ui-server): add MCP tool zod schemas for all procedures

* feat(ui-server): add UIMCPServer transport and MCP resource handlers

* feat(ui-server): integrate UIMCPServer into UIServerFactory

* test(ui-server): add MCP factory integration tests

* test(ui-server): add UIMCPServer unit tests

* test(ui-server): add MCP endpoint integration tests and fix lint

* refactor(ui-server): extract HttpMethod enum to shared UIServerUtils

* docs: restructure UI Protocol section — MCP first, remove redundant API listing

* fix(ui-server): address PR review — security hardening and schema corrections

- Send 404 + destroy for non-/mcp requests instead of hanging socket
- Add rate limiting (429) matching UIHttpServer behavior
- Add body size limit (createBodySizeLimiter) to prevent DoS
- Register res.on('close') before handleRequest to prevent race
- Return 400 for JSON parse errors, 500 for server errors
- Fix setSupervisionUrl schema: supervisionUrl → url
- Fix stopTransaction schema: transactionIds string[] → transactionId number

* refactor(tests): use HttpMethod enum instead of string literals

* docs: remove redundant MCP discoverability statement

* docs: restructure MCP section for agent config, update uiServer type in config table

* feat(ui-server): log deprecation warning when HTTP transport is used

* fix(ui-server): harmonize log levels and message patterns with existing transports

* test(ui-server): align MCP tests with style guide

- Use createLoggerMocks() for log assertions instead of trivial checks
- Add server.stop() to factory fallback tests to prevent resource leaks
- Replace fragile globalThis.clearTimeout override with t.mock.method

* docs: restore PDU acronym definition in WebSocket Protocol section

* fix(ui-server): use UI protocol version for MCP server version

* fix(ui-server): derive log file paths from Configuration instead of hardcoding

* perf(ui-server): tail-read log files instead of loading entire file into memory

* refactor(ui-server): convert log resources to tools with tail parameter

Follow MCP best practices: resources are for static snapshots,
tools are for parameterized on-demand data.

- Replace log://combined and log://error resources with
  readCombinedLog and readErrorLog tools
- Add tail parameter (default 200, max 5000) following the
  filesystem server head/tail pattern
- Add readOnlyHint annotation per MCP tool spec
- Return totalLines metadata in response for context
- Keep station and template resources (small, static data)

* feat(ui-server): expose OCPP JSON schemas as MCP resource templates

Add schema://ocpp/{version} listing and schema://ocpp/{version}/{command}
resource templates that serve the existing JSON schema files from
src/assets/json-schemas/ocpp/ on demand.

LLM agents can discover available OCPP commands per version and read
the full JSON schema for any command without bloating tools/list.
Schemas are read from disk on demand — no memory duplication with
the AJV validators already loaded by OCPP services.

* feat(ui-server): add version-aware OCPP tool schemas with JSON Schema injection

- Add ocppSchemaMapping linking ProcedureName to JSON Schema files
- 16 OCPP tools now have ocpp16Payload/ocpp20Payload fields with
  version affinity in descriptions
- Intercept tools/list to inject full JSON Schemas from disk
  into inputSchema.properties (no Zod duplication, DRY)
- Add payload flattening: extract versioned payload, spread flat
- Add mutual exclusivity: reject if both payloads provided
- Add pre-flight version check: clear error on version mismatch
- Runtime guard: graceful fallback if SDK internal API changes

* refactor(ui-server): use OCPPVersion enum instead of string literals

* refactor(ui-server): improve MCP code elegance and project rule compliance

- Replace as-unknown-as cast with Reflect.get() for SDK handler access
- Replace generic Error with BaseError in stop/readRequestBody
- Extract createToolErrorResponse/createToolResponse static helpers (DRY)
- Extract closeTransportSafely for duplicate transport cleanup
- Extract registerLogReadTool factory for duplicate log tools (DRY)
- Remove unnecessary String() conversions in resource handlers

* fix(ui-server): fix body size double-counting and schema resource path

- readRequestBody: pass chunk.length (not accumulated total) to
  createBodySizeLimiter — matches UIHttpServer pattern
- getSchemaBaseDir: use correct relative path instead of broken
  resolve().includes('assets') condition (always true)

* refactor(ui-server): consolidate version fallback guards and clarify README version docs

* fix(ui-server): harden MCP schema resources against path traversal and fix transport leak

- Add path traversal guard in schema resource handlers to validate resolved
  paths stay within the OCPP schema base directory
- Close MCP transport on 405 Method Not Allowed responses to prevent leak
- Fix log file path to use direct path when rotation is disabled
- Fix misleading Heartbeat tool description that referenced unsupported
  ocpp payload fields

* fix(ui-server): address remaining review findings and lint warnings

- Reorder stop() to delete-before-reject preventing re-entrant issues
- Use ephemeral port in integration test instead of fixed port 18999
- Document synchronous authenticate() assumption and SDK pattern deviation
- Add 'modelcontextprotocol' to cspell wordlist
- Convert JSDoc to inline comment to fix jsdoc lint warnings

* fix(ui-server): exact MCP path match, pin SDK version, log schema injection

- Use exact pathname match (url.pathname !== '/mcp') instead of
  startsWith to prevent unintended paths from reaching the MCP handler
- Pin @modelcontextprotocol/sdk to ~1.27.1 (patch-only) since the
  OCPP schema injection relies on SDK internals pinned to 1.27.x
- Add startup log confirming successful OCPP JSON schema injection

* test(ui-server): add comprehensive UIMCPServer unit tests

Cover private method logic missing from initial test suite:
- invokeProcedure: service null, dual payload, version mismatch,
  direct response, service error, 30s timeout (mock timers)
- checkVersionCompatibility: OCPP 1.6/2.0/2.0.1 matching, cross-version
  errors, hashIds filtering, all-stations fallback
- readRequestBody: valid JSON, payload too large, invalid JSON, stream error
- loadOcppSchemas: disk loading, cache entry validation

Refactor for elegance and guide compliance:
- Centralize Reflect.get wrappers in TestableUIMCPServer class
- Extract assertToolError() helper to eliminate repeated triplet
- Move createMockChargingStationDataWithVersion() to UIServerTestUtils
- Replace magic number with DEFAULT_MAX_PAYLOAD_SIZE import

* fix(ui-server): per-request McpServer factory, async iterator body reader, transport leak

- Create a new McpServer per HTTP request via createMcpServer() factory
  to fix concurrency bug: McpServer.connect() overwrites a single
  internal _transport field, causing cross-talk under concurrent requests.
  OCPP schema cache and UI service are pre-loaded at startup; tool
  registration is ~12µs per request (negligible).

- Replace event-listener readRequestBody with for-await-of async
  iterator pattern. Single settlement guaranteed by language semantics,
  eliminating the double-reject bug on payload-too-large.

- Close transport on mcpServer.connect() failure to prevent resource leak.

- Clean up both transport and McpServer on response close via unified
  cleanup callback.

* fix: align StatusNotification field name with OCPP 2.0.1 schema, fix asset paths

- Use 'connectorStatus' (OCPP 2.0.1 schema field name) instead of
  'status' (non-standard) in OCPP20RequestService.buildRequestPayload
  and both call sites in OCPP20IncomingRequestService

- Fix esbuild-relative asset paths for OCPP JSON schemas and MCP
  resource handlers — import.meta.url resolves to dist/start.js,
  not the original source tree depth

* refactor(ocpp): align payload builders to object-param API, fix StatusNotification field names

- Refactor buildStatusNotificationRequest from positional params to
  object-based StatusNotificationRequest input. Builder accepts both
  'status' (internal/OCPP 1.6) and 'connectorStatus' (OCPP 2.0.1)
  with consistent fallback order (connectorStatus ?? status).

- Refactor buildTransactionEvent from 3 overloads to single
  object-based OCPP20TransactionEventRequest input, removing
  positional param complexity and non-null assertions.

- Refactor sendAndSetConnectorStatus from positional params to
  object-based StatusNotificationRequest input. Callers pass
  version-correct field names: 'status' in OCPP 1.6 code,
  'connectorStatus' in OCPP 2.0 code, either in common code.

- Extract getSchemaBaseDir() as protected method on UIMCPServer
  for test overridability, replacing fragile symlink hack.

- Migrate all call sites (28 sendAndSetConnectorStatus, 60+
  buildTransactionEvent) and their corresponding tests.

* build: externalize @modelcontextprotocol/sdk and zod from esbuild bundle

Add @modelcontextprotocol/* and zod to esbuild external list for
consistency with all other production dependencies (ajv, ws, winston,
etc.) which are already externalized. Reduces bundle size and avoids
bundling the SDK's transitive dependency tree.

* fix(ui-server): fix SonarCloud quality gate — localeCompare sort, reduce cognitive complexity

- Add localeCompare to schema file sort in MCPResourceHandlers to
  ensure locale-aware alphabetical ordering (SonarCloud bug)

- Extract sendErrorResponse helper from handleMcpRequest to reduce
  cognitive complexity from 16 to below threshold (SonarCloud smell)

* chore: update .serena/project.yml with new default config fields

* refactor(ocpp): buildMeterValue resolves connectorId/evseId from transactionId

- Refactor buildMeterValue signature from (station, connectorId,
  transactionId, interval) to (station, transactionId, interval).
  connectorId and evseId are resolved internally from the unique
  transactionId via getConnectorIdByTransactionId/getEvseIdByTransactionId.

- Refactor getSampledValueTemplate to accept optional evseId. When
  provided, EVSE-level MeterValues templates take priority; falls back
  to merging connector-level templates from all EVSE connectors.

- Add MeterValues field to EvseStatus and EvseTemplate types to support
  EVSE-level meter value template definitions.

- Refactor handleMeterValues in BroadcastChannel from if/else to
  switch/case on OCPP version with explicit default error.

- Simplify OCPP20IncomingRequestService fallback MeterValues (no
  transaction = static empty meter value, skip buildMeterValue).

- Add buildMeterValue unit tests covering OCPP 1.6/2.0 resolution,
  unknown transactionId throw, EVSE-level template priority, and
  connector template merge fallback.

- Add TEST_TRANSACTION_ID_STRING constant for OCPP 2.0 tests, fix
  BroadcastChannel test to use string transactionId for OCPP 2.0.1.

* docs: add MCP Protocol to ToC, fix HTTP Protocol link, document EVSE-level MeterValues

- Add MCP Protocol entry to table of contents
- Fix HTTP Protocol anchor to match 'deprecated' heading
- Document EVSE-level MeterValues templates in Evses section examples
  with priority explanation (EVSE-level overrides connector-level)

* fix(ocpp): version-aware Authorize response mapping, complete cross-version types

- Fix commandResponseToResponseStatus for Authorize: use switch/case
  on OCPP version. OCPP 1.6 checks idTagInfo.status, OCPP 2.0 checks
  idTokenInfo.status. Previously only checked idTagInfo (1.6 field),
  causing MCP to report 'failure' for successful OCPP 2.0 authorizations.

- Make AuthorizeResponse and AuthorizeRequest cross-version union types
  (OCPP16 | OCPP20) consistent with AuthorizationStatus pattern.

- Make isIdTagRemoteAuthorized version-aware: sends idTag for OCPP 1.6,
  idToken for OCPP 2.0, and checks the version-correct response field.

- Use version-specific casts (OCPP16AuthorizeResponse,
  OCPP20AuthorizeResponse) in version-switched code paths instead of
  agnostic union type.

* refactor(ocpp): harmonize version switch/case in auth functions

- Refactor isIdTagAuthorizedUnified and isIdTagAuthorized from if/else
  on OCPP version to switch/case with explicit VERSION_16, VERSION_20/201
  cases and separate default fallback.

- Remove unnecessary optional chaining on stationInfo inside
  version-switched cases where stationInfo is guaranteed non-null.

- Separate VERSION_16 from default in all auth switch/case blocks
  for spec-compliant version handling.

* fix(ocpp): buildMeterValue from transactionId, log date locale fix, MeterValues EVSE templates

- Refactor buildMeterValue to resolve connectorId/evseId from
  transactionId internally. Returns empty MeterValue when transactionId
  is undefined (MCP pass-through with provided meterValue).

- Fix log file date resolution: use local date instead of UTC to match
  Winston DailyRotateFile naming convention.

- Add optional date parameter to readCombinedLog/readErrorLog MCP tools
  for accessing rotated log files by date (YYYY-MM-DD).

- Add MeterValues field to EvseStatus/EvseTemplate types for EVSE-level
  meter value template definitions. getSampledValueTemplate checks
  EVSE-level templates first, falls back to merging connector templates.

- Refactor handleMeterValues to switch/case on OCPP version with
  explicit default error.

- Make AuthorizeRequest/AuthorizeResponse cross-version union types.
  Fix commandResponseToResponseStatus and isIdTagRemoteAuthorized with
  version-aware switch/case for OCPP 1.6 (idTagInfo) vs 2.0 (idTokenInfo).

- Add integration tests for readCombinedLog tool (default date, explicit
  date, missing file error). Add buildMeterValue unit tests.

2 days agochore(deps): lock file maintenance (#1747)
renovate[bot] [Mon, 23 Mar 2026 12:04:34 +0000 (13:04 +0100)] 
chore(deps): lock file maintenance (#1747)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
3 days agochore(deps): update dependency vite to v8 (#1717)
renovate[bot] [Mon, 23 Mar 2026 11:15:16 +0000 (12:15 +0100)] 
chore(deps): update dependency vite to v8 (#1717)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
3 days agochore: release main (#1743) v3.2
Jérôme Benoit [Sun, 22 Mar 2026 18:35:32 +0000 (19:35 +0100)] 
chore: release main (#1743)

* chore: release main

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
3 days agofix(ocpp2): implement StopTxOnInvalidId and MaxEnergyOnInvalidId per E05 (#1745)
Jérôme Benoit [Sun, 22 Mar 2026 18:26:00 +0000 (19:26 +0100)] 
fix(ocpp2): implement StopTxOnInvalidId and MaxEnergyOnInvalidId per E05 (#1745)

* fix(ocpp2): implement StopTxOnInvalidId and MaxEnergyOnInvalidId per E05

Implement the full deauthorization decision tree per OCPP 2.0.1 spec:
- StopTxOnInvalidId=false: transaction continues, no termination
- StopTxOnInvalidId=true + MaxEnergyOnInvalidId>0: defer termination
  until energy limit reached (checked in periodic meter values callback)
- StopTxOnInvalidId=true + MaxEnergyOnInvalidId=0: immediate suspension
  and termination

Also includes:
- Deduplicate transactionSetInterval/transactionTxUpdatedSetInterval
  into single transactionMeterValuesSetInterval field
- Add transactionDeauthorized/transactionDeauthorizedEnergyWh to
  ConnectorStatus for deauth state tracking (cleared in resetConnectorStatus)
- Extract readVariableValue/readVariableAsBoolean/readVariableAsInteger
  helpers using convertToInt and convertToBoolean utilities
- Fix buildEvsesStatus test that was missing evse-to-connector wiring

* refactor(ocpp2): address PR review comments

- Add logger.warn in readVariableAsInteger catch for diagnostic
- Replace unsafe 'as string' cast with .toString() in periodic callback
- Add tests for StopTxOnInvalidId=false and deauth state tracking

* chore: update webui.png

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* test: add resetConnectorStatus unit tests to Helpers.test.ts

Verify all 18 transaction fields are properly cleaned, TX_PROFILE
charging profiles matching the transaction are removed, and
non-transaction fields are preserved.

---------

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
3 days agofix(ocpp2): align MeterValues implementation with OCPP 2.0.1 spec (#1744)
Jérôme Benoit [Sun, 22 Mar 2026 15:36:32 +0000 (16:36 +0100)] 
fix(ocpp2): align MeterValues implementation with OCPP 2.0.1 spec (#1744)

* fix(ocpp2): use AlignedDataInterval for standalone MeterValues

Add getAlignedDataInterval() helper to OCPP20ServiceUtils that reads
AlignedDataCtrlr.Interval from the variable registry (default 900s).

Replace getTxUpdatedInterval() with getAlignedDataInterval() in the
broadcast channel handleMeterValues OCPP 2.0 branch. Standalone
MeterValuesRequest is non-transaction data per OCPP 2.0.1 spec and
should use the aligned data interval, not the tx-updated interval.

* fix(ocpp2): include meter value in TransactionEvent Started

Add buildTransactionBeginMeterValues() to OCPP20ServiceUtils following
the buildFinalMeterValues() pattern. Builds an OCPP20MeterValue with
Transaction.Begin context and Energy.Active.Import.Register measurand.

Wire it into both TransactionEvent(Started) call sites:
- OCPPServiceUtils.startTransactionOnConnector (ATG/broadcast channel)
- OCPP20IncomingRequestService RequestStartTransaction event listener

This aligns OCPP 2.0 with the OCPP 1.6 beginEndMeterValues behavior
per OCPP 2.0.1 spec SampledDataTxStartedMeasurands requirement.

* test(ocpp2): add tests for buildTransactionBeginMeterValues

Test Transaction.Begin context, energy register value, default to 0
when undefined, and empty array when energy is negative.

* refactor(ocpp2): address PR review comments

- Extract buildEnergyMeterValues private helper to eliminate DRY
  violation between buildTransactionBeginMeterValues and
  buildFinalMeterValues
- Add AlignedDataInterval to OCPP20RequiredVariableName enum replacing
  raw string literal in getAlignedDataInterval
- Clarify zero-energy test name to document that 0 Wh is a valid
  Transaction.Begin reading
- Add meterValue assertions to RequestStartTransaction test verifying
  Transaction.Begin context and Energy.Active.Import.Register measurand

* refactor(ocpp2): extract readVariableAsIntervalMs to eliminate DRY

getAlignedDataInterval and getTxUpdatedInterval were structurally
identical. Extract the shared variable-reading logic into a private
readVariableAsIntervalMs helper that accepts component name, variable
name, and default seconds. Both public methods become one-liner
delegates.

* refactor(ocpp2): extract terminateTransaction and resolveActiveTransaction

requestDeauthorizeTransaction and requestStopTransaction shared
identical transaction termination logic (build final meter values,
send TransactionEvent Ended, stop periodic, reset connector status).

Extract resolveActiveTransaction for the shared precondition check
and transactionId string resolution, and terminateTransaction for
the shared Ended event + cleanup workflow. Both public methods now
focus only on their unique behavior.

* fix(test): use enum constants instead of string literals in RequestStartTransaction test

Replace 'Transaction.Begin' and 'Energy.Active.Import.Register' string
literals with OCPP20ReadingContextEnumType.TRANSACTION_BEGIN and
OCPP20MeasurandEnumType.ENERGY_ACTIVE_IMPORT_REGISTER to match
codebase conventions.

* refactor(test): replace string literals with enum constants in OCPP 2.0 tests

Replace hardcoded string literals with their corresponding OCPP 2.0.1
enum values across test files for type safety and consistency:

- RequestStopTransaction: Transaction.End, Energy.Active.Import.Register
- SchemaValidation: Immediate, OnIdle, Heartbeat, BootNotification
- enforceMessageLimits: TooManyElements, TooLargeElement
- CertificateManager: Accepted, Failed, NotFound
- ChangeAvailability: UnknownEvse
- GetBaseReport: Accepted (SetVariableStatusEnumType)
- CertificateSigned: InternalError
- ServiceUtils-TransactionEvent: TransactionEvent command name

* fix(test): replace bogus mock return values with correctly typed empty responses

requestDeauthorizeTransaction mocks returned { status: 'Accepted' }
but OCPP20TransactionEventResponse has no status field. Replace with
properly typed empty response objects since the return value is not
asserted in these tests.

* refactor(ocpp2): align method names with OCPP 2.0.1 spec terminology

Rename methods to match OCPP 2.0.1 TransactionEvent terminology:
- buildTransactionBeginMeterValues -> buildTransactionStartedMeterValues
- buildFinalMeterValues -> buildTransactionEndedMeterValues
- beginMeterValues variable -> startedMeterValues
- finalMeterValues variable -> endedMeterValues

The spec uses Started/Updated/Ended for TransactionEvent types, not
Begin/Final.

* refactor(test): replace 'Operative' string literal with enum constants

Use OCPP20OperationalStatusEnumType.Operative in OCPP 2.0 test files
and the cross-version AvailabilityType.Operative in MessageChannelUtils
test to match ConnectorStatus.availability typed field.

3 days agofix(deps): update all non-major dependencies (#1742)
renovate[bot] [Sun, 22 Mar 2026 13:52:31 +0000 (14:52 +0100)] 
fix(deps): update all non-major dependencies (#1742)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
4 days agofix(ocpp2): build meter values payload in broadcast channel for OCPP 2.0.x
Jérôme Benoit [Sun, 22 Mar 2026 11:40:27 +0000 (12:40 +0100)] 
fix(ocpp2): build meter values payload in broadcast channel for OCPP 2.0.x

The OCPP 2.0 branch in handleMeterValues was passing the raw broadcast
channel payload through to requestHandler without constructing the
required evseId and meterValue fields. Build the payload using
buildMeterValue and resolve evseId from connectorId, matching the
pattern used by the OCPP 1.6 branch.

4 days ago[autofix.ci] apply automated fixes
autofix-ci[bot] [Sat, 21 Mar 2026 20:35:45 +0000 (20:35 +0000)] 
[autofix.ci] apply automated fixes

4 days agochore: release main (#1733)
Jérôme Benoit [Sat, 21 Mar 2026 20:32:53 +0000 (21:32 +0100)] 
chore: release main (#1733)

4 days agorefactor(ocpp2): use enum values instead of string literals in variable registry
Jérôme Benoit [Sat, 21 Mar 2026 20:29:59 +0000 (21:29 +0100)] 
refactor(ocpp2): use enum values instead of string literals in variable registry

Replace all string literals that have corresponding TypeScript enums:
- OCPP20OperationalStatusEnumType for AvailabilityState defaultValue/enumeration
- OCPP20ChargingRateUnitEnumType for ChargingScheduleAllowedChargingRateUnit
  defaultValue, enumeration, and description

4 days agorevert(ocpp2): re-comment Available→Available self-transitions
Jérôme Benoit [Sat, 21 Mar 2026 20:20:07 +0000 (21:20 +0100)] 
revert(ocpp2): re-comment Available→Available self-transitions

Self-transitions are not allowed per OCPP 2.0.1 spec. The boot
sequence warning needs a different fix (skip StatusNotification
when connector status unchanged).

4 days agofix(ocpp2): add AvailabilityState defaults and allow self-transitions
Jérôme Benoit [Sat, 21 Mar 2026 20:15:55 +0000 (21:15 +0100)] 
fix(ocpp2): add AvailabilityState defaults and allow self-transitions

- Add defaultValue using OCPP20OperationalStatusEnumType.Operative
  enum for ChargingStation AvailabilityState (was missing, causing
  'Missing required configuration key mapping' error at auth time)
- Replace string literals with OCPP20OperationalStatusEnumType enum
  values in AvailabilityState enumeration arrays
- Allow Available→Available self-transitions in OCPP20Constants for
  both ChargingStation and Connector status tables (required by
  boot sequence StatusNotification per spec Part 2 §4.1 step 5)

4 days agofix(lifecycle): clear auth service on template reload and station reset
Jérôme Benoit [Sat, 21 Mar 2026 19:26:19 +0000 (20:26 +0100)] 
fix(lifecycle): clear auth service on template reload and station reset

Auth service instance was persisting across template reloads and
station resets, causing stale adapters if OCPP version changed.

- Add OCPPAuthServiceFactory.clearInstance() before initialize()
  in template file change handler
- Add OCPPAuthServiceFactory.clearInstance() before initialize()
  in reset() method

4 days agofix(auth): replace phantom spec references in source code comments
Jérôme Benoit [Sat, 21 Mar 2026 19:18:54 +0000 (20:18 +0100)] 
fix(auth): replace phantom spec references in source code comments

- G03.FR.01 → remove (was Change Availability, not auth)
- R10 → C10.FR.08 (cache expiration behavior)
- R16, R5 → C10.FR.08 (TTL reset 'since last used')
- R2 → C10.FR.07 (evict non-valid entries first)
- R17 → C13.FR.01 (local auth list priority over cache)

4 days agotest(auth): fix OCPP spec references and remove duplicated tests
Jérôme Benoit [Sat, 21 Mar 2026 19:11:34 +0000 (20:11 +0100)] 
test(auth): fix OCPP spec references and remove duplicated tests

Replace incorrect G03/G04 (Change Availability) prefixes with correct
OCPP 2.0.1 Authorization section codes (C10/C11/C12/C13/C15).
Remove spec prefixes from internal tests with no direct spec mapping.

- C10.FR.01: cache all statuses (was G03.FR.01.T4)
- C10.FR.07: eviction mechanism (was G03.FR.01.T5)
- C10.FR.08: TTL/expiry behavior (was G03.FR.01.T6/T7)
- C11: cache invalidation (was G03.FR.01.004)
- C12: cache miss behavior (was G03.FR.01.002)
- C13.FR.01: local auth list priority (was G03.FR.01.T8)
- C15: offline authorization (was G03.FR.02)
- Remove 5 duplicated cache unit tests from integration suite
- Update TEST_STYLE_GUIDE.md examples

4 days agotest(auth): strengthen assertion quality and edge case coverage
Jérôme Benoit [Sat, 21 Mar 2026 18:41:46 +0000 (19:41 +0100)] 
test(auth): strengthen assertion quality and edge case coverage

- G03.FR.01 cache tests now verify status and TTL, not just cache key
- Add stats increment verification after success and failure auth
- Add cache error resilience test (cache.set throws)
- Add idTag boundary tests for exactly 19, 20, 21 characters
- Rename misleading 'concurrent operations' test to 'sequential batch'

4 days agorefactor(auth): remove ocppVersion from UnifiedIdentifier
Jérôme Benoit [Sat, 21 Mar 2026 18:29:50 +0000 (19:29 +0100)] 
refactor(auth): remove ocppVersion from UnifiedIdentifier

Version info is now sourced from adapter.ocppVersion since each
station has a single adapter. Eliminates redundant version stamping
on every identifier.

- Remove ocppVersion field from UnifiedIdentifier interface
- CertificateAuthStrategy uses this.adapter.ocppVersion
- Adapters no longer stamp version on created identifiers
- Fix CertificateAuthStrategy OCPP 1.6 test to use 1.6 adapter
  instead of relying on missing certificateHashData

4 days agorefactor(auth): replace adapter Map with single adapter per station
Jérôme Benoit [Sat, 21 Mar 2026 18:01:48 +0000 (19:01 +0100)] 
refactor(auth): replace adapter Map with single adapter per station

Each charging station has exactly one OCPP version, making the
Map<OCPPVersion, OCPPAuthAdapter> unnecessary indirection. Simplify
to a single adapter field across the auth module.

- AuthComponentFactory: createAdapter() returns single OCPPAuthAdapter
- RemoteAuthStrategy: setAdapter()/clearAdapter() replace map ops
- CertificateAuthStrategy: readonly adapter field, no map
- OCPPAuthServiceImpl: single adapter, initializeAdapter() singular
- Tests updated to match new single-adapter API

4 days agofix(auth): address audit findings in OCPP auth abstraction layer
Jérôme Benoit [Sat, 21 Mar 2026 17:39:09 +0000 (18:39 +0100)] 
fix(auth): address audit findings in OCPP auth abstraction layer

- Read AuthCtrlr.LocalAuthorizeOffline variable instead of hardcoding true
- Delegate testConnectivity() to actual adapter availability checks
- Remove duplicate mapOCPP20AuthStatus(), use canonical mapOCPP20AuthorizationStatus
- Map strategies by name instead of fragile priority numbers
- Make connectorId truly optional in OCPP20AuthAdapter.authorizeRemote()
- Use ES2022 Error cause chain in AuthenticationError

4 days agofix(webui): use table-layout fixed so table shrinks with container when action panel...
Jérôme Benoit [Sat, 21 Mar 2026 17:03:40 +0000 (18:03 +0100)] 
fix(webui): use table-layout fixed so table shrinks with container when action panel opens

Replace min-width: 1280px + table-layout: auto with table-layout: fixed.
Auto layout ignores width: 100% and expands based on content, causing
the table to overflow behind the action panel. Fixed layout respects
the container width and distributes columns equally. Add overflow:
hidden on charging-stations-container as belt-and-suspenders clip.

4 days agofix(webui): remove white-space nowrap on buttons to prevent table overflow
Jérôme Benoit [Sat, 21 Mar 2026 16:56:43 +0000 (17:56 +0100)] 
fix(webui): remove white-space nowrap on buttons to prevent table overflow

The nowrap prevented button text from wrapping in narrow table columns,
causing the table to overflow its container when the action panel was
open. Buttons in the toolbar still fit without wrapping due to flex
sizing.

4 days agofix(webui): prevent action panel flex grow and allow table container to shrink
Jérôme Benoit [Sat, 21 Mar 2026 16:23:56 +0000 (17:23 +0100)] 
fix(webui): prevent action panel flex grow and allow table container to shrink

Use ID selector on #action-container for higher specificity (1-1-0)
over Container.vue scoped .container (0-2-0), add flex: none to prevent
growing. Add min-width: 0 and remove width: 100% on charging stations
container to allow flex shrink below table content width.

4 days agorefactor(webui): css quality overhaul with scoped styles, class selectors, design...
Jérôme Benoit [Sat, 21 Mar 2026 15:46:55 +0000 (16:46 +0100)] 
refactor(webui): css quality overhaul with scoped styles, class selectors, design tokens

- add scoped to all 12 Vue component style blocks
- move body/app global styles to index.html
- replace all 33 ID CSS selectors with class selectors
- add :deep() for parent-child table style propagation
- add spacing scale and typography tokens to all themes
- replace magic number percentages with spacing variables
- add :focus-visible styles for buttons and select
- replace hardcoded form widths with max-width constraints
- use gap for flex toolbar spacing
- remove dead CSS

5 days agofix(ocpp2.0): add proper response handlers for certificate commands + handler coverag...
Jérôme Benoit [Fri, 20 Mar 2026 20:39:36 +0000 (21:39 +0100)] 
fix(ocpp2.0): add proper response handlers for certificate commands + handler coverage tests

Replace emptyResponseHandler with proper logging handlers for
Get15118EVCertificate, GetCertificateStatus, and SignCertificate
responses. Add handler registration coverage tests for both OCPP 1.6
and 2.0: every RequestCommand must have a response handler, every
IncomingRequestCommand must have an incoming request handler.

5 days agofeat(ocpp2.0): implement Authorize request, fix double TransactionEvent(Started)
Jérôme Benoit [Fri, 20 Mar 2026 20:07:05 +0000 (21:07 +0100)] 
feat(ocpp2.0): implement Authorize request, fix double TransactionEvent(Started)

OCPP20AuthAdapter.authorizeRemote() was incorrectly sending a
TransactionEvent(Started) as a proxy for authorization, causing a
duplicate Started event when ATG subsequently called
startTransactionOnConnector(). Implement the proper OCPP 2.0.1
Authorize request/response flow, harmonizing the auth+start sequence
with OCPP 1.6: Authorize first, then TransactionEvent(Started).

5 days agofix(ocpp2.0): guard BroadcastChannel MeterValues for both VERSION_20 and VERSION_201
Jérôme Benoit [Fri, 20 Mar 2026 19:10:38 +0000 (20:10 +0100)] 
fix(ocpp2.0): guard BroadcastChannel MeterValues for both VERSION_20 and VERSION_201

The early return in handleMeterValues only checked VERSION_201, missing
VERSION_20. A station configured with ocppVersion '2.0' would fall
through to the OCPP 1.6 path and call convertToInt on a UUID string.

5 days agofix(ocpp2.0): pass real transactionId to buildMeterValue for energy accumulation
Jérôme Benoit [Fri, 20 Mar 2026 19:05:22 +0000 (20:05 +0100)] 
fix(ocpp2.0): pass real transactionId to buildMeterValue for energy accumulation

buildMeterValue was called with transactionId=0 for OCPP 2.0 stations,
but transaction IDs are UUID strings in 2.0.1. The energy lookup
compared 'uuid-string' === 0, always returning 0 Wh. Pass the actual
connectorStatus.transactionId and widen the parameter type to
number | string | undefined.

5 days agorefactor(webui): restore native table layout to fix column overlap on action panel...
Jérôme Benoit [Fri, 20 Mar 2026 19:00:23 +0000 (20:00 +0100)] 
refactor(webui): restore native table layout to fix column overlap on action panel open

Replace display:flex overrides on <table>/<tr>/<td> with native HTML table
layout. Add overflow-x:auto wrapper with min-width floor so columns scroll
horizontally instead of compressing and overlapping when the action panel
reduces available width.

5 days agofix(auth): log actual station OCPP version in RemoteAuthStrategy
Jérôme Benoit [Fri, 20 Mar 2026 18:49:23 +0000 (19:49 +0100)] 
fix(auth): log actual station OCPP version in RemoteAuthStrategy

Deduplicate adapter validation in initialize() to avoid logging the
same adapter twice for VERSION_20/VERSION_201 aliases. Add ocppVersion
to AuthConfiguration so strategies log the station's configured version
instead of internal map keys.

5 days agofix(ocpp2.0): align VARIABLE_REGISTRY spec conformance and log severity
Jérôme Benoit [Fri, 20 Mar 2026 18:23:38 +0000 (19:23 +0100)] 
fix(ocpp2.0): align VARIABLE_REGISTRY spec conformance and log severity

Distinguish required vs optional variables per OCPP 2.0.1 spec
(dm_components_vars.csv). Missing required variables log as error,
missing optional ones as warning. Tag 58 spec-required entries with
required: true and 6 non-spec entries with vendorSpecific: true.

5 days agofix(deps): update all non-major dependencies (#1739)
renovate[bot] [Fri, 20 Mar 2026 17:10:41 +0000 (18:10 +0100)] 
fix(deps): update all non-major dependencies (#1739)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
5 days agorefactor: build version-agnostic OCPP transaction primitives in service layer (#1741)
Jérôme Benoit [Fri, 20 Mar 2026 17:07:17 +0000 (18:07 +0100)] 
refactor: build version-agnostic OCPP transaction primitives in service layer (#1741)

* refactor: add StopTransactionResult type and OCPP 2.0 reason mapping

* refactor: extract OCPP 1.6 stopTransactionOnConnector to OCPP16ServiceUtils

* refactor: add unified stopTransactionOnConnector and stopRunningTransactions to OCPPServiceUtils

Add two version-dispatching functions to OCPPServiceUtils:

- stopTransactionOnConnector: dispatches to OCPP16ServiceUtils or
  OCPP20ServiceUtils via dynamic import, returns StopTransactionResult
- stopRunningTransactions: sequential for OCPP 1.6, parallel (Promise.all)
  for OCPP 2.0, includes transactionPending check for OCPP 2.0

Both use dynamic imports to avoid circular dependencies. stopRunningTransactions
is exposed as OCPPServiceUtils.stopRunningTransactions class member.
stopTransactionOnConnector is exported as standalone function only (class member
omitted due to OCPP16ServiceUtils override type conflict).

Includes 6 tests covering both OCPP versions and error cases.

* refactor: simplify ChargingStation and ATG to use OCPPServiceUtils unified methods

- ChargingStation.stopRunningTransactions: delegate to standalone function from OCPPServiceUtils
- Remove ChargingStation.stopRunningTransactionsOCPP20 private method (logic now in standalone function)
- Remove OCPP20ReasonEnumType import from ChargingStation (no longer needed)
- AutomaticTransactionGenerator.stopTransaction: call stopTransactionOnConnector standalone function
- Update ATG return type to Promise<StopTransactionResult | undefined>
- Use result.accepted instead of stopResponse.idTagInfo?.status === AuthorizationStatus.ACCEPTED
- Remove TODO comment from ATG.stopTransaction

* refactor: remove stopTransactionOnConnector from ChargingStation public API

* refactor: remove stopTransactionOnConnector from ChargingStation public API

- Remove ChargingStation.stopTransactionOnConnector public method
- Remove unused StopTransactionRequest, StopTransactionResponse, buildTransactionEndMeterValue, OCPP16ServiceUtils imports from ChargingStation
- Update OCPP16IncomingRequestService.handleRequestUnlockConnector to call OCPP16ServiceUtils.stopTransactionOnConnector directly
- Update test mocks in RemoteStopUnlock tests to target OCPP16ServiceUtils
- Fix OCPPServiceUtils-StopTransaction test: use args-based pattern for command detection, add proper JSDoc, fix type issues

* refactor(ocpp2.0): deduplicate stop pattern via stopAllTransactions

- Add OCPP20ServiceUtils.stopAllTransactions() — single factored function for parallel
  EVSE iteration + requestStopTransaction, supports optional evseId for single-EVSE scope
- terminateAllTransactions delegates to stopAllTransactions(station, ResetCommand, reason)
- terminateEvseTransactions delegates to stopAllTransactions(station, ResetCommand, reason, evseId)
- stopRunningTransactions OCPP 2.0 path delegates to stopAllTransactions(station, trigger, stopped)
- Eliminates 3x duplicated iteration+parallel-stop pattern

* refactor: add startTransactionOnConnector and flushQueuedTransactionMessages abstractions

- Add startTransactionOnConnector to OCPPServiceUtils (version dispatch via dynamic imports)
  OCPP 1.6: sends START_TRANSACTION via new OCPP16ServiceUtils.startTransactionOnConnector
  OCPP 2.0: sends TransactionEvent(Started) via OCPP20ServiceUtils.sendTransactionEvent
  Returns StartTransactionResult { accepted: boolean }
- Add flushQueuedTransactionMessages to OCPPServiceUtils (OCPP 1.6: no-op, OCPP 2.0: flushes queue)
- Migrate ATG startTransaction to use startTransactionOnConnector (fixes OCPP 2.0 ATG start)
- Migrate ATG handleStartTransactionResponse to handleStartTransactionResult (uses unified type)
- Remove ATG dependency on AuthorizationStatus, RequestCommand, StartTransactionRequest/Response
- Remove ChargingStation.flushQueuedTransactionEvents private method
- Remove version check in ChargingStation boot handler (line 2304)
- Add StartTransactionResult type to types barrel

* refactor: extract periodic meter values to OCPP service layer

- Add OCPP16ServiceUtils.startPeriodicMeterValues/stopPeriodicMeterValues
- Add OCPP20ServiceUtils.startPeriodicMeterValues/stopPeriodicMeterValues
- Add OCPPServiceUtils.startPeriodicMeterValues/stopPeriodicMeterValues (version dispatch)
- Remove startMeterValues, stopMeterValues, startTxUpdatedInterval, stopTxUpdatedInterval,
  restartMeterValues from ChargingStation.ts
- Migrate all callers to use versioned ServiceUtils methods
- Fix test referencing removed startTxUpdatedInterval method
- ChargingStation.ts: -130 lines of version-specific meter values logic removed

* fix: update tests for renamed APIs and removed ChargingStation methods

- AutomaticTransactionGenerator.test.ts: handleStartTransactionResponse -> handleStartTransactionResult, use StartTransactionResult { accepted } instead of StartTransactionResponse
- ChargingStation-Transactions.test.ts: test already uses OCPP16ServiceUtils.stopPeriodicMeterValues
- OCPP20ServiceUtils-TransactionEvent.test.ts: startTxUpdatedInterval -> startPeriodicMeterValues
- StationHelpers.ts: remove stopMeterValues, startMeterValues, startTxUpdatedInterval, stopTxUpdatedInterval, restartMeterValues from mock (no longer on ChargingStation)
- OCPP16ServiceUtils.stopPeriodicMeterValues: add missing delete after clearInterval

* fix: correct startPeriodicMeterValues test to verify no-transaction guard instead of version guard

* fix: guard undefined evseId and avoid throw in shutdown paths

- stopTransactionOnConnector: guard getEvseIdByConnectorId returning undefined, return { accepted: false } with warn log
- stopRunningTransactions: replace throw with warn log in default branch (shutdown path must not crash)

* fix: deduplicate test coverage and address review findings

- Remove ChargingStation-StopRunningTransactions.test.ts (duplicated coverage with OCPPServiceUtils-StopTransaction.test.ts)
- Move error handling test to OCPPServiceUtils-StopTransaction.test.ts
- Guard undefined evseId in stopTransactionOnConnector (review finding)
- Replace throw with warn in stopRunningTransactions default branch (review finding)

* fix: generate transactionId for OCPP 2.0 start and align offline stop acceptance

- startTransactionOnConnector OCPP 2.0: generate UUID transactionId and reset seqNo when
  connector has no transactionId (ATG path)
- stopTransactionOnConnector OCPP 2.0: treat missing idTokenInfo as accepted (offline queued
  events return undefined idTokenInfo, consistent with startTransactionOnConnector)

* fix: map Other reason correctly and use static generateUUID import

- mapStopReasonToOCPP20: add explicit Other -> Other/AbnormalCondition mapping
  instead of falling through to Local/StopAuthorized
- startTransactionOnConnector: use statically imported generateUUID instead of
  unnecessary dynamic import (utils/index.js already imported at top of file)

* test: add coverage for startTransactionOnConnector, flushQueuedTransactionMessages, and mapStopReasonToOCPP20

- startTransactionOnConnector: OCPP 1.6 accepted, OCPP 2.0 accepted, OCPP 2.0 UUID generation
- flushQueuedTransactionMessages: OCPP 1.6 no-op, OCPP 2.0 flush queued events
- mapStopReasonToOCPP20: Other, undefined, Remote mappings

* refactor: remove stopRunningTransactions indirection in ChargingStation

Call stopRunningTransactions(this, reason) directly instead of through
a private method that only delegates.

6 days agofix(ocpp2.0): make stopRunningTransactions version-aware for OCPP 2.0
Jérôme Benoit [Thu, 19 Mar 2026 17:59:42 +0000 (18:59 +0100)] 
fix(ocpp2.0): make stopRunningTransactions version-aware for OCPP 2.0

6 days agorefactor(ocpp2.0): parameterize requestStopTransaction triggerReason and stoppedReason
Jérôme Benoit [Thu, 19 Mar 2026 17:49:02 +0000 (18:49 +0100)] 
refactor(ocpp2.0): parameterize requestStopTransaction triggerReason and stoppedReason

6 days agofix(ocpp2.0): reset transaction sequence number before new transaction per E01.FR.07
Jérôme Benoit [Thu, 19 Mar 2026 17:41:30 +0000 (18:41 +0100)] 
fix(ocpp2.0): reset transaction sequence number before new transaction per E01.FR.07

6 days agofix(ocpp2.0): inject offline:true in sendTransactionEvent offline path per E04.FR.03
Jérôme Benoit [Thu, 19 Mar 2026 17:29:44 +0000 (18:29 +0100)] 
fix(ocpp2.0): inject offline:true in sendTransactionEvent offline path per E04.FR.03

6 days agorefactor(webui): harmonize barrel usage in types and composables
Jérôme Benoit [Thu, 19 Mar 2026 15:27:49 +0000 (16:27 +0100)] 
refactor(webui): harmonize barrel usage in types and composables

Add OCPP16AvailabilityType, OCPP16ChargePointStatus, and
OCPP16RegistrationStatus to the types barrel. Redirect all direct
module imports in tests to use barrels (types/, composables/).

6 days agofix: merge duplicate node:process imports in Utils.test.ts
Jérôme Benoit [Thu, 19 Mar 2026 15:21:43 +0000 (16:21 +0100)] 
fix: merge duplicate node:process imports in Utils.test.ts

6 days agofix: merge duplicate type imports from same barrel module
Jérôme Benoit [Thu, 19 Mar 2026 15:18:42 +0000 (16:18 +0100)] 
fix: merge duplicate type imports from same barrel module

Consolidate split import type statements from types/index.js into
single imports in OCPP16TestUtils.ts and OCPP20IncomingRequestService-
MasterPass.test.ts.

6 days agorefactor: harmonize barrel usage across all test files
Jérôme Benoit [Thu, 19 Mar 2026 15:11:03 +0000 (16:11 +0100)] 
refactor: harmonize barrel usage across all test files

Redirect all direct module imports (utils/Logger, utils/Constants,
worker/WorkerTypes, types/*, charging-station/ChargingStation) to
their respective barrel index.js in test files. Unit tests of the
module itself retain direct imports per convention.

6 days agofix: use exception barrel instead of direct module imports
Jérôme Benoit [Thu, 19 Mar 2026 14:58:59 +0000 (15:58 +0100)] 
fix: use exception barrel instead of direct module imports

Redirect OCPPError imports from exception/OCPPError.js to the barrel
exception/index.js in auth services and OCPP20 test utils.

6 days agofix(ocpp): keep StopTransactionRequest as 1.6 wire type, narrow reason via indexed...
Jérôme Benoit [Thu, 19 Mar 2026 14:53:24 +0000 (15:53 +0100)] 
fix(ocpp): keep StopTransactionRequest as 1.6 wire type, narrow reason via indexed access

Revert the Omit-based widening of StopTransactionRequest — it's a 1.6
wire protocol message and should not accept OCPP 2.0 reason values.
Use StopTransactionRequest['reason'] indexed access type for narrowing
in ChargingStation, avoiding any version-specific OCPP16* import.

6 days agofix(ocpp): remove type re-export from services barrel
Jérôme Benoit [Thu, 19 Mar 2026 14:42:59 +0000 (15:42 +0100)] 
fix(ocpp): remove type re-export from services barrel

Move OCPP20TransactionEventEnumType and OCPP20TriggerReasonEnumType
imports in ChargingStation.ts from the services barrel (ocpp/index.ts)
to the types barrel (types/index.ts) where they belong.

6 days agorefactor(ocpp): consolidate cross-stack types and harmonize barrel imports
Jérôme Benoit [Thu, 19 Mar 2026 14:24:42 +0000 (15:24 +0100)] 
refactor(ocpp): consolidate cross-stack types and harmonize barrel imports

Consolidate OCPP types with common semantics across 1.6 and 2.0 stacks
(AuthorizationStatus, StopTransactionReason, MessageTrigger, DataTransfer,
TriggerMessageStatus, UnlockStatus, AvailabilityStatus, HeartbeatRequest/
Response, StatusNotificationResponse, FirmwareStatusNotificationResponse).

Harmonize all imports across src/ and tests/ to use the barrel
(types/index.ts) instead of direct version-specific type paths, matching
the pattern already established by the OCPP 1.6 handlers.

7 days agochore(ocpp-server): add .coverage to .gitignore
Jérôme Benoit [Thu, 19 Mar 2026 11:59:29 +0000 (12:59 +0100)] 
chore(ocpp-server): add .coverage to .gitignore

7 days agotest(ocpp-server): add coverage threshold (fail_under=83%)
Jérôme Benoit [Thu, 19 Mar 2026 11:58:01 +0000 (12:58 +0100)] 
test(ocpp-server): add coverage threshold (fail_under=83%)

7 days agotest(ui): raise coverage thresholds to match current levels
Jérôme Benoit [Thu, 19 Mar 2026 11:55:08 +0000 (12:55 +0100)] 
test(ui): raise coverage thresholds to match current levels

statements: 87→91, branches: 85→89, functions: 80→83, lines: 87→91

7 days agotest(webui): add comprehensive unit test suite (#1738)
Jérôme Benoit [Thu, 19 Mar 2026 11:39:02 +0000 (12:39 +0100)] 
test(webui): add comprehensive unit test suite (#1738)

* test(webui): add test infrastructure and setup

* test(webui): add Utils composable tests

* test(webui): refactor and expand UIClient tests

* test(webui): add action modal component tests

* test(webui): fix JSDoc warnings in mount factory functions

* test(webui): add ChargingStationsView tests

* [autofix.ci] apply automated fixes

* test(webui): finalize coverage and verify quality gates

* test(webui): harmonize test infrastructure — extract ButtonStub, unify toast mock, DRY error tests

* test(webui): add missing coverage for timeout, server switching, authorize errors, WS states

* test(webui): raise coverage thresholds to match achieved 93%/91%/85%/93%

* test(webui): address PR review — unify mock cleanup, improve MockWebSocket fidelity, fix types

* test(webui): adapt tests for new OCPP Version column

* test(webui): remove MockWebSocket auto-open, robustify component lookups, add open assertion

* test(webui): init MockWebSocket readyState to CONNECTING per WebSocket spec

* fix(webui): use window.localStorage for Node 22+ jsdom compatibility

* fix(webui): disable Node 25+ native webstorage to prevent jsdom localStorage conflict

* test(webui): await router.isReady() in App mount test

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
7 days agorefactor(ocpp2): harmonize and condense audit comments to match existing FR style
Jérôme Benoit [Thu, 19 Mar 2026 11:29:15 +0000 (12:29 +0100)] 
refactor(ocpp2): harmonize and condense audit comments to match existing FR style

7 days agofix(ocpp2): audit TransactionEvent — state ownership, deauthorization, meter values
Jérôme Benoit [Thu, 19 Mar 2026 11:17:44 +0000 (12:17 +0100)] 
fix(ocpp2): audit TransactionEvent — state ownership, deauthorization, meter values

- Fix periodic TransactionEvent(Updated) to include meter values via buildMeterValue
- Replace non-UUID temp transactionId with generateUUID in OCPP20AuthAdapter
- Refactor state ownership: response handler is sole authority for transactionStarted,
  StatusNotification(Occupied), and TxUpdatedInterval start
- Add transactionPending flag to prevent duplicate RequestStartTransaction race conditions
- Add requestDeauthorizeTransaction per E05.FR.09/FR.10/E06.FR.04: sends
  Updated(Deauthorized, SuspendedEVSE) then Ended(Deauthorized, DeAuthorized)
- Fix rejection check to cover all non-Accepted idTokenInfo statuses
- Extract buildFinalMeterValues helper to eliminate DRY violation
- Skip Occupied/TxUpdatedInterval setup when idToken is rejected in same response
- Remove cleanup from Ended response handler (owned by caller)
- Add tests for getTxUpdatedInterval, requestDeauthorizeTransaction, Updated-failure path

7 days agochore(deps): update dependency vue-tsc to v3 (#1740)
renovate[bot] [Thu, 19 Mar 2026 09:34:33 +0000 (10:34 +0100)] 
chore(deps): update dependency vue-tsc to v3 (#1740)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
7 days agofix(ocpp2): handle transaction lifecycle in TransactionEvent response
Jérôme Benoit [Thu, 19 Mar 2026 00:08:33 +0000 (01:08 +0100)] 
fix(ocpp2): handle transaction lifecycle in TransactionEvent response

Adapt the OCPP 1.6 transaction lifecycle pattern to OCPP 2.0: manage
connector state (transactionStarted, transactionId, StatusNotification,
meter intervals) in handleResponseTransactionEvent for both Started
and Ended events, matching handleResponseStartTransaction and
handleResponseStopTransaction in OCPP 1.6.

7 days agofeat(ui): add SAP Horizon theme from official theming-base-content
Jérôme Benoit [Wed, 18 Mar 2026 23:47:16 +0000 (00:47 +0100)] 
feat(ui): add SAP Horizon theme from official theming-base-content

Map SAP Horizon palette to semantic tokens using values from
SAP/theming-base-content sap_horizon css_variables.css.

7 days agofix(ui): use theme text color on toggle pressed state for readability
Jérôme Benoit [Wed, 18 Mar 2026 23:44:23 +0000 (00:44 +0100)] 
fix(ui): use theme text color on toggle pressed state for readability

White text on light Surface backgrounds was illegible in Catppuccin
Latte. Using --color-text adapts to both light and dark themes.

7 days agodocs(ui): document theme configuration and available themes
Jérôme Benoit [Wed, 18 Mar 2026 23:35:02 +0000 (00:35 +0100)] 
docs(ui): document theme configuration and available themes

7 days agofeat(ui): add Catppuccin Latte light theme
Jérôme Benoit [Wed, 18 Mar 2026 23:32:29 +0000 (00:32 +0100)] 
feat(ui): add Catppuccin Latte light theme

Map Catppuccin Latte palette to semantic tokens following the official
style guide: Base for background, Mantle/Crust for secondary panes,
Surface 0/1 for hover/active, Blue for buttons/links, Lavender for
accent, Base for text-on-button (On Accent per guide).

7 days agofix(ui): remove redundant text color selectors that override toast styles
Jérôme Benoit [Wed, 18 Mar 2026 23:27:55 +0000 (00:27 +0100)] 
fix(ui): remove redundant text color selectors that override toast styles

The h1-h3/p/li selectors were unnecessary (body color is inherited)
and caused vue-toast-notification text to appear grey instead of white.

7 days agofeat(ui): add configurable theme support
Jérôme Benoit [Wed, 18 Mar 2026 23:23:29 +0000 (00:23 +0100)] 
feat(ui): add configurable theme support

Add theme field to ConfigurationData. Theme CSS files are loaded
dynamically from assets/themes/ at startup. Falls back to
tokyo-night-storm when not configured or theme not found.

Move theme.css to assets/themes/tokyo-night-storm.css.

7 days agofeat(ui): apply Tokyo Night Storm theme with semantic CSS tokens
Jérôme Benoit [Wed, 18 Mar 2026 23:14:13 +0000 (00:14 +0100)] 
feat(ui): apply Tokyo Night Storm theme with semantic CSS tokens

Add theme.css with two-layer token system: primitive tokens from
the official Tokyo Night Storm palette, semantic tokens mapping UI
roles to primitives. All components use semantic tokens exclusively.

Replace all hardcoded colors across 13 Vue components. Theme native
HTML elements (button, input, select, a, headings) globally. Toggle
button pressed state uses palette-semantic active bg + accent border
+ inset shadow for clear visual distinction.

Remove dead code: simulatorButtonClass computed and associated CSS
classes that duplicated global button styles.

7 days agofeat(ui): add OCPP version column to charging stations table
Jérôme Benoit [Wed, 18 Mar 2026 22:25:38 +0000 (23:25 +0100)] 
feat(ui): add OCPP version column to charging stations table

Display ocppVersion from stationInfo between Registration Status and
Template columns.

7 days agofix: use truncateId consistently for all user identifiers in logs
Jérôme Benoit [Wed, 18 Mar 2026 22:21:10 +0000 (23:21 +0100)] 
fix: use truncateId consistently for all user identifiers in logs

Replace 16 bare idTag/identifier.value references and 4 manual
substring(0,8) truncations with truncateId() across OCPP 1.6
ResponseService, IncomingRequestService, auth adapters, strategies,
and helpers.

User identifiers (RFID tags, auth tokens) are now consistently
truncated in all log output to prevent sensitive data exposure.

7 days agofix: preserve EVSE and connector IDs in configuration persistence
Jérôme Benoit [Wed, 18 Mar 2026 22:00:00 +0000 (23:00 +0100)] 
fix: preserve EVSE and connector IDs in configuration persistence

Serialization (buildConnectorsStatus, buildEvsesStatus) now saves
[id, status] tuples instead of flat arrays, preserving EVSE and
connector IDs per OCPP 2.0.1 §7.

Deserialization detects both formats transparently: new tuple format
uses explicit IDs, legacy flat array format falls back to array index.

Add checkEvsesConfiguration template validation enforcing §7.2
connector numbering (EVSE 0: connector 0 only, EVSE ≥1: connectors
start at 1).

Add tests for ID preservation across serialization for both connectors
and EVSEs.

7 days agofix: prevent tests from polluting production log files
Jérôme Benoit [Wed, 18 Mar 2026 20:33:51 +0000 (21:33 +0100)] 
fix: prevent tests from polluting production log files

Set NODE_ENV=test via cross-env in all three test scripts (test,
test:debug, test:coverage). Logger checks NODE_ENV and sets silent
mode, preventing file writes to logs/combined.log and logs/error.log
during test runs.

7 days agotest: move truncateId tests from InMemoryAuthCache to Utils
Jérôme Benoit [Wed, 18 Mar 2026 20:07:13 +0000 (21:07 +0100)] 
test: move truncateId tests from InMemoryAuthCache to Utils

truncateId is a general utility function in src/utils/, not a cache
feature. Its tests belong in the utils test file.

7 days agofix(ocpp): replace this.constructor.name with moduleName in base class logs
Jérôme Benoit [Wed, 18 Mar 2026 19:53:19 +0000 (20:53 +0100)] 
fix(ocpp): replace this.constructor.name with moduleName in base class logs

Minification mangles class names, causing logs like 'ln.responseHandler'
instead of 'OCPP20ResponseService.responseHandler' in production builds.

Add abstract moduleName property to OCPPResponseService and
OCPPIncomingRequestService base classes, implemented by all four
subclasses using their file-level moduleName constant.

7 days agorefactor(test): remove duplicate certificate passthrough tests from broadcast channel
Jérôme Benoit [Wed, 18 Mar 2026 19:04:12 +0000 (20:04 +0100)] 
refactor(test): remove duplicate certificate passthrough tests from broadcast channel

These 3 tests duplicated coverage already provided by
OCPP20RequestService-ISO15118.test.ts which tests the same code path
through the full requestHandler pipeline.

Add JSDoc descriptions to buildTransactionEvent implementation to
satisfy jsdoc/require-param-description lint rule.

7 days agotest(ocpp): add call chain integration tests for both OCPP stacks
Jérôme Benoit [Wed, 18 Mar 2026 18:49:02 +0000 (19:49 +0100)] 
test(ocpp): add call chain integration tests for both OCPP stacks

Verify the single-path contract: requestHandler(minimal params) →
buildRequestPayload(constructs) → sendMessage(complete payload).

OCPP 2.0: StatusNotification, TransactionEvent (with default resolution
for triggerReason, transactionId, connectorId from evse), Heartbeat,
and rawPayload bypass.

OCPP 1.6: StatusNotification (errorCode added by builder),
StartTransaction (meterStart/timestamp enrichment), StopTransaction
(meterStop/timestamp enrichment), Heartbeat.

Remove deleted TransactionContextFixtures from TEST_STYLE_GUIDE.

7 days agorefactor(ocpp2): extract buildTransactionEvent as standalone function, remove dead...
Jérôme Benoit [Wed, 18 Mar 2026 18:32:25 +0000 (19:32 +0100)] 
refactor(ocpp2): extract buildTransactionEvent as standalone function, remove dead context code

Extract buildTransactionEvent from OCPP20ServiceUtils static method to
exported standalone function, consistent with buildStatusNotificationRequest
and buildMeterValue.

Remove unused context overload from buildTransactionEvent and
sendTransactionEvent — all production callers pass triggerReason directly.

Remove dead code: OCPP20TransactionContext interface (not in OCPP 2.0.1
specs), selectTriggerReason method, TransactionContextFixtures, and
associated tests.

7 days agorefactor(ocpp): add rawPayload bypass, resolve minimal params in buildRequestPayload...
Jérôme Benoit [Wed, 18 Mar 2026 16:59:56 +0000 (17:59 +0100)] 
refactor(ocpp): add rawPayload bypass, resolve minimal params in buildRequestPayload, fix test types

Add rawPayload option to RequestParams for offline queue replay to
explicitly bypass buildRequestPayload instead of heuristic detection.

Make buildRequestPayload resolve missing TransactionEvent fields from
station context (connectorId from evse, transactionId generation,
triggerReason defaults) so the broadcast channel passthrough works.

Remove pre-built payload guard from OCPP 1.6 STATUS_NOTIFICATION.

Replace Record<string, unknown> downgrades in tests with proper OCPP
types (Partial<OCPP20TransactionEventRequest>, RequestParams).

7 days agorefactor(ocpp): make buildRequestPayload the authoritative builder for all commands
Jérôme Benoit [Wed, 18 Mar 2026 16:13:49 +0000 (17:13 +0100)] 
refactor(ocpp): make buildRequestPayload the authoritative builder for all commands

buildRequestPayload now calls the centralized builders for
TRANSACTION_EVENT (via buildTransactionEvent) and STATUS_NOTIFICATION
(via buildStatusNotificationRequest) in both OCPP versions, matching
the existing pattern for START_TRANSACTION/STOP_TRANSACTION in 1.6.

Callers pass minimal params (eventType, connectorId, status, etc.)
and buildRequestPayload constructs the complete spec-compliant payload.

sendTransactionEvent's offline path builds directly for queueing since
the queue stores pre-built payloads sent as-is on reconnect.

7 days agorefactor(ocpp): use buildStatusNotificationRequest helper in TriggerMessage handlers
Jérôme Benoit [Wed, 18 Mar 2026 15:03:31 +0000 (16:03 +0100)] 
refactor(ocpp): use buildStatusNotificationRequest helper in TriggerMessage handlers

Replace inline StatusNotification payload construction in both OCPP 1.6
and 2.0 TriggerMessage handlers with the centralized
buildStatusNotificationRequest helper. Export the helper from
OCPPServiceUtils to make it available.

This eliminates 5 inline duplications of the same payload structure
that risked diverging from the single source of truth.

7 days agorefactor(ocpp): harmonize buildRequestPayload switch structure across versions
Jérôme Benoit [Wed, 18 Mar 2026 14:49:05 +0000 (15:49 +0100)] 
refactor(ocpp): harmonize buildRequestPayload switch structure across versions

Group passthrough cases into fall-through blocks in both OCPP 1.6 and
2.0 buildRequestPayload, giving both files a symmetric structure:
grouped passthroughs, heartbeat empty object, enrichment cases, default
error.