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
@@ -59,11 +59,22 @@ class SQLAlchemyCloudRepository:
self,
host_id: str,
devices: list[Any],
*,
allow_device_takeover: bool = False,
) -> None:
with self._sessions.begin() as session:
session.execute(
delete(PooledDeviceRow).where(PooledDeviceRow.host_id == host_id)
)
if allow_device_takeover:
device_ids = [device.device_id for device in devices]
if device_ids:
session.execute(
delete(PooledDeviceRow).where(
PooledDeviceRow.host_id != host_id,
PooledDeviceRow.device_id.in_(device_ids),
)
)
session.add_all(
[
PooledDeviceRow(