BOLT-1322 [5/7] domains/device command.executed handler: persist output + upsert vehicleStaticState for check-pairing-status
completedWhen command.executed event arrives carrying an 'output' field, persist it on the Command row. When the slug is 'vehicle:check-pairing-status', also upsert the keypair-relevant fields into VehicleStaticState.
1. Locate the command.executed consumer in domains/device — likely under domains/device/src/events/handlers/command.executed/. Confirm path.
2. In the handler:
- Always persist event.output onto the Command record if present (commandRepository.updateCommand with output).
- If event.command === 'vehicle:check-pairing-status' and event.output is structurally valid (parse against VehicleCheckPairingStatusCommandOutputSchema from @texturehq/command):
call deviceStaticStateRepository.upsertVehicleStaticState({
deviceId: \<deviceId from command\>,
vehicleStaticState: {
keyPaired: event.output.keyPaired,
extendedCapabilities: event.output.extendedCapabilities
}
})
- On schema parse failure: log and skip upsert (don't fail the whole event).
3. Tests:
- output present, slug=check-pairing-status: command row updated, upsertVehicleStaticState called with derived args.
- output absent: command row updated as before, upsertVehicleStaticState NOT called.
- slug != check-pairing-status but output present: command row updated with output, no static state write.
Branch: havoc/bolt-1322-command-executed-handler
Worktree: ../mono-bolt-1322-command-executed-handler
Depends on: [1/7] [2/7] [3/7]
Done when: handler tests pass + branch builds.
Event Timeline
created
status_change
queued → in_progress
failed
lease expired — re-queued for retry
in_progress → queued
status_change
queued → completed