-
-
Notifications
You must be signed in to change notification settings - Fork 10
Tasks Fire and Forget
Reference: docs/plan-fire-and-forget-v2.md
File: src/roborockCommunication/protocol/dispatcher/V10MessageDispatcher.ts line 103
Change: await this.client.get(duid, request) → await this.client.send(duid, request)
Definition of Done:
-
findMyRobot()callsclient.send()notclient.get() -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/abstractMessageDispatcher.ts line 10
Change: Promise<DeviceStatus | undefined> → Promise<void>
Definition of Done:
- Interface signature is
getDeviceStatus(duid: string): Promise<void> -
npm run type-checkexits 0 (all implementations must also be updated in same step if TS complains)
File: src/roborockCommunication/protocol/dispatcher/V10MessageDispatcher.ts lines 30-40
Change: Remove response handling, call client.send(), return void
Definition of Done:
- Method signature is
Promise<void> - Calls
client.send()notclient.get() -
CloudMessageResultimport removed if unused -
debugStringifyimport removed if unused -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/Q10MessageDispatcher.ts lines 36-40
Change: Replace client.get() + response log with client.send()
Definition of Done:
- Calls
client.send()notclient.get() - Response log line removed
-
debugStringifyimport removed if unused -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/Q10MessageDispatcher.ts lines 47-50
Change: client.get() → client.send(), return type Promise<void>
Definition of Done:
- Method signature is
Promise<void> - Calls
client.send()notclient.get() -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/Q10MessageDispatcher.ts lines 58-67
Change: client.get() → client.send(), remove response/log, return stub
Definition of Done:
- Calls
client.send()notclient.get() - Response variable and log line removed
- Returns
new MapInfo({ max_multi_map: 0, max_bak_map: 0, multi_map_count: 0, map_info: [] }) -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/Q10MessageDispatcher.ts lines 70-73
Change: client.get() → client.send(), return []
Definition of Done:
- Calls
client.send()notclient.get() - Returns
[] -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/Q7MessageDispatcher.ts lines 82-93
Change: client.get() → client.send(), remove response/log, return stub
Definition of Done:
- Calls
client.send()notclient.get() - Response variable and log line removed
- Returns
new MapInfo({ max_multi_map: 0, max_bak_map: 0, multi_map_count: 0, map_info: [] }) -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/Q7MessageDispatcher.ts lines 95-106
Change: client.get() → client.send(), remove response/log, return []
Definition of Done:
- Calls
client.send()notclient.get() - Response variable and log line removed
- Returns
[] -
npm run type-checkexits 0
- All tasks 1.1–1.9 complete
-
npm run type-checkexits 0 -
npm testpasses
New file: src/roborockCommunication/routing/listeners/oneShotResponseListener.ts
Definition of Done:
- File exists at the path above
- Implements
AbstractMessageListener(name,duid,onMessage()) - Has
waitFor(): Promise<T>that resolves on first parseFn match, rejects on timeout - Has
settledflag —onMessage()is no-op after resolving or rejecting - Timeout default is
MESSAGE_TIMEOUT_MSfromsrc/constants/index.js -
npm run type-checkexits 0
File: src/roborockCommunication/routing/client.ts
Definition of Done:
-
query<T>(duid, request, parseFn, timeoutMs?)method signature present in interface -
ResponseMessageimported from'../models/index.js' -
npm run type-checkexits 0
File: src/roborockCommunication/routing/abstractClient.ts
Definition of Done:
-
public async query<T>()method implemented - Creates
OneShotResponseListener, registers onresponseBroadcaster, callssendInternal(), awaitswaitFor() - Errors caught and logged, returns
undefinedon failure -
OneShotResponseListenerimported -
npm run type-checkexits 0
File: src/roborockCommunication/routing/clientRouter.ts
Definition of Done:
-
public async query<T>()method implemented - Creates
OneShotResponseListener, registers onbroadcasterFactory, callssend(), awaitswaitFor() - Errors caught and logged, returns
undefinedon failure -
OneShotResponseListenerimported -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/V10MessageDispatcher.ts
Definition of Done:
-
parseV1Result<T>(msg, messageId)function exists at module level (before the class) - Tries
Protocol.rpc_response, thenProtocol.general_response, thenProtocol.general_request - Returns
undefinedif no matching DPS ordps.id !== messageId - Returns
result[0]for arrays,resultfor non-arrays -
DpsPayload,Protocol,ResponseMessageimported as needed -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/V10MessageDispatcher.ts
Definition of Done:
- Calls
client.query<NetworkInfo>()withparseV1ResultparseFn - No
client.get()call remains -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/V10MessageDispatcher.ts
Definition of Done:
- Calls
client.query<{ serial_number: string }[]>()with inline parseFn returningdps.result(notresult[0]) - No
client.get()call remains - Return logic (
response[0].serial_number ?? duid) preserved -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/V10MessageDispatcher.ts
Definition of Done:
- Calls
client.query<MapRoomResponse>()withparseV1ResultparseFn - Returns
response ?? {} - No
client.get()call remains -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/V10MessageDispatcher.ts
Definition of Done:
- Calls
client.query<MultipleMapDto>()(notMultipleMapDto[]) withparseV1ResultparseFn - Passes
responsedirectly tonew MapInfo()(notresponse[0]—parseV1Resultalready unwraps it) - Fallback to empty
MapInfoonundefined - No
client.get()call remains -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/V10MessageDispatcher.ts
Definition of Done:
- Calls
client.query<RawRoomMappingData>()with inline parseFn (dps.resultdirectly) - Returns
response ?? [] - No
client.get()call remains -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/V10MessageDispatcher.ts
Definition of Done:
- Calls
client.query<T>()withparseV1ResultparseFn usingdef.messageId - Returns
result as T - Method is now
async - No
client.get()call remains -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/V10MessageDispatcher.ts
Definition of Done:
-
getCustomMessage('get_custom_mode')read removed -
currentMopMode,smartMopMode,customMopMode,customMopModevariables removed - Guard replaced with:
if (mopRoute && mopRoute !== smartMopRoute) { send set_mop_mode(customMopRoute) } - Remaining sends (
set_custom_mode,set_water_box_custom_mode,set_mop_mode) unchanged -
VacuumSuctionPowerimport removed if no longer used -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/Q10MessageDispatcher.ts
Definition of Done:
- Calls
client.query<T>()with B01 parseFn (extractObject.values(msg.body.data)[0]) - Returns
result as T - No
client.get()call remains -
npm run type-checkexits 0
File: src/roborockCommunication/protocol/dispatcher/Q7MessageDispatcher.ts
Definition of Done:
- Calls
client.query<T>()with B01 parseFn (same pattern as Q10) - Returns
result as T - No
client.get()call remains -
npm run type-checkexits 0
- All tasks 2.1–2.14 complete
- Zero
client.get()calls remain in any dispatcher (grep -r "client\.get(" src/) -
npm run type-checkexits 0 -
npm testpasses
File: src/roborockCommunication/routing/client.ts
Definition of Done:
-
get<T>()line deleted from interface -
npm run type-checkexits 0
File: src/roborockCommunication/routing/abstractClient.ts
Definition of Done:
-
responseTracker: PendingResponseTrackerconstructor param removed (line 30) -
PendingResponseTrackerimport removed (line 13) -
public async get<T>()method deleted (lines 81-92) -
npm run type-checkexits 0
File: src/roborockCommunication/routing/clientRouter.ts
Definition of Done:
-
public async get<T>()method deleted (lines 103-109) -
npm run type-checkexits 0
File: src/roborockCommunication/routing/listeners/responseBroadcaster.ts
Definition of Done:
-
tryResolve(response: ResponseMessage): void;line deleted -
npm run type-checkexits 0
File: src/roborockCommunication/routing/listeners/v1ResponseBroadcaster.ts
Definition of Done:
-
tracker: V1PendingResponseTrackerconstructor param removed -
V1PendingResponseTrackerimport removed -
tryResolve()method deleted -
unregister()simplified tothis.listeners = [] -
npm run type-checkexits 0
File: src/roborockCommunication/routing/listeners/b01ResponseBroadcaster.ts
Definition of Done:
-
tracker: B01PendingResponseTrackerconstructor param removed -
B01PendingResponseTrackerimport removed -
waitFor()method deleted -
tryResolve()method deleted -
unregister()simplified tothis.listeners = [] -
npm run type-checkexits 0
File: src/roborockCommunication/routing/listeners/responseBroadcasterFactory.ts
Definition of Done:
-
implements PendingResponseTrackerremoved from class declaration -
v1Trackerandb01Trackerfields deleted - Tracker imports (
B01PendingResponseTracker,V1PendingResponseTracker,PendingResponseTracker) deleted -
RequestMessageimport removed if unused -
tryResolve(),waitFor(),cancelAll(),getTrackerForDevice()methods deleted - Constructor updated: tracker instantiation removed, broadcaster construction updated (no tracker args)
-
getBroadcasterForResponse()kept (still used byonMessage()) -
npm run type-checkexits 0
File: src/roborockCommunication/local/localClient.ts
Definition of Done:
-
this.responseBroadcaster.tryResolve(response)line deleted (line ~221) -
PendingResponseTrackerimport removed (line 13) -
responseTracker: PendingResponseTrackerconstructor param removed (line 34) -
super()call updated to remove tracker arg (line 36) -
npm run type-checkexits 0
File: src/roborockCommunication/mqtt/mqttClient.ts
Definition of Done:
-
this.responseBroadcaster.tryResolve(response)line deleted (line ~262) -
PendingResponseTrackerimport removed (line 9) -
responseTracker: PendingResponseTrackerconstructor param removed (line 29) -
super()call updated to remove tracker arg (line 31) -
npm run type-checkexits 0
File: src/roborockCommunication/routing/clientRouter.ts
Definition of Done:
-
MQTTClientconstruction (line 28) removesthis.broadcasterFactoryas 5th arg (responseTracker) -
LocalNetworkClientconstruction (lines 43-49) removesthis.broadcasterFactoryas 6th arg (responseTracker) -
npm run type-checkexits 0
Files to delete:
src/roborockCommunication/routing/services/pendingResponseTracker.tssrc/roborockCommunication/routing/services/v1PendingResponseTracker.tssrc/roborockCommunication/routing/services/b01PendingResponseTracker.ts
Definition of Done:
- All three files deleted from disk
- No remaining imports of these files anywhere (
grep -r "pendingResponseTracker\|v1PendingResponseTracker\|b01PendingResponseTracker" src/) -
npm run type-checkexits 0
Files to delete:
src/tests/roborockCommunication/routing/services/v1PendingResponseTracker.test.tssrc/tests/roborockCommunication/routing/services/b01PendingResponseTracker.test.ts
Definition of Done:
- Both test files deleted from disk
-
npm testpasses
File: src/tests/roborockCommunication/routing/listeners/responseBroadcasterFactory.test.ts
Remove test cases:
'should route tryResolve to V1 broadcaster for V1 responses''should route tryResolve to B01 broadcaster for B01 responses''should route waitFor to V1 tracker for V1 devices''should route waitFor to B01 tracker for B01 devices''should cancelAll pending requests from B01 tracker''should fall back to V1 tracker when protocol version is not B01'
Definition of Done:
- All 6 test cases above removed
-
RequestMessageimport removed if unused - Remaining tests pass:
npm test
File: src/tests/roborockCommunication/routing/listeners/v1ResponseBroadcaster.test.ts
Definition of Done:
-
V1PendingResponseTrackerremoved from imports andbeforeEach - Any
tryResolvetest cases removed - Broadcaster construction updated:
new V1ResponseBroadcaster(logger)(no tracker param) -
npm testpasses
File: src/tests/roborockCommunication/routing/listeners/b01ResponseBroadcaster.test.ts
Definition of Done:
-
B01PendingResponseTrackerremoved from imports andbeforeEach -
tryResolveandwaitFortest cases removed - Broadcaster construction updated:
new B01ResponseBroadcaster(logger)(no tracker param) -
npm testpasses
New file: src/tests/roborockCommunication/routing/listeners/oneShotResponseListener.test.ts
Required test cases:
should resolve when parseFn returns a valueshould ignore messages where parseFn returns undefinedshould reject on timeoutshould be a no-op after settling
Definition of Done:
- All 4 test cases implemented using
vitest - Fake timers used for timeout test (
vi.useFakeTimers()/vi.useRealTimers()) - No
client.get()or tracker references -
npm testpasses
- All tasks 3.1–3.16 complete
- Zero references to
PendingResponseTracker,tryResolve,waitFor,cancelAllin non-test src (grep -r "tryResolve\|PendingResponseTracker" src/ --include="*.ts" --exclude="*.test.ts") -
npm run type-checkexits 0 -
npm testpasses