test(openspec): map cloud integration scenarios

This commit is contained in:
2026-07-13 08:21:44 +08:00
parent ffc3df6c5b
commit 7b717a05a9
8 changed files with 200 additions and 6 deletions
+12 -2
View File
@@ -61,6 +61,7 @@ class DevicePool:
snapshot: list[Device],
*,
address: str | None = None,
allow_device_takeover: bool = False,
) -> None:
"""Push a host's current device snapshot into the pool.
@@ -71,7 +72,14 @@ class DevicePool:
now = utc_now()
self.store.upsert_host(host_id, address=address, last_seen_at=now)
devices = [self._to_pooled(device, host_id, now) for device in snapshot]
self.store.replace_host_devices(host_id, devices)
if allow_device_takeover:
self.store.replace_host_devices(
host_id,
devices,
allow_device_takeover=True,
)
else:
self.store.replace_host_devices(host_id, devices)
def list_devices(self) -> list[PooledDevice]:
devices = self.store.list_devices()
@@ -105,7 +113,9 @@ class DevicePool:
host_id: str,
synced_at: datetime,
) -> PooledDevice:
raw_status = device.status if device.status in _HOST_REPORTED_STATUSES else "idle"
raw_status = (
device.status if device.status in _HOST_REPORTED_STATUSES else "idle"
)
tags = list(device.capability_tags or [])
return PooledDevice(
device_id=device.id,