fix: align device pod status contract

This commit is contained in:
Codex
2026-05-29 19:13:06 +08:00
parent 49b435796b
commit 8f0bda969b
4 changed files with 58 additions and 6 deletions
+7
View File
@@ -28,6 +28,13 @@ test("device pod executor exposes cloud-api authority boundary and method guards
assert.equal(status.devicePodId, "device-pod-test");
assert.equal(status.status, "blocked");
assert.equal(status.summary.blocker.code, "gateway_dispatch_unavailable");
assert.equal(status.targetId, null);
assert.equal(status.profileHash, "");
assert.match(status.traceId, /^trc_devicepod_/u);
assert.match(status.operationId, /^op_devicepod_/u);
assert.equal(status.freshness.stale, true);
assert.equal(status.truncation.truncated, false);
assert.match(status.output.summary, /device-host-cli dispatch is owned/u);
const events = await fetchJson(`http://127.0.0.1:${service.port}/v1/device-pods/device-pod-test/events?limit=1`);
assert.equal(events.events.length, 1);
+19 -2
View File
@@ -103,17 +103,34 @@ function listPayload() {
}
function statusPayload(id) {
const blocker = gatewayAdapterBlocker("device-host-cli dispatch is owned by hwlab-cloud-api gateway routing");
const observedAt = new Date().toISOString();
const output = boundedOutput({ text: blocker.summary, summary: blocker.summary });
const freshnessPayload = freshness(observedAt, blocker);
return {
serviceId: SERVICE_ID,
contractVersion: CONTRACT_VERSION,
status: "blocked",
devicePodId: id,
observedAt: new Date().toISOString(),
targetId: null,
profileHash: "",
traceId: `trc_devicepod_${randomUUID()}`,
operationId: `op_devicepod_${randomUUID()}`,
observedAt,
source: sourcePayload(),
blocker,
freshness: freshnessPayload,
output,
text: output.text,
bytes: output.bytes,
truncation: output.truncation,
summary: {
devicePodId: id,
targetId: null,
profileHash: "",
status: "blocked",
blocker: gatewayAdapterBlocker("device-host-cli dispatch is owned by hwlab-cloud-api gateway routing")
freshness: freshnessPayload,
blocker
}
};
}