]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
feat(ocpp2): add configurable firmware signature verification simulation (L01.FR...
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 26 Mar 2026 19:06:53 +0000 (20:06 +0100)
committerGitHub <noreply@github.com>
Thu, 26 Mar 2026 19:06:53 +0000 (20:06 +0100)
commit9d56abe76cf8f9459529e69b1e497a93b8b54031
tree1654e92e0221d9b51e735ccced00153ae6cf95eb
parent5f14c60844e65158b77170ae7f361ffbdf71c57e
feat(ocpp2): add configurable firmware signature verification simulation (L01.FR.03/L01.FR.04) (#1757)

* feat(ocpp2): add FirmwareCtrlr component and signature verification variable

* test(ocpp2): add firmware signature verification failure tests

- Add test for InvalidSignature path when SimulateSignatureVerificationFailure is true
- Add test for normal path when SimulateSignatureVerificationFailure is false (TDD red phase)
- Tests verify lifecycle termination and SecurityEventNotification type correctness
- Evidence: typecheck & lint pass; tests fail as expected (awaiting Task 3 implementation)

* feat(ocpp2): implement configurable firmware signature verification simulation

* docs: update README firmware signature verification note

* fix(ocpp2): address PR review feedback on firmware signature verification

- Await sendSecurityEventNotification in failure path for consistency with success path
- Reorder test assertions: check array length before index access
- Add tick-forward verification that lifecycle stops after InvalidSignature
- Remove redundant standardCleanup() calls already handled by afterEach
- Remove firmware signature verification note from README

* fix(ocpp2): improve firmware update spec conformance and test quality

- L01.FR.07: Move EVSE unavailability check inside wait loop for continuous monitoring
- L01.FR.30: Honor retries/retryInterval with simulated download retry cycle
- Merge retry test into existing DownloadFailed test (DRY)
- Add EVSE continuous monitoring lifecycle test (L01.FR.07)
- Fix assertion ordering: length checks before index access
- Remove as-unknown-as-string cast in favor of String()
- Tighten assert.ok to assert.notStrictEqual where applicable

* fix(tests): type CapturedOCPPRequest.command as OCPP20RequestCommand

- Replace string type with OCPP20RequestCommand enum on CapturedOCPPRequest.command
- Remove 6 unnecessary 'as string' casts across UpdateFirmware and TransactionEvent tests
- Replace 'Unavailable' string literal with OCPP20ConnectorStatusEnumType.Unavailable
- Remove unnecessary optional chaining on non-nullable payload
- Complete @param JSDoc for retries/retryInterval on simulateFirmwareUpdateLifecycle

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* fix(tests): replace flaky sentRequests assertions with mock.method spy in EVSE monitoring test

Mock sendEvseStatusNotifications directly instead of asserting on fire-and-forget
side effects captured in sentRequests. The internal async chain (sendAndSetConnectorStatus
→ dynamic import → requestHandler) needed non-deterministic flushMicrotasks() stacking.
The spy makes assertions synchronous and CI-deterministic.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
README.md
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts
src/types/ocpp/2.0/Common.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CertificateSigned.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-UpdateFirmware.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts
tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts