- Add #domain, #protocol, #utils aliases to package.json imports map
- Replace all relative imports (./, ../, ../..) in app/ and
database/mongo_migrations/ with the corresponding #alias imports,
eliminating relative path traversal across the codebase
- Remove dead code: ConfigurationVersionModel.findByConfigurationIdentifier
(unused, superseded by paginateVersions) and unused exception classes
(NotFoundException, UnprocessableEntityException, DatabaseException)
from app/exceptions/index.ts, keeping only BadRequestException
- Fix pre-existing syntax error in configuration_version.ts (mismatched
parenthesis) that broke tsc
- Fix eqeqeq violation in configuration_service.ts and isNaN ->
Number.isNaN in configuration_engine.ts / cwmp-1-0.ts / exchange_controller.ts
- Fix no-shadow violation in cwmp-1-0.ts EventStruct constructor
- Prettier formatting pass on touched files
Validated: tsc --noEmit clean, eslint app/ clean, full test suite green.
- Convert value imports used only as types to 'import type' across
all modified files (cwmp_message_builder, task_queue, device_action_executor,
main_state_machine, immediate_command_state_machine, configuration_evaluation_state,
cwmp_controller, cwmp_middleware, device.ts, soap.ts, soap_envelope.ts, tr069_types.ts)
- Replace != null with !== null && !== undefined in main_state_machine and cwmp_controller
- device_record.ts: add lastRemoteIp field to store the CPE public IP
from each Inform (X-Forwarded-For or TCP remote IP)
- cwmp_controller.ts: persist lastRemoteIp on every Inform alongside
lastPeriodicInformAt (single operation)
- device_service.ts: sendWakeOnWlan() now tries the original URL first
(may be IPv6), then falls back to a rebuilt URL using lastRemoteIp
(IPv4 public IP) if the ACS server has no IPv6 connectivity
- state_machine_manager: add deviceToRemotes reverse index (Map<deviceKeyJson, Set<remoteKey>>)
so completeMachine/failMachine clean up remoteToDevice in O(1) — fixes unbounded memory leak
- state_machine_manager: getHashIdForRemoteIp() now only matches RUNNING sessions and
returns undefined when multiple candidates exist (NAT/CGNAT safety)
- state_machine_manager: IPv6 bracket normalization in IP comparison
- cwmp_controller: apply IP fallback to TransferComplete and generic response handler
(same new-TCP-port scenario as empty POST after firmware reboot)
- cwmp_logger_middleware: reuse request.cwmp.sessionId instead of recomputing
from socket to avoid formula drift
When a CPE sends an empty POST (polling) on a new TCP connection, the
remoteKey (IP:port) differs from the one registered during Inform.
Add StateMachineManager.getHashIdForRemoteIp() to find the device by
IP alone as a fallback, so cwmpDeviceId is resolved and the exchange
is properly stored in the trace (cwmpMethod: Empty, dashed arrow).
- cwmp_middleware: log XML brut recu (bodyPreview 500 chars), contentType,
bodyLength, et message extrait (type, cwmpVersion, cwmpId, messageKeys)
+ log body vide (CPE polling)
- cwmp_logger_middleware: log XML pretty-print complet CPE->ACS et ACS->CPE
en debug, independamment du statut trace
- cwmp_controller: log routage message (messageType), InformResponse,
TransferCompleteResponse, reponses state machine avec longueur