From a9c7bcf6439b1e013d9bcd1e92316e5f463739da Mon Sep 17 00:00:00 2001 From: ATX Bot Date: Tue, 9 Jun 2026 09:33:16 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20persist=20catalog=20classification=20to?= =?UTF-8?q?=20DB=20after=20GPN=20failure.=20Previously,=20reclassifyDevice?= =?UTF-8?q?FromCatalog=20was=20called=20but=20the=20result=20was=20not=20s?= =?UTF-8?q?aved=20(first=20persist=20happened=20before=20catalog=20call).?= =?UTF-8?q?=20Now:=20setUnsupported=20=E2=86=92=20recordFailure=20?= =?UTF-8?q?=E2=86=92=20reclassify=20via=20catalog=20=E2=86=92=20persist=20?= =?UTF-8?q?(single=20createOrUpdate=20with=20full=20snapshot=20including?= =?UTF-8?q?=20classified=20params).=20All=20811=20tests=20pass.=20Build=20?= =?UTF-8?q?status:=20Success?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/cwmp/main_state_machine.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/services/cwmp/main_state_machine.ts b/app/services/cwmp/main_state_machine.ts index 373799d..0efb6c7 100644 --- a/app/services/cwmp/main_state_machine.ts +++ b/app/services/cwmp/main_state_machine.ts @@ -135,7 +135,10 @@ class DiscoveringParametersState extends DeviceState { context.device.setGpnStatus('unsupported') context.device.recordGpnFailure() - // Persist circuit breaker state immediately so it survives session drops + // GPN failed → classify params via catalog instead + reclassifyDeviceFromCatalog(context.device) + + // Persist device with classification + circuit breaker state try { const hashId = getDeviceHashIdentifier({ manufacturer: context.device.deviceId.manufacturer, @@ -157,15 +160,12 @@ class DiscoveringParametersState extends DeviceState { }) logger.info( { hashId, gpnStatus: context.device.gpnStatus, circuitBreaker: context.device.gpnCircuitBreaker }, - '[DiscoveringParameters] Persisted GPN failure state to DB' + '[DiscoveringParameters] Persisted GPN failure + catalog classification to DB' ) } catch (e) { logger.error(`Failed to persist GPN circuit breaker state: ${e}`) } - // GPN failed → classify params via catalog instead - reclassifyDeviceFromCatalog(context.device) - return { nextState: new CriticalReadsState(), response: '' } }