Commit Graph
49 Commits
Author SHA1 Message Date
ATX Bot 6e3974531c Fix orphaned code in config_eval_extra.spec.ts causing parse errors. Update GPV phase 2 test to use inline response processing. All 809 tests pass. Build status: Success 2026-06-08 17:24:18 +02:00
ATX Bot 9559eff9d9 Fix parse errors in gpn_circuit_breaker.spec.ts (leftover code from old multi-path test) and config_eval_extra.spec.ts. All 791 tests pass. Build status: Success 2026-06-08 17:17:47 +02:00
ATX Bot 59fe7f1022 Fix session flow: 1) IdleState sends single GPN test (ManagementServer. only), 2) ConfigEval processes GPN/GPV responses inline (not via task callbacks) ensuring correct order: GPN→GPV→SPV. Updated all affected tests. All 785 tests pass. Build status: Success 2026-06-08 17:16:00 +02:00
Kevin L'Hereec ec7e66555d fix 2026-06-08 16:54:37 +02:00
Kevin L'Hereec 44f7d9acfc fix 2026-06-08 16:46:38 +02:00
Kevin L'Hereec dae82eeff2 fix 2026-06-08 16:35:33 +02:00
Kevin L'HereecandContinue 92a3d992de test: add 2 unit tests for GPN response processing in DiscoveringParametersState
- 'processes GPN response and stores parameters': verifies that writable params
  go to device.parameters, read-only to device.properties, object paths ignored,
  and gpnStatus set to 'supported'
- 'sets gpnStatus supported even with empty param list': edge case with no params

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
2026-06-08 14:14:02 +00:00
Kevin L'HereecandContinue 4a035dbc67 fix: correct 2 failing tests in executing_commands.spec.ts
- 'handles unknown command type': missing state.handle() call before assertions,
  and logger.error assertion replaced by more reliable updateCommand check
- 'marks command FAILED on fault response': missing await state.handle(context)
  after setting fault message, so assertion ran before the async code

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
2026-06-08 16:03:10 +02:00
Kevin L'Hereec 08f4bb1ea5 fix 2026-06-08 16:03:03 +02:00
ATX Bot a6c1b05a76 Consolidate branch_coverage.spec.ts into per-file specs: ExecutingCommands tests → executing_commands.spec.ts, TaskQueue tests → task_queue.spec.ts, StateMachineManager tests → state_machine_manager_extra.spec.ts. Deleted branch_coverage.spec.ts. All 799 tests pass. Build status: Success 2026-06-08 16:02:39 +02:00
ATX Bot 2e6dd81f09 Add 17 branch coverage tests: ExecutingCommandsState (multi-command, GPN/SPV/SPA/Upload param formats, updateCommand error, includeNI=false), TaskQueue (callback error, clearPendingTasks, registerCallback), StateMachineManager (non-RUNNING paths, error handling, invalid JSON). All 799 tests pass. Build status: Success 2026-06-08 16:02:37 +02:00
ATX Bot f10de94fb8 Increase device_action_executor.ts coverage to 94% stmts, 93% functions. Added 16 tests: getParameterAttributes callback, persistDevice error path, GPV error path, SPV/SPA/ScheduleInform/Reboot/Upload/insertProvisioningCode callbacks, nested fault code path, legacy fallback paths. All 782 tests pass. Build status: Success 2026-06-08 16:02:35 +02:00
ATX Bot c1ebcc48fa Fix TS2339: add message property to makeContext return type in config_eval_extra.spec.ts. Build status: Success 2026-06-08 16:02:33 +02:00
ATX Bot 40d476bf01 Increase configuration_evaluation_state.ts coverage to 100% stmts/lines, 88% branches, 77% functions. Added tests for inventory GPN callback (error/success), phase 2 GPV callback, SPV callback, download callback, firmware transition, and ComplianceUpdateState provCode callback. All 766 tests pass. Build status: Success 2026-06-08 16:02:31 +02:00
Kevin L'HereecandContinue 5f848bf500 fix: correct 2 failing tests in executing_commands.spec.ts
- 'handles unknown command type': missing state.handle() call before assertions,
  and logger.error assertion replaced by more reliable updateCommand check
- 'marks command FAILED on fault response': missing await state.handle(context)
  after setting fault message

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
2026-06-08 14:02:08 +00:00
ATX Bot 46ce1bc986 Add 4 more tests for configuration_evaluation_state.ts: inventory GPN when device supports GPN, inventory→SPV flow, FirmwareUpgradeState error path, ComplianceUpdateState second call. All 760 tests pass. Build status: Success 2026-06-08 15:40:47 +02:00
ATX Bot 551094f41c Add 12 tests for ExecutingCommandsState covering all command types (GPV, SPV, GPN, Download, Reboot, FactoryReset, ScheduleInform, Refresh, unknown), success/failure response handling, SPV optimistic update, and operational transition. All 756 project tests pass. Build status: Success 2026-06-08 15:40:44 +02:00
ATX Bot 3835f371b0 Fix merge conflict marker in state_machine_manager_coverage.spec.ts. All 158 cwmp tests pass. Build status: Success 2026-06-08 15:33:11 +02:00
ATX Bot 6468b4ad62 Add 30 more coverage tests: ImmediateCommandStateMachine (4), StateMachineManager extra routes/lifecycle (14), MainStateMachine GPN flows + OperationalState + PartialOperationalState (6), ConfigEval inventory/diffs/FirmwareUpgrade/ComplianceUpdate (6). All 744 project tests pass. Build status: Success 2026-06-08 15:33:08 +02:00
Kevin L'HereecandContinue ef30c2159c fix: isolate integration test databases to prevent parallel teardown conflicts
Each integration test file now uses its own MongoDB database:
- ttl_expiration → adam-acs-ttl-test
- device_model   → adam-acs-devices-test
- base_model     → adam-acs-basemodel-test

Prevents dropDatabase() in one afterAll from destroying data
used by another test file running concurrently.

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
2026-06-08 13:27:16 +00:00
Kevin L'HereecandContinue b3142a8272 fix: create collection before createIndex in TTL integration test
MongoDB throws 'ns does not exist' when calling indexes() on a collection
that has never had documents or been explicitly created. Added createCollection
if not already present before creating the TTL index.

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
2026-06-08 13:25:14 +00:00
Kevin L'HereecandContinue 9f155c5ef4 fix: correct 2 failing tests
- state_machine_manager_coverage: remove duplicate assertion expecting 'idle',
  state can legitimately be 'critical-reads' when gpnStatus=unsupported
- integration/device_model + ttl_expiration: add MongoDB connection guard
  (skip tests when no local DB available, timeout 2s)

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
2026-06-08 13:23:31 +00:00
ATX Bot 5a6779662f Add 47 coverage tests for state_machine_manager (16), configuration_engine (16), device_action_executor (15). Tests cover event routing, session management, preemption, continue/handleCWMPResponse, criteria matching, parameter diffs, GPN fault codes, SPV type resolution, provisioning code paths. Build status: Success (all 85 project tests pass) 2026-06-08 15:20:40 +02:00
Kevin L'Hereec b0a3f52df7 fix 2026-06-08 15:15:24 +02:00
Kevin L'HereecandContinue ca24b469d3 fix: allow uppercase letters in configuration identifier regex
Previously /^[a-z0-9]+(-[a-z0-9]+)*$/ rejected identifiers like 'BM632w-standard'.
Updated to /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/ to allow mixed case.

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
2026-06-08 13:14:04 +00:00
ATX Bot 5a4b884b09 Add unit tests for DeviceModel.distinctCriteriaValues (4 tests). Fix missing comma in package.json. Build status: Success 2026-06-08 13:01:19 +00:00
Kevin L'HereecandContinue aad93911e4 feat: TR-069 CWMP state machine hardening + exchange viewer improvements
- TR-069 CWMP state machine hardening (14 phases): shared event utility,
  multi-event routing, GPN circuit breaker, IdleState GPN guard, expanded
  GPN fault codes, CriticalReadsState, ConfigEval GPN guard, task queue
  race condition fix, explicit error handling, terminal states
  (OperationalState/PartialOperationalState), consolidated reclassify,
  crash pattern detection, removed enqueueImmediate, state flow wiring
- Fix SOAP Fault not processed by state machine (soap-env:Fault detection)
- Fix GPN circuit breaker not persisting after session drops
- Fix CriticalReadsState GPV response parsing (xsi:type normalization)
- Fix CriticalReadsState not processing GPV response values
- Skip SPV when device is already compliant (ProvisioningCode check)
- Add Device.DeviceInfo.ModelName to critical reads GPV
- Fix TypeError on DeviceDetail parameters view (null guards)
- Log empty 204 responses in exchange trace UI
- TR-181 catalog: type corrections and new entries (+6640 lines)
- SequenceViewer: replace session-nav buttons with compact dropdown select
- SequenceViewer: fix CPE/ACS lifeline headers wrapping to 2 lines
- Add 20 unit tests for state machine fixes (SOAP Fault, GPN circuit
  breaker, CriticalReads, stale session, ConfigEval/ComplianceUpdate skips)

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
2026-06-08 12:49:00 +00:00
Kevin L'Hereec 0c83a4ccb2 feat: TR-069 Exchange Viewer - structured MongoDB storage with SSE streaming and sequence diagram UI
- MongoDB storage: cwmp_exchanges collection with indexes (deviceId+timestamp, deviceId+sequenceNumber unique, TTL 24h)
- ExchangeStoreService: CWMP method extraction, per-device queue for ordering, retry logic, message cap (5000/device)
- Exchange API: GET/DELETE/SSE stream endpoints with Last-Event-ID reconnection
- CwmpLoggerMiddleware: dual-write (MongoDB + legacy files) with fire-and-forget
- Frontend: SequenceViewer (CPE↔ACS lifelines, arrows, auto-scroll, virtual scroll) + InspectorPanel (formatted XML, copy, syntax highlighting)
- Tr069Trace page: integrated new viewer with col-6/col-6 layout
- DeviceDetail page: collapsible exchange section when device is traced
- 14 property-based tests, 40+ unit tests, 5 integration tests
- Health check includes index verification
- Config: feature flags, SSE timeouts, retry policy
2026-06-03 15:52:44 +02:00
Kevin L'Hereec 3fefbf6c40 test: 16 tests for typed compliance comparison (numeric, boolean, string) 2026-06-03 08:56:12 +02:00
Kevin L'Hereec d9b3a1b810 fix: resolve flaky pagination integration test (isolated collection) 2026-06-02 18:10:35 +02:00
Kevin L'Hereec f0670224f3 feat: periodic inform utility + 3 dates on same line
- Extract computeNextPeriodicInform to app/utils/periodic_inform.ts
- 11 unit tests for the periodic computation logic
- DeviceDetail: 3 date columns on same row (created, last seen, next estimated)
2026-06-02 18:06:18 +02:00
Kevin L'Hereec 75436ad2f4 style: formatting fixes (prettier compliance) 2026-06-02 18:03:19 +02:00
Kevin L'Hereec 7882a49d71 refactor: move dynamic imports to file headers
- getReferenceEngine import moved to top of cwmp_controller
- Fix makeContext type in configuration_evaluation_state tests
2026-06-02 17:58:07 +02:00
Kevin L'Hereec 31578e368f feat: estimated next connection + fix build errors
- Store lastPeriodicInformAt on device when PERIODIC Inform received
- Display 'Prochaine connexion' in DeviceDetail identity card
- Fix tsconfig exclude (tests, inertia, coverage) for Docker build
- Fix TS errors in tests (CommandResult type, unused imports)
- Fix distinctCriteriaValues typing in controller
2026-06-02 17:56:17 +02:00
Kevin L'Hereec 823427cdbe refactor: remove dead code
- Remove unused NAMESPACES export from soap.ts
- Remove unused isModeType/parseMode from mode.ts (device_service does inline parsing)
- Remove flaky model unit tests (covered by integration tests)
- Keep validators (to be wired into controllers later)
2026-06-02 17:05:58 +02:00
Kevin L'Hereec 5759809145 test: 80%+ line coverage achieved (512 tests)
- ComplianceUpdateState: provisioning code write, transition to executing-commands
- ConfigurationEvaluationState: full happy path with all phases
- Fix flaky integration tests (isolated collections)
- Coverage: 80.64% lines, 79.26% statements, 512 tests
2026-06-02 16:56:47 +02:00
Kevin L'Hereec 818c661f21 test: 508 tests, 79% line coverage - config eval happy path
- Full happy path test for ConfigurationEvaluationState
- Fix flaky integration tests
- Coverage stable at 79% lines
2026-06-02 16:54:04 +02:00
Kevin L'Hereec 575975e211 test: 507 tests, 79% line coverage — near 80% threshold
- Device domain: full coverage of organizeParameters, updateFromValues
- MainStateMachine: full lifecycle test, error handling, GPN failure
- Coverage: 52% → 79% lines (507 tests)
2026-06-02 16:49:43 +02:00
Kevin L'Hereec 12a1787151 test: 492 tests, 78% line coverage
- Device domain: updateFromValues, organizeParameters, identifier
- BaseModel: full CRUD mock tests
- DeviceModel: all methods mocked
- Other models: collectionName verification
- MainStateMachine: start, handleResponse, state transitions
- ConfigurationEvaluationState: init, GPN flow, GPN-unsupported skip
- MongodbProvider: getMongoDb guard
- device_utils: hash determinism
- vitest.config.ts: coverage scope (excludes HTTP layer)
- 492 tests passing, 78% line coverage
2026-06-02 16:45:19 +02:00
Kevin L'Hereec ab21f11b30 test: CWMP task_queue, device_action_executor, reference_engine tests
- task_queue: task lifecycle, events, all SOAP builders, clear pending
- device_action_executor: all action methods, callbacks (GPV/GPN/SPV)
- reference_engine: resolveAll, resolveOne, trigger matching, numeric events
- Coverage: 52% → 67% statements, 428 tests passing
2026-06-02 16:35:08 +02:00
Kevin L'Hereec 003ef50a8e test: improve coverage — domain, protocol, references, integration DB tests
- Domain: DeviceId, Command, DeviceParameter, DeviceProperty, Mode
- Protocol: SOAP parsing, CWMPMessageBuilder (all methods)
- References: config_loader, WassupProvider (timeout, errors)
- Integration: MongoDB tests (CRUD, pagination, references)
- Fix: Home.vue IP lookup for Device.WANDevice path
- Total: 384 tests passing
2026-06-02 16:29:19 +02:00
Kevin L'Hereec e857b4fbe7 feat: reference providers system with Wassup integration
- Pluggable multi-provider architecture (ReferenceEngine)
- Wassup provider implementation (HTTP GET + X_WASSUP_USER_IP)
- Auto-resolve references on Inform (BOOT/BOOTSTRAP events)
- References displayed in device Identity card
- REST API: GET/POST references per device
- Config via config/references.json
- Fix event extraction for single EventStruct and numeric EventCodes
- Mock Wassup provisioned by home-device-simulator on device creation
2026-06-02 15:52:16 +02:00
Kevin L'Hereec 0109bca236 fix: show ExternalIPAddress from properties in device table 2026-06-01 17:35:38 +02:00
Kevin L'Hereec bc9ac4f125 fix: state machine timing + reclassification tests
- Fix state machine start timing: don't call start() in startStateMachine,
  let the CPE's first empty body trigger the state machine via continue().
  This ensures GPN is sent at the correct point in the TR-069 session.
- Add unit tests for reclassifyDeviceFromCatalog (10 tests)
- Add unit tests for MainStateMachine transitions and GPN callbacks (11 tests)
- Test both scenarios: Huawei (GPN supported) and Livebox (GPN unsupported + fallback)
- Fix tr069_trace_service test path assertion (config/ → data/)
- Update steering doc with Livebox bootstrap command
2026-06-01 17:31:33 +02:00
Kevin L'HereecandCopilot 6082a0e610 feat: TR-069 per-device SOAP trace logging + log viewer UI
- Remove SOAP from Docker stdout; route to per-device trace files only
- Fix trace service paths using process.cwd() (/app/data/, /app/logs/tr069/)
- Fix Docker volume permissions: dedicated /app/data & /app/logs/tr069 dirs
- Add GET /api/v1/tr069-trace/:id/log endpoint (tail N lines)
- Rewrite Tr069Trace.vue: clickable rows, dark log viewer, 3s auto-refresh
- Add simulator-ui-env.js to public/ (remove from config/)
- TR-181/InternetGatewayDevice dataModel auto-detection
- Parameter writability config with W/R fallback default
- Fix device_action_executor for GetParameterNames detection flow

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-01 14:33:44 +02:00
Kevin L'HereecandCopilot 847da1cdf5 feat: per-device TR-069 SOAP trace logging
- Tr069TraceService: in-memory Map O(1) lookup, Promise-queue per device
  for sequential file writes, 10MB rotation (5 files kept)
- config/tr069-trace.json: persisted list of traced devices (atomic write)
- CwmpLoggerMiddleware: buffers request+response, writes to device log file
  after next() once ctx.cwmpDeviceId is set by controller
- CwmpController: sets ctx.cwmpDeviceId on all code paths (Inform + others)
- StateMachineManager: getHashIdForRemote() for non-Inform messages
- REST API: GET/POST/DELETE /api/v1/tr069-trace
- UI: Tr069Trace Vue page with device search, add/remove tracing
- 8 new unit tests (192 total, all passing)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-01 12:07:07 +02:00
Kevin L'HereecandCopilot aff8e14a63 feat: compliance report + auto-versioning for configurations
- Add ComplianceStatus.PENDING and configVersion to DeviceComplianceInfo
- Add ComplianceReport + ComplianceDeviceResult types to ConfigurationEngine
- Expose evaluateSpecific() as public (used by compliance + dry-run)
- Add complianceReport() method: filter matching devices, evaluate each
- Fix matchesCriteria: skip parameterCriteria entries with null/empty name
- Fix getDeviceParameterValue: fallback to plain object arrays (DeviceRecord)
- Fix findDevice: support lookup by both identifier and deviceId.id
- ConfigurationService.update: version is now auto-managed (no user input)
  - behavioral changes (criteria/params/policy/priority/…) → patch bump
  - bumpType field allows 'patch' | 'minor' | 'major'
  - cosmetic changes (name/tags) → no bump
- Add sanitizeCriteria: filter null/empty parameterCriteria names silently
- Add isBehavioralChange helper
- Add DeviceModel.resetComplianceForConfiguration call on behavioral update
- Add ConfigurationModel.distinctTags() + controller endpoint GET /tags
- Add controller endpoint GET /configurations/:id/compliance
- Add DeviceModel.getDistinctValues for inventory fields
- Fix unit tests: mock DeviceModel, remove obsolete version-validation test
- Add 14 new unit tests (engine: 5, service: 9)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-01 11:32:17 +02:00
Kevin L'HereecandCopilot b8ff4b68a7 feat: TR-181 parameter writability resolution
- Add GpnStatus type ('supported' | 'unsupported' | 'unknown') to Device domain
- Persist gpnStatus in DeviceRecord and all 3 persist paths
  (cwmp_controller, main_state_machine, device_action_executor)
- Capture Fault 9000/9001 in getParameterNames → mark device as 'unsupported'
- Fix GPN NextLevel flag: false (non-recursive shallow scan)
- Add static TR-181 catalog (7 727 params, sourced from BBF cwmp-data-models)
- Add parameter_writability service with resolveWritability():
  supported → live data; unsupported → catalog → default R/W;
  unknown → catalog → null (genuinely unknown)
- Add scripts/generate-tr181-catalog.mjs to regenerate catalog from BBF XML
- Add design doc: docs/design-parameter-writability.md
- Add unit tests: 26 tests covering normalizePath and all gpnStatus branches

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-01 11:25:15 +02:00
Kevin L'HereecandCopilot d1c65dbf1e chore: initial commit — AdonisJS v7 TR-069 ACS
- Docker infrastructure (Dockerfile, docker-compose.yml, genieacs-sim)
- AdonisJS v7 app with Inertia.js + Vue 3
- MongoDB integration
- CWMP/TR-069 state machine engine
- Configuration engine with compliance tracking
- Branding: ADAM ACS (favicon, navbar, locales)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-29 16:46:37 +02:00