fix(device-pool): scope primary key by host and thread through capability_tags

- pooled_devices primary key changed from device_id alone to
  (host_id, device_id), so two hosts reporting the same local
  device_id no longer crash sync_host_devices() with an uncaught
  sqlite3.IntegrityError.
- Device gained a capability_tags field so DevicePool.sync_host_devices()
  can actually populate PooledDevice.capability_tags from a real host
  sync instead of always falling back to an empty list.

openspec: device-pool capability, archived change cloud-runtime
This commit is contained in:
2026-07-07 08:30:47 +08:00
parent a15756835c
commit 1bdc3784dc
7 changed files with 93 additions and 5 deletions
+2
View File
@@ -58,6 +58,7 @@ class Device:
name: str | None = None
driver_type: str = "wda"
connection_info: dict[str, Any] = field(default_factory=dict)
capability_tags: list[str] = field(default_factory=list)
def to_dict(self) -> dict[str, Any]:
return {
@@ -66,6 +67,7 @@ class Device:
"status": self.status,
"driver_type": self.driver_type,
"connection_info": dict(self.connection_info),
"capability_tags": list(self.capability_tags),
}