refactor(charging-station): extract reservation helpers from Helpers.ts (issue #1936 f Phase 1) (#1946)
* refactor(charging-station): extract reservation helpers from Helpers.ts (issue #1936 f)
Phase 1 of the Helpers.ts file split tracked in issue #1936 item (f).
Helpers.ts is 1389 LOC — 5.5x the 250 LOC ceiling documented in
AGENTS.md's programming skill. This PR extracts the smallest cohesive
block (the 4 reservation helpers) into a dedicated file as an initial
step, proving the barrel-preservation pattern so the remaining slices
can follow in subsequent PRs without breaking any callers.
Helpers.ts (1389 -> 1336 LOC) keeps the public API via a barrel
re-export block. Every external caller ('import { ... } from
"./Helpers.js"') continues to work unchanged. Now-unused imports
in Helpers.ts (isPast, Reservation, ReservationTerminationReason)
are dropped.
Apply round-1 review findings on HelpersReservation.ts:
- Banner alignment: 'Copyright ... 2021-2026' → 'Partial Copyright ...
2021-2025' to match sibling files in src/charging-station/ that carry
banners (ChargingStation.ts, Bootstrap.ts, BootstrapStateUtils.ts,
CoherentMeterValuesManager.ts, AutomaticTransactionGenerator.ts,
ChargingStationWorker.ts). A repo-wide year bump to 2026 is out of
scope for this refactor.
- Strip historical narrative from @description per AGENTS.md
documentation convention ('document current state; exclude historical
evolution'). Old text narrated the extraction event ('Extracted from
./Helpers as the first slice of the issue #1936 (item f) file split'),
which the commit message + git blame already carry permanently.
Replace with an operational spec describing the module's current
responsibility: reservation-state predicates + bulk expired-reservation
cleanup.
- Add missing @returns on removeExpiredReservations. Every other
exported helper documents its return; the async cleanup did not.
New wording also encodes the WHY (Promise.allSettled → never
rethrows, individual failures logged) that was previously only
implicit in the body.
* docs(helpers-reservation): harmonize JSDoc voice across predicates (issue #1936 f)
Align the three reservation predicates to a single JSDoc voice:
'hasPendingReservation' and 'hasPendingReservations' were 'Checks
if …'; 'hasReservationExpired' was already 'Determines whether …'
after the R1 doc-fix. Standardize the two predicates to
'Determines whether …' so all three read consistently. Leave
'removeExpiredReservations' as imperative ('Removes every …') since
it is a mutation, not a predicate — different verb class,
appropriate.
Per AGENTS.md 'Naming coherence' — semantically accurate names
across code and documentation, avoid synonyms that create
ambiguity.