]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
fix(simulator): add connector Finishing state lifecycle simulation (#1227) (#1812)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 28 Apr 2026 12:06:34 +0000 (14:06 +0200)
committerGitHub <noreply@github.com>
Tue, 28 Apr 2026 12:06:34 +0000 (14:06 +0200)
commit3578a8b8f0893208b9d6d2229a49c9721aa67144
tree9b7b69c50997b1b1f93f7e649577209467338205
parent4ef0da6ddff7022718007c52ee5615847398f8d1
fix(simulator): add connector Finishing state lifecycle simulation (#1227) (#1812)

* fix(simulator): add finishingStatusDelay tunable to station template

* fix(simulator): delay Available status after transaction end for OCPP 2.0.x

* fix(simulator): guard RemoteStartTransaction during Finishing state

* test(simulator): add finishing delay tests for OCPP 1.6 and 2.0.x

* docs(simulator): document finishingStatusDelay template tunable

* [autofix.ci] apply automated fixes

* refactor(simulator): audit corrections — rename, DRY, double-send, guard, safety

* [autofix.ci] apply automated fixes

* fix(simulator): fix JSDoc placement and document early return safety

* fix(simulator): address review comments — meter values, tests, docs

* fix(simulator): reset connector status before sending Available after delay

* fix(simulator): restore original operation ordering in delay=0 path

* fix(simulator): add debug log for RemoteStart rejection during Finishing state

* fix(simulator): harmonize log messages with existing codebase patterns

* refactor(simulator): extract DRY helpers and fix comment in StopTransaction handler

* fix(simulator): simplify Finishing guard to check status alone in RemoteStartTransaction

* fix(simulator): remove misleading log heuristic in OCPP 2.0 StartTransaction guard

* test(simulator): restructure postTransactionDelay tests per ModuleName-Feature naming convention

* fix(simulator): resolve Mock<Function> type mismatch in OCPP 2.0 postTransactionDelay test

* fix(simulator): prevent double power-divider decrement during shutdown with postTransactionDelay

* fix(simulator): prevent double-stop during shutdown using spec-compliant guards

* fix(simulator): restore resetConnectorStatus after sleep to prevent ATG race condition

* fix(simulator): reconcile stale connector state on boot when transactionId is missing

* [autofix.ci] apply automated fixes

* fix(simulator): also reconcile Finishing state connectors on boot for OCPP 1.6

* fix(simulator): delete transactionId before delay in OCPP 1.6 to prevent duplicate RemoteStop

* fix(simulator): use OCPP16ChargePointStatus in version-specific test code

* fix(simulator): harmonize log messages with existing codebase format

* fix(simulator): make OCPP 1.6 connector unlock unconditional per spec §4.10

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
13 files changed:
README.md
src/charging-station/Helpers.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts
src/charging-station/ocpp/OCPPConnectorStatusOperations.ts
src/charging-station/ocpp/OCPPServiceOperations.ts
src/types/ChargingStationTemplate.ts
src/utils/Constants.ts
tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-RemoteStartTransaction.test.ts
tests/charging-station/ocpp/1.6/OCPP16ResponseService-PostTransactionDelay.test.ts [new file with mode: 0644]
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-PostTransactionDelay.test.ts [new file with mode: 0644]