Repository navigation
Bump @typescript-eslint/eslint-plugin from 5.24.0 to 5.25.0 - #4
Closed
dependabot[bot] wants to merge 1 commit into
Closed
dependabot[bot] wants to merge 1 commit into
dependabot[bot] wants to merge 1 commit into
Conversation
Contributor
Author
|
The following labels could not be found: |
Contributor
|
@dependabot rebase |
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.24.0 to 5.25.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.25.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
dependabot
Bot
force-pushed
the
dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.25.0
branch
from
May 19, 2022 07:48
764be81 to
14b337b
Compare
Contributor
Author
|
Superseded by #11. |
dependabot
Bot
deleted the
dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-5.25.0
branch
May 24, 2022 17:00
jerome-benoit
added a commit
that referenced
this pull request
May 17, 2026
…conventions Address review findings on PR #1858: - HIGH #1: Phase split start() lifecycle. Add public Bootstrap.startUIServer() that always brings up the UI server (and reconstructs template indexes before accepting requests). start.ts unconditionally calls startUIServer() and only gates Bootstrap.start() on shouldAutoStart(), so a persisted stopped state no longer turns the simulator into a zombie process. - HIGH #2: Add canonical default. New defaultPersistState constant and Configuration.getPersistState() accessor matching the existing defaultUIServerConfiguration / defaultWorkerConfiguration pattern. Bootstrap.persistStateEnabled now delegates instead of inlining ?? true. - MEDIUM #3: Document persistState tunable and SIMULATOR_COLD_START environment override in README.md. - MEDIUM #4: writeStateFile and deleteStateFile now swallow filesystem errors via handleFileException with throwError:false, mirroring watchJsonFile and the storage layer. Persistence failures no longer surface as misleading 'Startup error' / 'Shutdown error'. - MEDIUM #5: reconstructTemplateIndexes runs inside startUIServer() before uiServer.start(), closing the race where UI requests could arrive before index reconstruction completes. - LOW #7: Add formatLogPrefix() utility and use it in BootstrapStateUtils, removing the leading-space artifact when logPrefixFn is undefined. - LOW #8: On state file schema mismatch, quarantine to <path>.v<N>.bak instead of silently deleting, allowing forensics during partial schema rollouts. JSON parse errors still delete (true corruption, unrecoverable). - LOW #9: Move state.json from dist/assets/configurations/ to dist/assets/. Drops the fragile basename-based filter from reconstructTemplateIndexes and separates control file from per-station configuration files. Drop shouldAutoStart() from IBootstrap interface (boot-time concern, no UI service consumer needs it). The method stays public on the concrete Bootstrap class for start.ts. Tests: align fixtures with new state.json location, add quarantine assertion, add non-fatal writeStateFile assertion, drop obsolete state.json filter test.
jerome-benoit
added a commit
that referenced
this pull request
May 17, 2026
… template indexes on startup (#1858) * feat: persist minimal simulator state and reconstruct template indexes on startup - Add persistState boolean to ConfigurationData (default: true) - Add SimulatorState to FileType enum - Add simulatorState to AsyncLockType enum - Implement BootstrapStateUtils with: - readStateFile: reads and validates state.json with schema version check - writeStateFile: atomic write via tmp+rename with AsyncLock - reconstructTemplateIndexes: scans per-station config files to rebuild indexes - deleteStateFile: safe file deletion - Integrate into Bootstrap: - reconstructTemplateIndexes called in start() before worker spawn - State file written on start() (started:true) and stop() (started:false) - shouldAutoStart() reads state file to control auto-start behavior - persistStateEnabled getter checks persistState config and SIMULATOR_COLD_START env - Update start.ts to conditionally start based on shouldAutoStart() - Handle edge cases: corrupt files, missing fields, incompatible schema version - Add comprehensive tests for all state persistence and reconstruction scenarios Closes #1020 * refactor(bootstrap): harmonize persisted state feature with codebase conventions Address review findings on PR #1858: - HIGH #1: Phase split start() lifecycle. Add public Bootstrap.startUIServer() that always brings up the UI server (and reconstructs template indexes before accepting requests). start.ts unconditionally calls startUIServer() and only gates Bootstrap.start() on shouldAutoStart(), so a persisted stopped state no longer turns the simulator into a zombie process. - HIGH #2: Add canonical default. New defaultPersistState constant and Configuration.getPersistState() accessor matching the existing defaultUIServerConfiguration / defaultWorkerConfiguration pattern. Bootstrap.persistStateEnabled now delegates instead of inlining ?? true. - MEDIUM #3: Document persistState tunable and SIMULATOR_COLD_START environment override in README.md. - MEDIUM #4: writeStateFile and deleteStateFile now swallow filesystem errors via handleFileException with throwError:false, mirroring watchJsonFile and the storage layer. Persistence failures no longer surface as misleading 'Startup error' / 'Shutdown error'. - MEDIUM #5: reconstructTemplateIndexes runs inside startUIServer() before uiServer.start(), closing the race where UI requests could arrive before index reconstruction completes. - LOW #7: Add formatLogPrefix() utility and use it in BootstrapStateUtils, removing the leading-space artifact when logPrefixFn is undefined. - LOW #8: On state file schema mismatch, quarantine to <path>.v<N>.bak instead of silently deleting, allowing forensics during partial schema rollouts. JSON parse errors still delete (true corruption, unrecoverable). - LOW #9: Move state.json from dist/assets/configurations/ to dist/assets/. Drops the fragile basename-based filter from reconstructTemplateIndexes and separates control file from per-station configuration files. Drop shouldAutoStart() from IBootstrap interface (boot-time concern, no UI service consumer needs it). The method stays public on the concrete Bootstrap class for start.ts. Tests: align fixtures with new state.json location, add quarantine assertion, add non-fatal writeStateFile assertion, drop obsolete state.json filter test. * test(bootstrap): align BootstrapStateUtils tests with project style guide - Rename BootstrapState.test.ts to BootstrapStateUtils.test.ts to match the source module name (TEST_STYLE_GUIDE.md §1: 'Files: ModuleName.test.ts'). - Add mandatory standardCleanup() in afterEach (TEST_STYLE_GUIDE.md §3), matching the convention used by Configuration.test.ts, FileUtils.test.ts, ErrorUtils.test.ts and ConfigurationKeyUtils.test.ts. * fix(bootstrap): address review findings on persisted simulator state Distinguish UI-initiated stop from signal/restart via a private StopReason enum, so SIGINT/SIGTERM/SIGQUIT and config-reload restarts no longer flip the persisted state to stopped (HIGH-1). Short-circuit persistStateEnabled when the UI server is disabled, since persistence has no recovery channel without a UI; warn once on the inconsistent configuration (HIGH-2). Reconstruct template indexes via a shared prepareTemplateStatistics helper called from constructor and restart, not only from startUIServer, to prevent index collisions on config-reload of UI-added stations (MED-3). Move state file from dist/assets/state.json (wiped by pnpm build) to dist/assets/configurations/.simulator-state.json; filter dot-prefixed metadata files in reconstructTemplateIndexes so the state file co-located with charging station configurations is silently skipped (MIN-10). Clean up the .tmp file on atomic-rename failure in writeStateFile and guard readStateFile against JSON null/primitive/array content with an explicit message (MIN-7, MIN-8). Unify path computations into readonly assetsDir/configurationsDir/ stateFilePath fields, deduplicate setChargingStationTemplates via a syncUIServerTemplates helper, and route the SIMULATOR_COLD_START env var name through Constants.ENV_SIMULATOR_COLD_START (MIN-5, MIN-6). Export DEFAULT_PERSIST_STATE and add the persistState entry to config-template.json so the tunable is discoverable (MED-4). Update README to document the new state file path, the UI server requirement, and the signal-shutdown semantics. Test coverage added for tmp cleanup, JSON null/primitive/array guards, and dot-prefixed metadata filtering; the misleading 'read-only directory' test is renamed to reflect the actual OS-rejected-path scenario (MIN-9). * docs(bootstrap): clarify persisted state semantics from review feedback - README: drop developer-internals sentence on template index reconstruction from the persistState row - TemplateStatistics: document the `added` (process-scoped) vs `indexes` (process+disk-scoped) distinction exposed via SimulatorState - IBootstrap: document the contract scope (UI-server-facing, excluding process-lifecycle helpers and the internal StopReason) - formatLogPrefix: document the trailing-space contract - reconstructTemplateIndexes: refine the warn message wording for non-station configuration files (level unchanged) * refactor(utils): default formatLogPrefix prefix to logPrefix Avoids silent loss of the timestamp when callers do not pass a module-specific prefix function. Aligns with the existing convention where every module-level logPrefix delegates to Utils.logPrefix. --------- Co-authored-by: Agent <agent@github.com> Co-authored-by: Jérôme Benoit <jerome.benoit@piment-noir.org> Co-authored-by: Jérôme Benoit <jerome.benoit@sap.com>
jerome-benoit
added a commit
that referenced
this pull request
Jul 6, 2026
Two review findings from PR #1959 addressed together — both are internal tidying with no behavior change. 1. Extract Zod field-error helpers out of ConfigurationMigrations ConfigurationMigrations owned the FieldError interface plus mapZodIssuesToFieldErrors and formatFieldErrorsSummary, but those helpers are Zod-issue formatters used by TemplateValidation and ConfigurationValidation — neither of which is a configuration-migration concern. Move the interface and both helpers into a dedicated single- purpose module src/utils/FieldError.ts, re-export via the utils barrel, and route all three consumers to import from ./FieldError.js: - src/utils/ConfigurationMigrations.ts now imports the FieldError type it still uses in remapDeprecatedKeys and RemapDeprecatedKeysResult. - src/utils/ConfigurationValidation.ts imports the type plus both helpers. - src/charging-station/TemplateValidation.ts switches from the deep import of ConfigurationMigrations to the deep import of FieldError. The utils/index.ts barrel gains a FieldError export block placed alphabetically between ErrorUtils and FileUtils. 2. Add TEST_SUPERVISION_URL_ALT_PORT for two-URL fixtures tests/utils/ConfigurationSchema.test.ts had a mixed literal/constant array — [TEST_SUPERVISION_URL, 'ws://localhost:8081'] — used to verify supervisionUrls accepts a string array. Both entries now come from TestNetworkConstants: the alternate port is DEFAULT_UI_SERVER_PORT + 1, keeping the same 'derived from production defaults' contract. The TestNetworkConstants file also factors HOST/PORT into local constants to keep the two URL definitions DRY. Additional review-finding dispositions: - Finding #3 (visual QA on the DEFAULT_SKIN fallback change): already regression-locked by existing Vitest coverage — tests/unit/skins/registry.test.ts:12 pins DEFAULT_SKIN === 'modern', tests/unit/shared/composables/useSkin.test.ts exercises switchSkin(DEFAULT_SKIN) and asserts activeSkinId defaults to DEFAULT_SKIN. No additional test needed. - Finding #4 (Validation vs Validator terminology): withdrawn on re-inspection. *Validation.ts modules host the validation process (validateConfiguration, ConfigurationValidationError). AuthConfigValidator is a validator entity object with a .validate() method. The suffix distinguishes 'process module' from 'entity object' — intentional and consistent, not divergent. - Finding #5 (spec coverage for VariableCharacteristics.valueList and EventData.actualValue): pre-existing feature-not-implemented gaps in the simulator (grep confirms neither valueList nor NotifyEvent code paths exist under src/charging-station/ocpp/2.0/). Bounding these would require implementing the underlying features first; out of scope for this review-response commit. Public API surface unchanged. Gates green (format / typecheck / lint / build / test); circular-deps baseline of 62 preserved.
jerome-benoit
added a commit
that referenced
this pull request
Jul 6, 2026
…k refactors) (#1959) * fix(ocpp/2.0): correct spec conformance for value size constants OCPP 2.0.1 mandates two distinct value size caps that the codebase collapsed into a single MAX_VARIABLE_VALUE_LENGTH = 2500 constant, which caused the SetVariable code path to accept payloads up to 2.5x the spec-defined limit (§2.1.20: ConfigurationValueSize.maxLimit = 1000; SetVariableDataType.attributeValue is string[0..1000]) and mislabeled the reporting cap (§2.1.21: ReportingValueSize.maxLimit = 2500). Replace MAX_VARIABLE_VALUE_LENGTH with two spec-cited constants: - MAX_CONFIGURATION_VALUE_SIZE = 1000 (SetVariable path, §2.1.20) - MAX_REPORTING_VALUE_SIZE = 2500 (GetBaseReport / reporting truncation, §2.1.21) Remap all consumers: - OCPP20VariableRegistry: ConfigurationValueSize maxLimit -> MAX_CONFIGURATION_VALUE_SIZE; ReportingValueSize + OCPP 2.1 ValueSize maxLimit -> MAX_REPORTING_VALUE_SIZE. - OCPP20VariableManager readAttributeValue reporting truncation -> MAX_REPORTING_VALUE_SIZE. - OCPP20VariableManager setVariable effective-limit fallback + absolute cap -> MAX_CONFIGURATION_VALUE_SIZE. - Test fixtures resetReportingValueSize / resetValueSizeLimits use each spec constant according to which variable they seed. Public API surface is not affected (constants are internal to ocpp/2.0). * refactor: dedupe zod field-error mapping, centralize ui/web skin/theme keys Three independent cleanups from the from-zero audit, bundled to share quality gates. 1. Extract shared Zod-issue to FieldError helpers (z-A1-F1) Two identical inline duplications (in ConfigurationValidation and TemplateValidation) mapped ZodError.issues to { message, path } records and joined them into the same ' - <path>: <message>' field summary. Extract two exported helpers in ConfigurationMigrations: - mapZodIssuesToFieldErrors(zodError) - formatFieldErrorsSummary(fieldErrors) Update both call sites; TemplateValidationError.fieldErrors is retyped from an inline object array to the shared FieldError (structurally identical, public surface preserved). 2. Centralize ui/web skin/theme storage keys in core/Constants (z-A2-F3) SKIN_STORAGE_KEY, DEFAULT_THEME, and THEME_STORAGE_KEY previously lived in the composables (useSkin.ts, useTheme.ts) even though main.ts and SkinLoadError.vue imported them from there for storage bootstrap, mirroring the already-centralized DEFAULT_SKIN. Move all three to ui/web/src/core/Constants.ts, re-export via the @/core barrel, and update the composables plus the two external consumers to import from @/core. Behaviour and localStorage keys are unchanged. 3. Adopt ui-common extractErrorMessage at 3 sites (z-A2-F4) Replace three copies of the 'error instanceof Error ? error.message : String(error)' pattern with extractErrorMessage(error) (ui-common already used this helper in ui/cli/src/config/loader.ts, output/json.ts, output/formatter.ts, and ui/web/src/skins/modern/utils/errors.ts): - ui/cli/src/commands/action.ts - ui/cli/src/commands/skill.ts - ui/web/src/shared/composables/useSkin.ts Rationale for a deferred audit item (z-A1-F2, UIServerSecurity DEFAULT_* constants to global Constants): declined. The six constants (DEFAULT_MAX_PAYLOAD_SIZE_BYTES, DEFAULT_RATE_LIMIT, DEFAULT_RATE_WINDOW_MS, DEFAULT_MAX_STATIONS, DEFAULT_MAX_TRACKED_IPS, DEFAULT_COMPRESSION_THRESHOLD_BYTES) are ui-server-security tunables used only within src/charging-station/ui-server/. Promoting them into the charging-station-wide Constants class would blur module boundaries with no consumer benefit; co-location with the security domain is intentional. Public API surface is unchanged. All gates pass (format / typecheck / lint / build / test) across root, ui/cli, and ui/web; skott circular-deps baseline of 62 preserved. * refactor(ui/web): align default-skin fallback and extract host:port literal Two independent slop cleanups in ui/web from the from-zero audit. 1. Use canonical DEFAULT_SKIN in place of the 'classic' literal fallback (z-A2-F6) `ui/web/src/main.ts:62` used a hardcoded 'classic' as the fallback for `config.skin ?? 'classic'` even though the codebase declares the canonical default in `ui/web/src/core/Constants.ts`: export const DEFAULT_SKIN = 'modern' and `SkinLoadError.vue` already uses DEFAULT_SKIN as the recovery target. The magic string kept the two out of sync: a fresh boot with neither localStorage nor config.skin would land on 'classic' while the rest of the app treated 'modern' as the default. Route the fallback through DEFAULT_SKIN so there is a single source of truth for the default skin. Behavior change (intentional): first boot with no persisted skin and no `config.skin` now initializes on 'modern' (the declared default) instead of 'classic'. Users who explicitly set a skin (via config or the skin selector) are unaffected because their choice is honored before the fallback kicks in. 2. Extract 'host:port' literal in UIClient WebSocket adapter (z-A2-F7) Three interpolations of `${config.host}:${config.port.toString()}` in the onerror/onopen handlers of `createClientWithAbort` are collapsed into a single `uiServerAddress` local computed once at the top of the closure. Zero behavior change; just removes the triplicated interpolation. Skipped audit item (z-A2-F5, adopt `nonEmptyStringOrUndefined` in `useSetUrlForm` for supervisionUser/supervisionPassword): declined. Per the WebSocket protocol contract documented in README.md ('setSupervisionUrl' procedure), an empty string `""` for user/password explicitly clears the existing CSMS auth, while `undefined` preserves it. Wrapping the form values with `nonEmptyStringOrUndefined` would silently change the UX: leaving a password field blank would preserve the old password instead of clearing it, with no user-facing indication of the change. Keeping the raw pass-through matches the documented protocol semantics. Gates green (format / typecheck / lint / build / test:coverage) for ui/web; root and ui/cli untouched. * refactor: prune unused barrel exports and downgrade internal-only symbols Five symbols were exported from src/utils/index.ts and src/types/index.ts but have zero consumers in src/, tests/, ui/common/, ui/cli/, or ui/web/. Prune them from the barrels; since each is also unused outside its defining file, downgrade the file-level 'export' keyword so the internal-only status is enforced at compile time (except ElementsPerWorkerType which had no consumer at all and is fully removed). Pruned barrel exports (root package has no library API surface — package.json 'exports' points only to dist/start.js — so unused barrel entries are dead): - DEFAULT_PERSIST_STATE (src/utils/index.ts): used only inside Configuration.ts:196; barrel entry removed; definition downgraded from 'export const' to 'const'. - UIServerAccessPolicySchema (src/utils/index.ts): used only inside ConfigurationSchema.ts:243 as .optional() nested schema; barrel entry removed; 'export const' -> 'const'. - UIServerAuthenticationSchema (src/utils/index.ts): used only inside ConfigurationSchema.ts:244 as .optional() nested schema; barrel entry removed; 'export const' -> 'const'. - AtomicWriteOptions (src/utils/index.ts): used only inside FileUtils.ts as parameter type for atomicWriteFile / atomicWriteFileSync; barrel entry removed; 'export interface' -> 'interface'. - ElementsPerWorkerType (src/types/index.ts + ConfigurationData.ts): no consumer anywhere; both barrel entry and type alias definition removed. Kept (audit misclassified as dead): - isCertificateBased, isOCPP16Type, isOCPP20Type, requiresAdditionalInfo: all four exercised by tests/charging-station/ocpp/auth/types/AuthTypes.test.ts — pruning would drop test coverage. - StrictTemplateSchema (src/charging-station/index.ts): documented escape hatch ('For CI strict mode' per TemplateSchema.ts:309); intentional public surface for ad-hoc strict validation with no in-repo consumer. Kept to honor documented intent. All gates pass (format / typecheck / lint / build / test across root, ui/cli, ui/web); circular-deps baseline preserved. * refactor(auth): rename ConfigValidator to AuthConfigValidator for name coherence The file src/charging-station/ocpp/auth/utils/ConfigValidator.ts exports a single object under the name AuthConfigValidator and uses the string 'AuthConfigValidator' as its moduleName for log prefixes, but the file itself was named after a more generic 'ConfigValidator' concept. Two consumers and the test file already refer to the symbol as AuthConfigValidator, and the generic file name overlaps semantically with the unrelated src/utils/ConfigurationValidation.ts (application config validation) — grep 'ConfigValidator' surfaces both, which is easy to misread. Rename via 'git mv' to preserve history: - src/charging-station/ocpp/auth/utils/ConfigValidator.ts -> src/charging-station/ocpp/auth/utils/AuthConfigValidator.ts - tests/charging-station/ocpp/auth/utils/ConfigValidator.test.ts -> tests/charging-station/ocpp/auth/utils/AuthConfigValidator.test.ts Update imports in AuthComponentFactory and OCPPAuthServiceImpl to reference the new file path. No source content changes; exported symbol name and module identity are unchanged. Skipped audit items in this tier: - z-A1-F3 (OCPP_WEBSOCKET_TIMEOUT_MS -> global Constants): declined. The constant already lives in src/charging-station/ocpp/OCPPConstants.ts, which is the OCPP-domain constants class. Promoting it to the charging-station- wide Constants would blur module boundaries with no consumer benefit — consistent with the same rationale that deferred UIServerSecurity DEFAULT_* centralization. - z-A1-F4 (rename DEFAULT_ATG_WAIT_TIME_MS -> DEFAULT_ATG_RETRY_DELAY_MS): declined. All three call sites in AutomaticTransactionGenerator (waitChargingStationAvailable, waitConnectorAvailable, waitRunningTransactionStopped) are sleep() delays inside 'wait for condition' polling while-loops, not retry loops on a failing operation. 'RETRY_DELAY' would misdescribe the semantics; the current 'WAIT_TIME' is the accurate label. All gates pass (format / typecheck / lint / build / test). * test: use TEST_SUPERVISION_URL constant instead of hardcoded ws://localhost:8080 Six test files repeated the literal 'ws://localhost:8080' 15 times as a supervision URL fixture. tests/utils/TestNetworkConstants.ts already provides the canonical TEST_SUPERVISION_URL: export const TEST_SUPERVISION_URL = `ws://${Constants.DEFAULT_UI_SERVER_HOST}:${Constants.DEFAULT_UI_SERVER_PORT.toString()}` Route each fixture through that constant so a change to the production UI server host/port defaults propagates to every test without a search/replace sweep. Files updated: - tests/charging-station/TemplateValidation.test.ts (6 sites) - tests/charging-station/TemplateMigrations.test.ts (3 sites) - tests/charging-station/TemplateSchema.test.ts (1 site) - tests/utils/ConfigurationSchema.test.ts (3 sites — including the first entry of the ['ws://localhost:8080', 'ws://localhost:8081'] array; the second literal is intentionally distinct and stays hardcoded) - tests/utils/ConfigurationValidation.test.ts (1 site) - tests/performance/storage/MikroOrmStorage.test.ts (1 site) The JSDoc example in tests/charging-station/mocks/MockWebSocket.ts is preserved as-is (documentation, not a fixture). Fixture values, test assertions, and behavior are unchanged. All gates pass (format / typecheck / lint / build / test). * refactor: reword narrative comments and anchor non-systemic eslint-disable directives Two audit tiers bundled to share the gate run. Tier 8 - narrative/imperative comments -> state-describing form: Three comments in touched files were rewritten from developer-narrative to state-describing per the repo comment convention. - src/charging-station/ocpp/2.0/OCPP20CertificateManager.ts 'We need the directory: basePath/ChargingStationCertificate' is replaced with a two-line state description of what dirPath is and how it relates to the getCertificatePath return value. Anchors the non-obvious resolve(certFilePath, '..') derivation to the surrounding directory check. - src/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.ts 'Should not reach here due to canHandle check, but handle gracefully' becomes 'Unreachable when the canHandle contract holds; defensive fallback for unsupported OCPP versions'. 'Must have certificate data in the identifier' becomes 'The identifier carries certificate data' (paired with a matching rewrite of 'Certificate authentication must be enabled' -> '...is enabled per configuration'). Tier 9 - '-- reason' anchors on non-systemic eslint-disable directives: Sixteen one-off eslint-disable-next-line directives now carry the '-- reason' anchor already used elsewhere in the repo (e.g. UIServerFactory.ts, OCPPResponseService.ts). Systemic directives (repeated idioms such as @typescript-eslint/no-redeclare for the enum + type declaration-merging pattern, restrict-template-expressions for logger calls, no-extraneous-class for the Constants classes, no-unnecessary-type-parameters for contravariant handler bridges) are left unchanged in this pass — those are pattern-level choices that belong in a repo-wide rationale, not per-site. Anchored one-offs: - src/types/ocpp/ErrorType.ts @cspell/spellchecker - src/charging-station/ChargingStation.ts @typescript-eslint/no-deprecated - src/charging-station/ChargingStation.ts promise/no-promise-in-callback - src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts three @typescript-eslint/no-invalid-void-type + one promise/catch-or-return - src/charging-station/TemplateMigrations.ts @typescript-eslint/no-dynamic-delete - src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts no-fallthrough - src/charging-station/ocpp/OCPPServiceUtils.ts @typescript-eslint/no-unsafe-assignment - src/charging-station/ocpp/OCPPRequestService.ts @typescript-eslint/no-this-alias - src/charging-station/Bootstrap.ts two @typescript-eslint/unbound-method - src/worker/WorkerSet.ts promise/no-promise-in-callback - ui/web/src/shared/composables/useTheme.ts no-void - ui/web/src/shared/composables/useAsyncAction.ts no-void Behavior is unchanged; every directive still disables the same rule at the same line, only the rationale is now recorded inline. Gates green (format / typecheck / lint / build / test) across root and ui/web; circular-deps baseline of 62 preserved. * refactor(utils): extract FieldError into a single-purpose module Two review findings from PR #1959 addressed together — both are internal tidying with no behavior change. 1. Extract Zod field-error helpers out of ConfigurationMigrations ConfigurationMigrations owned the FieldError interface plus mapZodIssuesToFieldErrors and formatFieldErrorsSummary, but those helpers are Zod-issue formatters used by TemplateValidation and ConfigurationValidation — neither of which is a configuration-migration concern. Move the interface and both helpers into a dedicated single- purpose module src/utils/FieldError.ts, re-export via the utils barrel, and route all three consumers to import from ./FieldError.js: - src/utils/ConfigurationMigrations.ts now imports the FieldError type it still uses in remapDeprecatedKeys and RemapDeprecatedKeysResult. - src/utils/ConfigurationValidation.ts imports the type plus both helpers. - src/charging-station/TemplateValidation.ts switches from the deep import of ConfigurationMigrations to the deep import of FieldError. The utils/index.ts barrel gains a FieldError export block placed alphabetically between ErrorUtils and FileUtils. 2. Add TEST_SUPERVISION_URL_ALT_PORT for two-URL fixtures tests/utils/ConfigurationSchema.test.ts had a mixed literal/constant array — [TEST_SUPERVISION_URL, 'ws://localhost:8081'] — used to verify supervisionUrls accepts a string array. Both entries now come from TestNetworkConstants: the alternate port is DEFAULT_UI_SERVER_PORT + 1, keeping the same 'derived from production defaults' contract. The TestNetworkConstants file also factors HOST/PORT into local constants to keep the two URL definitions DRY. Additional review-finding dispositions: - Finding #3 (visual QA on the DEFAULT_SKIN fallback change): already regression-locked by existing Vitest coverage — tests/unit/skins/registry.test.ts:12 pins DEFAULT_SKIN === 'modern', tests/unit/shared/composables/useSkin.test.ts exercises switchSkin(DEFAULT_SKIN) and asserts activeSkinId defaults to DEFAULT_SKIN. No additional test needed. - Finding #4 (Validation vs Validator terminology): withdrawn on re-inspection. *Validation.ts modules host the validation process (validateConfiguration, ConfigurationValidationError). AuthConfigValidator is a validator entity object with a .validate() method. The suffix distinguishes 'process module' from 'entity object' — intentional and consistent, not divergent. - Finding #5 (spec coverage for VariableCharacteristics.valueList and EventData.actualValue): pre-existing feature-not-implemented gaps in the simulator (grep confirms neither valueList nor NotifyEvent code paths exist under src/charging-station/ocpp/2.0/). Bounding these would require implementing the underlying features first; out of scope for this review-response commit. Public API surface unchanged. Gates green (format / typecheck / lint / build / test); circular-deps baseline of 62 preserved. * chore(charging-station): unify TemplateValidation utils imports through the barrel Round-2 review finding: TemplateValidation.ts mixed two import styles for the same target directory. Lines 6-10 pulled FieldError + helpers via a deep import ('../utils/FieldError.js') while line 11 pulled other utilities via the barrel ('../utils/index.js'). Both symbol groups originate from src/utils/ and the barrel already re-exports the FieldError trio (utils/ index.ts:43-47). Merge both into a single barrel import block, alphabetically ordered (case-insensitive) per the repo's perfectionist convention: assertIsJsonObject, clone, type FieldError, formatFieldErrorsSummary, isEmpty, isNotEmptyString, logger, mapZodIssuesToFieldErrors. The 'type FieldError' inline qualifier is kept in the mixed named-import (same pattern used by utils/index.ts's own FieldError re-export block). Behavior unchanged; only import mechanics shift. All gates pass (format / typecheck / lint / build / test); skott circular- deps baseline of 62 preserved.
jerome-benoit
added a commit
that referenced
this pull request
Jul 6, 2026
…elpers Round-3 review (subagent #4 harmonization) found interruptibleSleep was private to ATG and could not be reused, plus the three ATG polling helpers (waitChargingStationAvailable / waitConnectorAvailable / waitRunningTransactionStopped) called plain sleep() and were blind to the abort signal. Changes: 1. Move interruptibleSleep from AutomaticTransactionGenerator.ts to src/utils/Utils.ts next to sleep(). Export from utils/index.ts. 2. Reorder to declare 'timeout' before the 'onAbort' arrow function so there is no forward reference (subagent #1 finding). 3. Expand JSDoc: describe both cleanup paths symmetrically (timer-path explicit removeEventListener, abort-path clearTimeout + { once: true } auto-removal). Also document that the promise resolves (does not reject) on abort so callers can drop try/catch noise. 4. Add signal: AbortSignal parameter to the three ATG wait helpers. 5. Replace sleep(DEFAULT_ATG_WAIT_TIME_MS) with interruptibleSleep(DEFAULT_ATG_WAIT_TIME_MS, signal) in each helper. 6. Include !signal.aborted in each while-loop condition so the poll exits immediately when the connector is stopped mid-wait. 7. Thread abortController.signal from internalStartConnector into all three helper calls. 8. Add 'interruptible' to cspell.config.yaml. Impact: a stopConnector() call during an availability-wait now unblocks the poll immediately rather than after DEFAULT_ATG_WAIT_TIME_MS. Gates pass (format / typecheck / lint).
jerome-benoit
added a commit
that referenced
this pull request
Jul 6, 2026
…t warning Round-3 review (subagents #1 impl elegance + #2 physics + #4 harmonization + #5 content) found the M13 warning had three related issues: 1. Message inaccuracy for single-phase AC: the phrase '3-phase Y-derived line-to-line = X V' fired for single-phase AC stations too (F1 had intentionally dropped the numberOfPhases===3 gate for enum coverage symmetry with CoherentSession). But sqrt(3) only applies to balanced 3-phase Y — for single-phase there is no L-L, so the number cited was physically meaningless. 2. Missing VOLTAGE_800 suggestion: only the VOLTAGE_400 case emitted a remediation hint. VOLTAGE_800 warned but did not tell the operator what to do next; 800 V L-L has no clean L-N enum equivalent, so the suggestion should say so. 3. Terminology drift vs CoherentSession: this site said 'line-to-neutral' while CoherentSession said 'line-to-neutral (phase voltage)'; missing space before V in CoherentSession's log message. Fix: - Gate the 3-phase-Y clause behind getNumberOfPhases===3 (conditional string, still fires for all AC phase counts on enum match). For 1-phase and DC, the derived-L-L clause is elided. - Emit a VOLTAGE_800 remediation: 'no standard L-N enum value exists; verify template voltageOut intent (~462 V L-N)'. - Adopt 'line-to-neutral (phase voltage)' terminology matching CoherentSession. Add space before V in CoherentSession log message. - Trim the 10-line explanatory comment block to 6 lines: keep the invariant (voltageOut is L-N; VOLTAGE_400/800 commonly mis-configured); drop the cross-site harmonization prose (belongs in commit history). Gates pass (format / typecheck / lint).
jerome-benoit
added a commit
that referenced
this pull request
Jul 6, 2026
Round-4 review (subagents #3 OCPP+TS, #4 harmonization, #5 content) surfaced three harmonization drifts in JSDoc/log content: 1. ChargingStation.ts:1697 voltage warning said 'voltageOut=X V with AC output matches…' — 'with AC output' is redundant (the warning already gates on currentOutType === AC) and not spec terminology. Drop the qualifier. 2. CoherentSession.ts:103 voltage warning framed the diagnostic differently than ChargingStation.ts ("is treated as line-to-neutral by ACElectricUtils" vs "matches a line-to-line nominal value"). Also attributed the interpretation to ACElectricUtils, an implementation detail that leaked into a user-facing log. Align framing to match ChargingStation.ts and drop the ACElectricUtils attribution. 3. AutomaticTransactionGenerator.ts:302-304 abort-before-replace comment ended with 'before installing the new controller' — the 'new AbortController()' + 'connectorAbortControllers.set()' calls on the immediately following two lines restate that fact. Trim. 4. Four OCPP validate*Payload JSDocs used "@returns True if payload validation succeeds, false otherwise" — capitalized bare 'True'/'false' without backticks and no trailing period. Established pattern elsewhere in the same files uses "\ when … \ otherwise." Normalize in OCPPIncomingRequestService, OCPPRequestService, OCPPResponseService, and OCPPServiceUtils. Gates pass (format / typecheck / lint).
jerome-benoit
added a commit
that referenced
this pull request
Jul 6, 2026
…ounds Round-4 review (subagent #4 harmonization finding 3): six sites in updateFirmwareSimulation call randomInt(minDelay, maxDelay + 1) using function-parameter bounds. Current callers (constructor lines 586 and 596) pass no arguments so the safe defaults (maxDelay=30, minDelay=15) apply. But the parameters are exposed, and any future caller passing config-driven values could hit a randomInt RangeError inside the async firmware simulation loop that surfaces only as a generic caught error. Add an early isValidRandomIntBounds guard immediately after the existing checkChargingStationState guard. On invalid bounds, log an error naming the offending pair and return without scheduling any simulation. Defensive-only — no behavior change for the current default-only callers. Gates pass (format / typecheck / lint).
jerome-benoit
added a commit
that referenced
this pull request
Jul 6, 2026
…cycle sleeps Round-4 review (subagent #4 harmonization finding 1): the OCPP 2.0 firmware simulation lifecycle owns an AbortController (activeFirmwareUpdateAbortController set at line 3703) so a concurrent UpdateFirmware request can cancel an in-progress simulation (line 3091 aborts the previous controller). However, the eight await sleep(...) calls inside simulateFirmwareUpdateLifecycle did not observe that signal. The pattern was: await sleep(delayMs) if (checkAborted()) return which correctly exits after abort but only ONCE the sleep expires. A long sleep (retrieveDateTime scheduling, InstallDateTime scheduling) could keep the simulation running for hours after the abort. Replace each of the eight sleeps inside simulateFirmwareUpdateLifecycle with interruptibleSleep(delay, abortController.signal). The abort now wakes the sleep immediately; the subsequent checkAborted() guard observes the aborted state and returns. Callback semantics identical on the non-abort path. The ninth sleep at line 3902 (simulateLogUploadLifecycle) is left unchanged - that function does not own an AbortController and log uploads are not user-cancellable in this simulator. Gates pass (format / typecheck / lint).
jerome-benoit
added a commit
that referenced
this pull request
Jul 7, 2026
…bustness, comment sweep (#1962) * docs: fill JSDoc gaps on public/protected abstract methods Nine public/protected abstract methods across five base classes lacked JSDoc, forcing new implementers to read existing subclasses to reconstruct the contract. Add minimal-accurate JSDoc (one-line description, @param, @returns) matching the style used by neighboring already-documented methods in the same files. Covered: - Storage.close / open / storePerformanceStatistics (contract for MongoDB / MariaDB / MySQL / SQLite / JSON storage backends) - OCPPIncomingRequestService.stop - OCPPIncomingRequestService.isIncomingRequestCommandSupported - OCPPRequestService.requestHandler (contract for OCPP 1.6 / 2.0 request services) - OCPPResponseService.isRequestCommandSupported - AbstractUIServer.sendRequest / sendResponse (contract for HTTP / WebSocket / stdio UI transports) No behavior change. Gates pass (format / typecheck / lint). * fix(physics): warn on voltageOut=400 V likely intended as line-to-line voltageOut is line-to-neutral (V_LN) throughout the simulator. V_LL is derived as sqrt(3) * V_LN in a balanced 3-phase Y system (see OCPPServiceUtils.buildVoltageMeasurandValue and CoherentMeterValueBuilder). The Voltage enum offers four closed values: 110, 230, 400, 800. Users familiar with EU 3-phase infrastructure often configure voltageOut=400 V thinking of the standard 400 V line-to-line nominal, unaware that the simulator interprets it as line-to-neutral. Downstream this yields an unrealistic simulated L-L ~= 693 V that only surfaces when a meter value is inspected. Emit a targeted logger.warn once per station init when (currentOutType === AC && numberOfPhases === 3 && voltageOut === 400) so the ambiguity surfaces at station start and the message tells the user how to reach 400 V L-L (set voltageOut=230, the closest enum L-N value). No behavior change beyond the log line. Voltage.VOLTAGE_400 remains a valid L-N configuration for the fraction of deployments that truly want a 400 V L-N (rare but not unphysical), so the warning is not an error. Gates pass (format / typecheck / lint). * fix(atg): make in-flight transaction wait AbortSignal-aware The AutomaticTransactionGenerator run loop at internalStartConnector uses two long sleeps drawn from randomInt-clamped uniform distributions: - Line 319: await sleep(wait), up to maxDelayBetweenTwoTransactions - Line 345: await sleep(waitTrxEnd), up to maxDuration (potentially hours for a realistic charging session) Neither observed the connectorsStatus.get(connectorId)?.start flag while sleeping. stopConnector() flipped start=false immediately, but the run loop only saw it AFTER the current sleep expired — so a maxDuration=3600 config could keep the loop alive for an entire hour after a stop request. Introduce a small module-scope interruptibleSleep(ms, signal) primitive that races setTimeout against an AbortSignal, cleaning up whichever listener does not win. Add a per-connector AbortController map on the class, wire stopConnector() to abort the current controller, and thread the signal through both long sleeps in internalStartConnector. The controller is recreated per invocation of internalStartConnector so a stale abort from a previous run cannot short-circuit a fresh loop. The polling helpers (waitChargingStationAvailable / waitConnectorAvailable / waitRunningTransactionStopped) keep their DEFAULT_ATG_WAIT_TIME_MS sleeps — they iterate on much shorter timescales and are not the audit target. Gates pass (format / typecheck / lint). * fix(atg): validate min/max delay and duration bounds before starting the run loop The AutomaticTransactionGenerator run loop draws its between-transaction wait and in-transaction duration from randomInt(min, max + 1) of node:crypto. That primitive throws RangeError when min >= max, so a mis-configured template with minDelay > maxDelay or minDuration > maxDuration kills the async loop at the first iteration with an unhandled rejection that surfaces only as a generic 'Error while starting connector' log line — the actual mis-config value is lost. Add a private validateConfiguration() that checks both min/max invariants up front and, on violation, logs a targeted error naming the offending pair and refuses to schedule internalStartConnector. Called from startConnector() before the internalStartConnector spawn so external callers of startConnector() also benefit; start() reaches startConnectors() → startConnector() and inherits the guard. Config absence is not a violation (returns true); the run loop already defaults to 0 for missing min/max fields and no randomInt call fires. No behavior change for a valid configuration. Gates pass (format / typecheck / lint). * refactor(charging-station): remove 24 redundant restatement comments The audit's M4-M6 finding covered ~63 imperative/redundant/narrative comments across the codebase, roughly a quarter of which sat in ChargingStation.ts as one-line WHAT-restatements directly above a self-documenting method call: // Start heartbeat this.startHeartbeat() or above a specifically-named event handler: // Handle WebSocket close this.wsConnection.on('close', this.onClose.bind(this)) Delete such restatements when the next line already conveys the same information via method / event / status name. Comments that carry a non-obvious WHY, a spec reference, a race condition note, or a subtle behavioural invariant are preserved unchanged (e.g. the response- handling deferred-promise reject-is-no-op explanation at line 2472). 24 comment lines removed; no code change beyond comment deletion. Gates pass (format / typecheck / lint). * refactor(ocpp): remove 10 redundant restatement comments in request/incoming request services Continue the M4-M6 comment sweep in the OCPP request/incoming-request dispatch layer: OCPPRequestService.ts (8 deletions) - // Send error message (above sendError → internalSendMessage) - // Send response message (above sendResponse → internalSendMessage) - // Build request (above JSON.stringify of OutgoingRequest) - // Build response (above JSON.stringify of Response) - // Send a message through wsConnection (above the WebSocket Promise) - // Handle the request's response (above responseHandler call) - // Remove request from the cache (above requests.delete) - // Check if wsConnection opened (above isWebSocketConnectionOpened()) OCPPIncomingRequestService.ts (2 deletions) - // Log (above logger.error) - // Send the built response (above sendResponse call) The '// Build Error Message per OCPP-J §4.2.3: [4, messageId, errorCode, errorDescription, errorDetails]' comment carries a spec reference and the tuple shape, and stays. The '// Emit command name event to allow delayed handling only if there are listeners' comment carries the listener-count WHY and stays. No code change. Gates pass (format / typecheck / lint). * refactor(auth): remove 14 redundant restatement comments in OCPPAuthServiceImpl Continue the M4-M6 comment sweep in the auth service. Delete pure WHAT-restatement comments that immediately precede a self-descriptive line (method call, property assignment, or self-explaining condition): - // Initialize metrics tracking / Initialize default configuration (above obvious property assignments in the constructor) - // Update request metrics / Update failure metrics (above metrics counter increments) - // Update metrics based on result (above updateMetricsForResult call) - // Create a minimal request to check applicability (above testRequest object literal) - // Check if adapter reports remote availability (above adapter.isRemoteAvailable() call) - // Merge new config with existing / Validate merged configuration / Apply validated configuration (updateConfiguration WHAT-narration) - // Check for specific error patterns that indicate critical issues (above criticalPatterns array literal) - // Track successful vs failed authentication / Track strategy usage / Track cache hits/misses based on method (updateMetricsForResult WHAT-narration) Preserved for their WHY / non-obvious context: - // Note: Adapter and strategies will be initialized async via initialize() (async lifecycle note) - // Try each strategy in priority order (section marker in a 100+ line method) - // Continue to next strategy unless it's a critical error (has WHY) - // Get rate limiting stats from cache via remote strategy (describes routing indirection) - // Try local strategy first for quick cache/list lookup (fast-path rationale) - // Create a type guard to check if strategy has configure method / Use type guard instead of any cast (non-obvious TS pattern) No code change. Gates pass (format / typecheck / lint). * refactor(charging-station): remove 6 residual restatement comments in ATG and HelpersChargingProfile Final M4-M6 comment sweep pass on the two remaining files with clear pure-restatement comments: AutomaticTransactionGenerator.ts (2 deletions) - // Start transaction (above await this.startTransaction(connectorId)) - // Wait until end of transaction (above const waitTrxEnd = secondsToMilliseconds(randomInt(minDur, maxDur+1)) — the waitTrxEnd variable name is the comment) HelpersChargingProfile.ts (4 deletions) - // Check if the charging profile is active (above isWithinInterval(currentDate, {...}) condition) - // Check if the first schedule period startPeriod property is equal to 0 (above the equality check on chargingSchedulePeriod[0].startPeriod) - // Handle only one schedule period (above chargingSchedule.chargingSchedulePeriod.length === 1 branch) - // Handle the last schedule period within the charging profile duration (above the composite last-period + duration-overflow condition) Preserved WHY-comments in these two files: the § references, physics / priority-order rationale, race-condition notes, and the ATG interruptibleSleep + AbortController design comments introduced by fa2bea32 / 5a066a51. No code change. Gates pass (format / typecheck / lint). * docs(atg): document onAbort cleanup semantics in interruptibleSleep The empty JSDoc bloc above the onAbort function inside interruptibleSleep was an auto-generated placeholder from the jsdoc/require-jsdoc lint rule firing on function declarations. It read like a TODO left in place. Replace with a targeted comment covering the two non-obvious invariants this cleanup function relies on: - clearTimeout(timeout) prevents the setTimeout callback from firing after the promise has already resolved on the abort path - addEventListener({ once: true }) auto-removes the abort listener so no explicit removeEventListener is needed on the abort path No behavior change. Gates pass (format / typecheck / lint). * fix(physics): broaden voltageOut warning to Voltage.VOLTAGE_800 and harmonize with CoherentSession Round-1 review of this PR surfaced a harmonization violation: my M13 warning at ChargingStation.getStationInfoFromTemplate covered only Voltage.VOLTAGE_400 and gated on numberOfPhases===3, while the pre-existing per-session warning at CoherentSession.createCoherentSession covered Voltage.VOLTAGE_400 or Voltage.VOLTAGE_800 in AC without a phase gate. Broaden the station-init warning: - Add Voltage.VOLTAGE_800 (common L-L nominal in DC HPC / industrial systems; users configuring it as L-N in AC produce sqrt(3) * 800 ~= 1386 V simulated L-L). - Drop the numberOfPhases === 3 gate so single-phase AC configurations with 400 V / 800 V voltageOut also surface at station init (matches CoherentSession coverage). - Message shows the actual derived L-L (sqrt(3) * voltageOut) so users see the physical implausibility of both enum values. - Suggestion 'set voltageOut=230' is emitted only for the 400 case; the 800 case has no clean L-N enum alternative (462 V is not in the Voltage enum), so the message stops at the diagnostic. The two warning sites remain complementary: - ChargingStation station-init: fires once per station lifetime, regardless of coherentMeterValues flag. - CoherentSession per-session: fires per transaction, only when coherentMeterValues=true. Users with coherentMeterValues=false now get consistent enum coverage without depending on the session-level flag. Gates pass (format / typecheck / lint). * refactor(atg): memoize validateConfiguration result to dedupe per-connector log noise Round-1 review noted that validateConfiguration() fires N times for a station with N connectors (once per startConnector call inside the startConnectors loop), so an invalid ATG configuration produces N identical error log lines instead of one. Add a private configurationValidationResult field cached on first invocation and reset in stop() so a station with N connectors emits the diagnostic log line at most once per session, while still allowing a subsequent start() with a mutated configuration to re-validate from scratch. Cache lifecycle: - Initialized to undefined in the constructor. - Set to true or false on the first validateConfiguration() call after a start() (or after a fresh instance). - Cleared back to undefined at the end of stop() so the next start() observes any config changes and re-emits the log line if invalid. No behavior change for the valid-configuration path. For the invalid path, log-line count drops from N (per-connector) to 1 (per-session). Gates pass (format / typecheck / lint). * refactor(utils): extract isRandomIntBoundsValid predicate and apply in ATG Round-1 review noted that the min > max guard in AutomaticTransactionGenerator.validateConfiguration is a specific instance of a general concern: any caller of randomInt(min, max + 1) from node:crypto risks a RangeError when configuration-driven min/max values are mis-ordered. Extract a pure predicate isRandomIntBoundsValid(min, max) into src/utils/Utils.ts (co-located with other random primitives: secureRandom, getRandomFloat, getRandomFloatFluctuatedRounded, getRandomFloatRounded). The predicate carries the +1 semantics contract in its JSDoc so consumers cannot misuse it. Zero logger dependency, zero side effects, testable in isolation. Apply in ATG's validateConfiguration where the same check now goes through the named predicate for readability and reuse. The two log lines remain in ATG with their full field-name context (which the predicate intentionally does not embed to stay pure). Other randomInt(min, max + 1) sites in the codebase remain unchanged, each documented as low-risk: - OCPP16IncomingRequestService.updateFirmwareSimulation lines 1860, 1871, 1908, 1925, 1936, 1947: min/max are function-parameter defaults (maxDelay=30, minDelay=15, hardcoded and safe by construction); the internal callers respect the default ordering. - OCPPServiceUtils.buildSocMeasurandValue line 270: socMaximumValue is the Constants.SOC_MAXIMUM_PERCENT (100), socMinimumValue is the Zod- schema-validated template field (bounded by the schema). The Zod schema guarantees the invariant at load time. These sites can adopt the predicate in a follow-up config-validation sweep PR if the constraints ever loosen. No behavior change in this commit. Gates pass (format / typecheck / lint). * fix(atg): guarantee AbortController cleanup and prevent per-connector race Round-3 review (subagents #1 design/impl + #2 algo) surfaced two concurrency bugs in internalStartConnector's per-connector controller lifecycle: 1. Leak on abort/exception path: the delete at line 412 was only reached when the while-loop exited normally. Any await inside the loop that rejected (waitChargingStationAvailable, startTransaction, stopTransaction, etc.) propagated through the caller's .catch handler in startConnector — bypassing the delete and leaving the controller in connectorAbortControllers indefinitely. 2. Race in stopConnector→startConnector→cleanup ordering: if the old loop was still draining (e.g. resolving an aborted interruptibleSleep) when a new startConnector fired, the new run set(controller_new) at line 349, and shortly after the old loop reached the unconditional delete(connectorId), wiping the successor controller. A subsequent stopConnector could then not abort the new loop. Fix both with a single try/finally + conditional delete pattern: - try { while-loop } finally { conditional delete } guarantees cleanup on every exit path (normal, break, throw) without leaking. - Delete only when this.connectorAbortControllers.get(connectorId) === abortController (identity check on the run-local reference) so a successor controller cannot be wiped by a predecessor's finally. No behavior change on the happy path. Gates pass (format / typecheck / lint). * fix(atg): unconditionally reset validation cache in stop() to enable recovery Round-3 review (subagents #1 + #2) found a stuck-state bug: The cache reset was at the END of stop(), inside the branch guarded by 'if (!this.started) { return }'. So if a caller invoked startConnector() directly (without going through start()), this.started never became true, and any subsequent stop() early-returned without resetting the cache — the user was stuck with a cached-false configurationValidationResult and no path to recover. Move the reset to the TOP of stop(), before the started/stopping guards. The reset is idempotent (undefined -> undefined is a no-op), so unconditional execution has no side effect on the already-stopped path. This lets external startConnector() callers recover by calling stop() to clear the cache. Gates pass (format / typecheck / lint). * refactor(utils): rename to isValidRandomIntBounds and strengthen input validation Round-3 review (subagents #1 + #2 + harmonization #6) found three issues with the extracted predicate: 1. Naming inversion — neighbors follow subject-first (isValidDate, isNotEmptyString, isNotEmptyArray) but isRandomIntBoundsValid put the operation before the subject. Rename to isValidRandomIntBounds. 2. Under-validation — the predicate only checked min <= max, so it returned true for NaN/Infinity/non-integers/negatives even though node:crypto.randomInt throws RangeError on all of them (safe integer 0 <= min < 2^48 <= max required). NaN was accidentally rejected because 'NaN <= NaN' is false. Strengthen to reject explicitly: Number.isSafeInteger(minValue) && Number.isSafeInteger(maxValue) && minValue >= 0 && minValue <= maxValue. 3. JSDoc leaked ATG-specific '+1' convention into a general utility contract. Trim @param maxValue to just 'Upper bound (inclusive).' The +1 semantics belong in the description (kept there) and at the call site. Log messages in ATG updated to match: - randomInt(min, max) -> randomInt(min, max + 1) to reflect the actual call - Semicolon comma joining consequence clauses replaced with em-dash for readability Gates pass (format / typecheck / lint). * refactor(utils): export interruptibleSleep and apply to ATG polling helpers Round-3 review (subagent #4 harmonization) found interruptibleSleep was private to ATG and could not be reused, plus the three ATG polling helpers (waitChargingStationAvailable / waitConnectorAvailable / waitRunningTransactionStopped) called plain sleep() and were blind to the abort signal. Changes: 1. Move interruptibleSleep from AutomaticTransactionGenerator.ts to src/utils/Utils.ts next to sleep(). Export from utils/index.ts. 2. Reorder to declare 'timeout' before the 'onAbort' arrow function so there is no forward reference (subagent #1 finding). 3. Expand JSDoc: describe both cleanup paths symmetrically (timer-path explicit removeEventListener, abort-path clearTimeout + { once: true } auto-removal). Also document that the promise resolves (does not reject) on abort so callers can drop try/catch noise. 4. Add signal: AbortSignal parameter to the three ATG wait helpers. 5. Replace sleep(DEFAULT_ATG_WAIT_TIME_MS) with interruptibleSleep(DEFAULT_ATG_WAIT_TIME_MS, signal) in each helper. 6. Include !signal.aborted in each while-loop condition so the poll exits immediately when the connector is stopped mid-wait. 7. Thread abortController.signal from internalStartConnector into all three helper calls. 8. Add 'interruptible' to cspell.config.yaml. Impact: a stopConnector() call during an availability-wait now unblocks the poll immediately rather than after DEFAULT_ATG_WAIT_TIME_MS. Gates pass (format / typecheck / lint). * fix(physics): scope L-L derivation to 3-phase and harmonize voltageOut warning Round-3 review (subagents #1 impl elegance + #2 physics + #4 harmonization + #5 content) found the M13 warning had three related issues: 1. Message inaccuracy for single-phase AC: the phrase '3-phase Y-derived line-to-line = X V' fired for single-phase AC stations too (F1 had intentionally dropped the numberOfPhases===3 gate for enum coverage symmetry with CoherentSession). But sqrt(3) only applies to balanced 3-phase Y — for single-phase there is no L-L, so the number cited was physically meaningless. 2. Missing VOLTAGE_800 suggestion: only the VOLTAGE_400 case emitted a remediation hint. VOLTAGE_800 warned but did not tell the operator what to do next; 800 V L-L has no clean L-N enum equivalent, so the suggestion should say so. 3. Terminology drift vs CoherentSession: this site said 'line-to-neutral' while CoherentSession said 'line-to-neutral (phase voltage)'; missing space before V in CoherentSession's log message. Fix: - Gate the 3-phase-Y clause behind getNumberOfPhases===3 (conditional string, still fires for all AC phase counts on enum match). For 1-phase and DC, the derived-L-L clause is elided. - Emit a VOLTAGE_800 remediation: 'no standard L-N enum value exists; verify template voltageOut intent (~462 V L-N)'. - Adopt 'line-to-neutral (phase voltage)' terminology matching CoherentSession. Add space before V in CoherentSession log message. - Trim the 10-line explanatory comment block to 6 lines: keep the invariant (voltageOut is L-N; VOLTAGE_400/800 commonly mis-configured); drop the cross-site harmonization prose (belongs in commit history). Gates pass (format / typecheck / lint). * docs(charging-profile): restore structural 'last period' navigation comment Round-3 review (subagent #1 design/impl) found the M4-M6 comment sweep had over-deleted one non-restatement comment at HelpersChargingProfile line ~404: '// Handle the last schedule period within the charging profile duration'. The composite condition below (last-in-array OR next-period-would-exceed-duration) is not self-evident from the boolean expression alone; the comment aids navigation through this OCPP-specific boundary case. Restore with a tighter version: 'Last period: last in array OR next period would exceed the charging profile duration.' No code change. Gates pass (format / typecheck / lint). * docs(ocpp): use backtick-quoted `true` in @returns for consistency Round-3 review (subagent #5 content finding 3) found @returns lines in the M11 JSDocs used capitalized 'True when' while neighboring JSDocs used backtick-quoted `true`. Normalize both: - OCPPIncomingRequestService.isIncomingRequestCommandSupported - OCPPResponseService.isRequestCommandSupported No behavior change. Gates pass (format / typecheck / lint). * docs: remove/trim redundant comments per DRY (AGENTS.md no-duplication rule) User feedback: comments that repeat info already conveyed by log messages, method names, or field names violate concision + AGENTS.md 'No duplication: maintain single authoritative documentation source; reference other sources rather than copying'. Changes: 1. ChargingStation.ts:1676-1681 - DELETE the 6-line voltage warning block comment. Every fact it stated (voltageOut is L-N, 400/800 are L-L nominals) is already in the log message immediately below ('matches a line-to-line nominal value', 'treats voltageOut as line-to-neutral (phase voltage)'). The 'harmonized with CoherentSession' cross-reference is trivially discoverable via 'rg Voltage.VOLTAGE_400'. 2. AutomaticTransactionGenerator.ts stop() - trim 4-line 'Reset unconditionally' comment to 3 lines. Drop the redundant 'configurationValidationResult' field name (visible on next line) and 'this.started never transitioned to true' (obvious from the guard structure). 3. AutomaticTransactionGenerator.ts stopConnector() - trim 5-line 'Wake' comment to 3 lines. Drop the redundant second sentence about controller lifecycle (visible from the field name 'connectorAbortControllers' and its usage in internalStartConnector). 4. AutomaticTransactionGenerator.ts internalStartConnector() - trim 4-line 'Fresh AbortController' comment to 3 lines. The 'new AbortController()' on the next line already conveys freshness; only the abort-before-replace ordering (unblock lingering sleep) needs documenting. 5. AutomaticTransactionGenerator.ts try/finally - trim 5-line 'Only clear' comment to 2 lines. The try/finally structure self-documents the 'guarantees cleanup on all paths' claim; only the identity check for concurrent stopConnector→startConnector needs explanation. No behavior change. Gates pass (format / typecheck / lint). * fix(atg): close two ATG concurrency correctness gaps Round-4 review (subagents #1 design/impl HIGH, #2 algo HIGH): 1. **Concurrent-loop race on back-to-back stopConnector→startConnector** (subagent #2 finding 3): after stopConnector aborts the controller, the old internalStartConnector loop resumes from its interruptible sleep. When startConnector fires immediately after and resets connectorStatus.start=true, the old loop's while condition (which only reads the shared 'start' flag) sees true again and continues running with an already-aborted signal — subsequent interruptibleSleep calls resolve synchronously → tight-loop, or worse, the old loop calls stopConnector again and aborts the NEW controller. Fix: add !abortController.signal.aborted to the while condition. The old loop now exits immediately after abort regardless of the shared 'start' flag. 2. **waitRunningTransactionStopped stale connectorStatus snapshot** (subagent #1 finding 7): the helper fetched connectorStatus once before the loop and re-read the same object on each iteration. This works today because getConnectorStatus returns a Map reference that mutates in place, but the pattern was inconsistent with waitChargingStationAvailable / waitConnectorAvailable which call their predicates inline, and would silently break if getConnectorStatus ever returned a new object per call. Fix: inline the getConnectorStatus call in the while condition and inline it again for the one-time log message. Matches the pattern of the two sibling wait helpers. Gates pass (format / typecheck / lint). * fix(atg): move post-loop bookkeeping inside finally for exception paths Round-4 review (subagent #1 design/impl MEDIUM finding 3): the connectorStatus.stoppedDate assignment and the two 'Stopped on connector' logger calls at the end of internalStartConnector sat OUTSIDE the try/finally block. If any await inside the while loop rejected (waitChargingStationAvailable, startTransaction, stopTransaction, etc.), the finally block ran the controller cleanup — but the throw propagated past the post-loop block, leaving connectorStatus.stoppedDate undefined and skipping the 'Stopped on connector' + 'Stopped with connector status' log lines. The connector observably appeared to be still running for a stopped station. Move the four post-loop statements inside the finally block so the connector's stoppedDate is always set and the operator always sees the 'Stopped' log lines, regardless of exit path (normal exit, break, throw). The ChargingStationEvents.updated emit also relocates so the UI reflects the stopped state on every path. Gates pass (format / typecheck / lint). * docs: harmonize voltage warnings and @returns JSDoc across OCPP layer Round-4 review (subagents #3 OCPP+TS, #4 harmonization, #5 content) surfaced three harmonization drifts in JSDoc/log content: 1. ChargingStation.ts:1697 voltage warning said 'voltageOut=X V with AC output matches…' — 'with AC output' is redundant (the warning already gates on currentOutType === AC) and not spec terminology. Drop the qualifier. 2. CoherentSession.ts:103 voltage warning framed the diagnostic differently than ChargingStation.ts ("is treated as line-to-neutral by ACElectricUtils" vs "matches a line-to-line nominal value"). Also attributed the interpretation to ACElectricUtils, an implementation detail that leaked into a user-facing log. Align framing to match ChargingStation.ts and drop the ACElectricUtils attribution. 3. AutomaticTransactionGenerator.ts:302-304 abort-before-replace comment ended with 'before installing the new controller' — the 'new AbortController()' + 'connectorAbortControllers.set()' calls on the immediately following two lines restate that fact. Trim. 4. Four OCPP validate*Payload JSDocs used "@returns True if payload validation succeeds, false otherwise" — capitalized bare 'True'/'false' without backticks and no trailing period. Established pattern elsewhere in the same files uses "\ when … \ otherwise." Normalize in OCPPIncomingRequestService, OCPPRequestService, OCPPResponseService, and OCPPServiceUtils. Gates pass (format / typecheck / lint). * docs: polish batch from round-4 review Round-4 subagents flagged five small content-quality items, none blocking: 1. Utils.ts interruptibleSleep: delete two inline comment blocks that duplicate the JSDoc (timer-path cleanup and abort-path cleanup are already documented symmetrically in the JSDoc body). 2. Utils.ts isValidRandomIntBounds JSDoc: drop the last sentence that leaked call-site usage guidance into a general-utility predicate contract. Document the >= 0 constraint in @param. 3. AutomaticTransactionGenerator.ts validateConfiguration JSDoc: trim the memoization-mechanism sentence to a single clause. The full rationale already lives in the stop() reset comment. 4. AutomaticTransactionGenerator.ts validateConfiguration log messages: the > description understated the predicate rejection surface (it also rejects NaN/Infinity/non-integer/negative). Rewrite as invalid bounds matching the predicate contract. 5. Storage.ts three JSDoc @returns: backtick-quote void to match the codebase convention of quoting type names. No behavior change. Gates pass (format / typecheck / lint). * fix(ocpp/1.6): guard updateFirmwareSimulation against invalid delay bounds Round-4 review (subagent #4 harmonization finding 3): six sites in updateFirmwareSimulation call randomInt(minDelay, maxDelay + 1) using function-parameter bounds. Current callers (constructor lines 586 and 596) pass no arguments so the safe defaults (maxDelay=30, minDelay=15) apply. But the parameters are exposed, and any future caller passing config-driven values could hit a randomInt RangeError inside the async firmware simulation loop that surfaces only as a generic caught error. Add an early isValidRandomIntBounds guard immediately after the existing checkChargingStationState guard. On invalid bounds, log an error naming the offending pair and return without scheduling any simulation. Defensive-only — no behavior change for the current default-only callers. Gates pass (format / typecheck / lint). * fix(ocpp/2.0): thread abort signal through simulateFirmwareUpdateLifecycle sleeps Round-4 review (subagent #4 harmonization finding 1): the OCPP 2.0 firmware simulation lifecycle owns an AbortController (activeFirmwareUpdateAbortController set at line 3703) so a concurrent UpdateFirmware request can cancel an in-progress simulation (line 3091 aborts the previous controller). However, the eight await sleep(...) calls inside simulateFirmwareUpdateLifecycle did not observe that signal. The pattern was: await sleep(delayMs) if (checkAborted()) return which correctly exits after abort but only ONCE the sleep expires. A long sleep (retrieveDateTime scheduling, InstallDateTime scheduling) could keep the simulation running for hours after the abort. Replace each of the eight sleeps inside simulateFirmwareUpdateLifecycle with interruptibleSleep(delay, abortController.signal). The abort now wakes the sleep immediately; the subsequent checkAborted() guard observes the aborted state and returns. Callback semantics identical on the non-abort path. The ninth sleep at line 3902 (simulateLogUploadLifecycle) is left unchanged - that function does not own an AbortController and log uploads are not user-cancellable in this simulator. Gates pass (format / typecheck / lint). * fix(utils): enforce node:crypto randomInt 2^48 range limit in predicate Round-5 review (subagent OCPP+TS finding 8, HIGH): Number.isSafeInteger allows values up to 2^53 - 1, but node:crypto.randomInt rejects any call where max - min > 2^48 - 1 with a RangeError. The predicate's documented contract ('safe for randomInt') was therefore incorrect for wide ranges — the false-positive latent because current callers use small integer delays (15-30s) and SoC bounds (0-100). Add the 2^48 range check to the predicate and document it in the JSDoc. Empirically verified against Node 22: randomInt(0, 2**48) throws RangeError Number.isSafeInteger(2**48) === true Gates pass (format / typecheck / lint). * fix(ocpp): guard SOC randomInt against invalid template bounds The SoC MeterValues fallback path in buildSocMeasurandValue drew a random integer via randomInt(socMinimumValue, socMaximumValue + 1) where socMinimumValue comes from the (user-supplied) template minimumValue field and socMaximumValue is Constants.SOC_MAXIMUM_PERCENT (=100). If a template set minimumValue >= 101, randomInt would throw RangeError inside a MeterValues emission — surfacing only as a caught error in the OCPP path. Guard with isValidRandomIntBounds before the randomInt call. On invalid bounds, log a warn line naming the offending pair and fall back to socMaximumValue (100) so the measurand still produces a value. Gates pass (format / typecheck / lint). * fix(atg): gate all post-loop bookkeeping on controller ownership Round-5 review (design/impl finding 3, MEDIUM): the round-4 finally block gated only the connectorAbortControllers.delete() on the identity check (map.get === abortController). It then wrote connectorStatus.stoppedDate unconditionally, emitted the Stopped log lines, and fired the updated event. On a back-to-back stopConnector -> startConnector, the sequence is: t0: old loop finally fires t1: identity check: map.get === NEW controller (the successor already installed by startConnector); check fails, delete correctly skipped t2: connectorStatus.stoppedDate = new Date() <-- corrupts the new run's status object (shared reference in connectorsStatus) t3: 'Stopped on connector' log fires for a connector the operator just re-started Gate all four post-loop operations (delete, stoppedDate, info log, debug log, updated event) on a single isOwner boolean. Non-owner paths silently exit — the successor run owns the status object and will emit its own Stopped log when it eventually completes. Gates pass (format / typecheck / lint). * fix(ocpp/2.0): guarantee clearActiveFirmwareUpdate on every exit path Round-5 review (harmonization finding C-2, MEDIUM): simulateFirmwareUpdateLifecycle called clearActiveFirmwareUpdate only on three specific paths (empty location, signature failure, happy completion). Any other early-return path (7 abort returns) or a thrown await left activeFirmwareUpdateAbortController set. A subsequent UpdateFirmware.req would then abort() a non-existent in-progress update, and stationState.activeFirmwareUpdateRequestId would never re-populate — the station appeared stuck with a phantom in-progress firmware update. Wrap the entire body in try/finally with a single clearActiveFirmwareUpdate call in finally. Delete the three now-redundant site-local calls. Also correct the abort-controller store comment from 'cancel' to 'abort' (codebase terminology finding B1/D4 from the round-5 content review). Gates pass (format / typecheck / lint). * docs: polish batch from round-5 review Four small content-quality items surfaced by round-5 review: 1. AutomaticTransactionGenerator.waitRunningTransactionStopped: the first-iteration log line called getConnectorStatus a second time (separate from the loop condition) to read transactionId. Between the two reads the transaction could theoretically end and a new one start, logging a different id than the one that triggered the wait. Snapshot transactionId into a local const before the log. 2. AutomaticTransactionGenerator.validateConfiguration error messages and OCPP16IncomingRequestService.updateFirmwareSimulation abort message both suffixed 'for randomInt(min, max + 1)' — misleading because isValidRandomIntBounds validates raw bounds, not the +1 form. Drop the suffix; the 'invalid bounds' clause is sufficient. 3. CoherentSession voltage warning lacked the actionable remediation hint present in the ChargingStation counterpart. Append 'Set voltageOut to the L-N equivalent in the station template to resolve.' No behavior change. Gates pass (format / typecheck / lint). * fix(utils): tighten isValidRandomIntBounds boundary by one The predicate validated maxValue - minValue < 2^48, but every call site passes randomInt(min, maxValue + 1). node:crypto's randomInt requires max_exclusive - min <= 2^48 - 1, so the effective constraint on the inclusive bounds is maxValue - minValue <= 2^48 - 2. The old boundary permitted maxValue - minValue = 2^48 - 1, which after the +1 offset would throw RangeError at the randomInt call. Practical impact is nil (all real config paths are far below the limit) but the predicate is now nominally correct. Also trim JSDoc overexplanation of caller convention. * fix(ocpp): skip SoC measurand emission on invalid bounds buildSocMeasurandValue previously fabricated a synthetic 100 % SoC reading when the template's minimumValue was misconfigured (e.g. a negative float that fails isValidRandomIntBounds). Emitting 100 % looks like a valid meter reading to the CSMS and could distort billing, session-end triggers, and analytics on the operator side. Skip the measurand entirely instead — consistent with the existing null-return path when the SoC template itself is absent (line 261). The warn log still surfaces the misconfiguration. * refactor(ocpp20): extract resetActiveFirmwareUpdateState helper handleRequestUpdateFirmware's abort-and-replace path directly wrote undefined to the two activeFirmwareUpdate* fields, while the lifecycle finally routed through clearActiveFirmwareUpdate. Any future logic added to the helper (logging, metrics, invariants) would silently diverge for the abort-and-replace path. Extract resetActiveFirmwareUpdateState as the single source of truth for the field reset. clearActiveFirmwareUpdate still guards on requestId identity (protecting a successor's state from being cleared by a stale finally); handleRequestUpdateFirmware calls the reset unconditionally because the abort-and-replace semantics require it. * feat(atg): log displaced-loop exit at debug level The isOwner gate silently returned from the finally block when a concurrent stopConnector→startConnector had already installed a successor controller. Diagnosing 'why did the old loop stop?' under concurrency required knowing the silent path existed. Emit a debug line on the non-owner path so displaced-loop exits are observable without adding noise at higher log levels. Also trim the redundant second half of the ownership comment (the consequence is already implied by the WHY sentence above). * docs(coherent): align voltage warning voice with ChargingStation CoherentSession's L-L/L-N mismatch warning used passive voice ('If this value is meant as line-to-line') while the parallel warning in ChargingStation.ts uses direct second-person ('If you intended'). Align to the second-person form for cross-file consistency. * docs(utils): align isValidRandomIntBounds JSDoc notation The description body stated 'maxValue - minValue <= 2^48 - 2' while @param stated 'maxValue - minValue < 2^48 - 1'. Both are equivalent for integers but forced a reader to verify equivalence. Also drop the derivation showing how the node:crypto max_exclusive - min <= 2^48 - 1 constraint reduces to maxValue - minValue <= 2^48 - 2 — the derivation belongs in commit history, not in the live docblock. @param and description now use the same notation (<= 2^48 - 2). * docs(logs): align tense and specificity in round-6 messages Two log-message polish items surfaced by round-7: ATG.internalStartConnector displaced-loop debug log used present participle 'Exiting' while the sibling info log at line 391 uses past tense 'Stopped'. Both fire from the finally block reporting a completed event. Align to 'Exited'. OCPPServiceUtils.buildSocMeasurandValue skip-log action clause read 'skipping measurand'. Sibling messages in ATG and OCPP16 use fully qualified action noun phrases ('aborting connector startup', 'aborting firmware update simulation'). Add the 'SoC' qualifier for parallelism: 'skipping SoC measurand'. * refactor(ocpp20): harmonize firmware-state cleanup + log superseded Three coherence gaps identified by round-7 harmonization review: stop() aborted the active firmware update but wrote the delete without routing through resetActiveFirmwareUpdateState. Latent-only because the stationsState.delete makes the fields unreachable, but the pattern diverged from every other cleanup site. Route through the helper. clearActiveFirmwareUpdate silently returned when the requestId did not match the active one — the exact 'displaced' pattern the ATG round-6 fix addressed. A stale finally firing after a successor took over is diagnostically important. Emit a debug line for the superseded path. Naming distinction (reset = unconditional, clear = identity-guarded) is now self-documenting via the guard in clearActiveFirmwareUpdate. * fix(ocpp20): prevent state resurrection in clearActiveFirmwareUpdate getStationState is a lazy-init getter: on cache miss it creates an empty entry and adds it to stationsState. clearActiveFirmwareUpdate runs in the finally of simulateFirmwareUpdateLifecycle. If stop() has already deleted the station entry before the aborted lifecycle's finally fires, the lazy-init would resurrect a fresh empty entry — leaking state past shutdown. Use stationsState.get() directly and no-op silently when the entry is absent. The non-owner debug log now only fires for genuine supersession (state present, requestId mismatched). * docs: revert isValidRandomIntBounds JSDoc to match code + fix typo Round-7 aligned the JSDoc @param to '<= 2^48 - 2' while the code kept '< 2 ** 48 - 1'. Both forms are equivalent for integers but the JSDoc notation deviated from the code's literal. Revert JSDoc to '< 2^48 - 1' which mirrors the code and stays close to node:crypto's own docs phrasing ('range must be less than 2^48'). Also fix a pre-existing typo in the Constants.MAX_RANDOM_INTEGER comment: 'randomInit()' -> 'randomInt()'. * fix(ocpp20): use raw stationsState.get() in FirmwareStatusNotification trigger The TriggerMessage/FirmwareStatusNotification case at line 564 is a reporting path — it reads activeFirmwareUpdateRequestId to build the notification payload but does not otherwise mutate station state. Calling getStationState (which lazy-inits on cache miss) here means a TriggerMessage arriving for a station that has never had a firmware update creates a spurious empty state entry, and a TriggerMessage arriving between stop() and WS close would resurrect state after shutdown — same pattern as the round-8 clearActiveFirmwareUpdate fix. Use stationsState.get() directly and optional-chain the requestId read. When no state exists the notification carries requestId undefined, which is spec-compliant for status = Idle (OCPP 2.0.1 L01.FR.20: requestId is mandatory only for non-Idle statuses). * docs(utils): drop @param maxValue range-width restatement The @param maxValue clause restated 'with maxValue - minValue < 2^48 - 1', which is already stated in the description body. Trim to just the intrinsic bound (inclusive safe integer >= minValue) and let the range-width constraint live where it belongs (the body). * refactor(ocpp20): rename getStationState to getOrCreateStationState The private getter lazily creates a station state entry on cache miss. Callers seeing 'getStationState(cs)' vs 'stationsState.get(cs)' side by side could not tell that the former creates state while the latter does not — the very split rounds 8 and 9 introduced to fix state-resurrection bugs (clearActiveFirmwareUpdate, TriggerMessage/ FirmwareStatusNotification). Rename the lazy-init getter so its name carries the semantics: this.getOrCreateStationState(cs) // creates on miss - handler paths this.stationsState.get(cs) // undefined on miss - cleanup/reporting Nine call sites + one definition. Zero behavior change. * docs(utils): make @param minValue structurally symmetric with @param maxValue Round-9 trimmed @param maxValue to 'safe integer >= minValue' but left @param minValue as 'non-negative safe integer'. Both bounds now state 'safe integer >= X' — @param minValue relative to 0, @param maxValue relative to minValue. The description body still carries the rejection list (NaN, Infinity, floats, negatives, range-width). * fix(ocpp20): cross-check firmware status against active requestId in trigger FirmwareStatusNotification TriggerMessage read from two independent sources: hasFirmwareUpdateInProgress reads chargingStation.stationInfo .firmwareStatus, activeFirmwareUpdateRequestId lives on stationsState. They can diverge in real windows: 1. simulateFirmwareUpdateLifecycle sets activeFirmwareUpdateRequestId at line 3716 before its first sendFirmwareStatusNotification (line 3467). During any await between the two — notably the retrieveTime sleep at 3730 — a trigger would emit { requestId: X, status: Idle/undefined }. 2. On exception paths the finally resets activeFirmwareUpdateRequestId but leaves stationInfo.firmwareStatus at its last-set value. A trigger fired between the exception and the next UpdateFirmware.req would emit { requestId: undefined, status: <non-Idle> } — an OCPP 2.0.1 L01.FR.20 violation (requestId mandatory for non-Idle). Gate the non-Idle firmwareStatus branch on requestId being defined — activeFirmwareUpdateRequestId is the authoritative signal for 'an update is in progress'. When it is undefined we always emit Idle, which is spec-compliant regardless of the stationInfo staleness. * refactor(ocpp): extract getOrCreateWarnedMeasurands helper The resolveEnabledMeasurands warn-once path had a 4-line inline lazy-init block on warnedInvalidMeasurands (WeakMap<ChargingStation, Set<string>>). Extract it as a module-level helper mirroring the round-10 getOrCreateStationState naming. Same semantic distinction as OCPP20IncomingRequestService: - getOrCreate* — lazy-init, always returns a live reference - .get() — raw WeakMap read, may return undefined * fix(ocpp20): apply dual-gate to LogStatusNotification trigger The LogStatusNotification TriggerMessage case sent { status: Idle } unconditionally, with no requestId — losing the signal when a log upload is genuinely in progress and mirroring the same pre-fix gap round-11 closed for FirmwareStatusNotification. Round-11 established the dual-gate pattern: an active requestId in stationsState is the authoritative 'operation in progress' signal; the status is emitted from the same source of truth to guarantee consistency between requestId and status. Log upload has no stationInfo.logStatus equivalent (unlike firmware's stationInfo.firmwareStatus), so store the status alongside the requestId in the stationState. Wrap simulateLogUploadLifecycle in try/finally to guarantee cleanup on exception. The trigger now reports Uploading/Uploaded with the active requestId when in-flight, Idle otherwise — matching the firmware pattern structurally. * docs(ocpp20): enumerate all 8 in-progress statuses in hasFirmwareUpdateInProgress @returns The JSDoc @returns listed 3 statuses (Downloading, Downloaded, Installing) but the body checks 8 (also DownloadScheduled, DownloadPaused, InstallScheduled, InstallRebooting, SignatureVerified). Enumerate all 8 to match the implementation. * fix(ocpp20): guard log-upload mid-lifecycle mutation + wrap firmware JSDoc Two round-13 findings surfaced in the same file: 1. simulateLogUploadLifecycle mutated activeLogUploadStatus = Uploaded without an identity guard. If a concurrent GetLog request installed a new lifecycle during the sleep, the old lifecycle's post-sleep resume would overwrite the new lifecycle's status with a stale Uploaded, causing the TriggerMessage handler to report the wrong signal for the in-flight upload. Guard the mid-lifecycle status mutation with the same identity check used in the finally. Extract clearActiveLogUpload as a helper mirroring clearActiveFirmwareUpdate — same raw-.get() + null-guard + identity-check + debug-log-on-superseded pattern for observability parity with the firmware peer. 2. hasFirmwareUpdateInProgress @returns clause was 183 chars on one line and used unbacktick'd 'true'. Wrap the enumeration across three lines and restore the `true` backtick style established by 92a8dac1. * fix(ocpp20): implement log-upload supersession per OCPP 2.0.1 N01.FR.12 Round-14 subagent C surfaced a HIGH spec-conformance gap: when a new GetLog request arrives with a prior upload in progress, the CS was returning Accepted and letting the old lifecycle run to completion (sending a spurious Uploaded for the superseded requestId). This violates N01.FR.12 + FR.20 and fails TC_N_36_CSMS step 7 which expects LogStatusNotification(AcceptedCanceled) for the old id. handleRequestGetLog now mirrors handleRequestUpdateFirmware: - detect active upload, capture the previous requestId - reset log state so the old lifecycle exits gracefully - send LogStatusNotification(AcceptedCanceled) for the old id - return GetLogResponse with status AcceptedCanceled The GET_LOG on-hook now accepts both Accepted and AcceptedCanceled to start the new lifecycle. The mid-lifecycle Uploaded emission is now co-located inside the identity guard: a superseded lifecycle skips both the state mutation AND the wire notification, preventing the spurious Uploaded that would follow an already-emitted AcceptedCanceled. Extracted resetActiveLogUploadState mirroring resetActiveFirmwareUpdateState (round-14 subagent A finding 2) so clearActiveLogUpload delegates to the two-field wipe rather than inlining it — full structural parity with the firmware peer. * fix(ocpp20): round-15 clear-log parity + stop() log reset + JSDoc Three findings from the same review round, one file: 1. clearActiveFirmwareUpdate and clearActiveLogUpload logged the debug 'superseded requestId X (active: Y)' message even when the active field was undefined (the state was reset, not superseded). The post-supersession trace fires clearActive* with the old requestId after resetActive*State cleared the active field — the log said 'active: undefined' which reads as a bug. Tighten the else branch to fire only when a DIFFERENT non-null requestId is active; drop the String() wrapper since only the number path can reach it. 2. stop() aborted the firmware controller and reset firmware state before deleting the stationsState entry, but skipped the log upload state. The delete makes the fields unreachable so it is not a memory leak, but the asymmetry breaks the structural mirror with firmware and the aborted-but-still-running log lifecycle would see inconsistent state post-stop. Add resetActiveLogUploadState for parity. 3. handleRequestGetLog @returns still said 'Accepted status' only — stale since the round-14 supersession fix. Extend to mention both Accepted (no prior upload) and AcceptedCanceled (superseded prior upload) with a description sentence on the supersession behavior. * fix(ocpp20): cancel cert-signing retry timer in stop() + JSDoc polish Three findings from round-16 review of the round-15 changes: 1. MEDIUM: OCPP20StationState.certSigningRetryManager holds a live setTimeout whose callback closes over chargingStation. The stationsState.delete() in stop() drops the WeakMap entry but the timer keeps chargingStation alive until it fires. Add certSigningRetryManager?.cancelRetryTimer() alongside the firmware abort() call, before the resets and the delete — closes the leak and matches the abort-before-reset pattern established for firmware. 2. LOW: 'simulates a Uploading' — wrong article. Fix to 'simulates an Uploading' (starts with vowel sound). 3. LOW: The @returns clause exceeded 140 chars on a single line. Wrap onto two lines to match the ~100-char convention. * fix(ocpp20): add AbortController to log-upload lifecycle + canceled spelling Round-17 findings from rounds 13-17 flagged the log-upload/firmware structural asymmetry repeatedly: firmware had AbortController + reset, cert-signing had cancelRetryTimer + reset, log had only identity-guard + state reset. A superseded lifecycle woke from sleep on its own schedule, wasted the delay, and the aborted-but-still-running coroutine emitted spurious wire notifications until the identity guard caught it. Round-17's harmonization subagent explicitly said 'worth fixing in this PR while the pattern is fresh'. Add activeLogUploadAbortController to OCPP20StationState, create it in simulateLogUploadLifecycle, replace sleep() with interruptibleSleep threading the signal, and gate the mid-lifecycle status write and send on both signal.aborted and the identity check. abort() the controller in handleRequestGetLog supersession, in stop(), and reset it via resetActiveLogUploadState. sleep import is now unused — removed. Also fix pre-existing British/American spelling drift surfaced by round-17 content review: 'Retry timer cancelled' -> 'canceled', for consistency with the cancelRetryTimer method name and OCPP enum values (AcceptedCanceled).
This was referenced Jul 8, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bumps @typescript-eslint/eslint-plugin from 5.24.0 to 5.25.0.
Release notes
Sourced from
@typescript-eslint/eslint-plugin's releases.Changelog
Sourced from
@typescript-eslint/eslint-plugin's changelog.Commits
59e9d88chore: publish v5.25.005d71c2fix(eslint-plugin): strict config should not extend recommended (#5005)e18e91cfix(website): correct Presets link to be Configs (#5004)e91a4a1docs(eslint-plugin): fix typo in prefer-readonly-parameter-types (#4997)6fe783cfeat: update to TypeScript 4.7-rc (#4829)1d2e41afeat(eslint-plugin): deprecateno-duplicate-importsin favour of `import/no...13c05aefeat(eslint-plugin): [no-empty-function] new allow option overrideMethods (#4...04a216cfix(eslint-plugin): [typedef] stop enforcing rule for assignment expressions ...Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)