fix(web-probe): expose exact command artifacts

This commit is contained in:
Codex
2026-07-10 12:06:31 +02:00
parent 70bf798d46
commit 3a26e77e25
4 changed files with 226 additions and 5 deletions
@@ -1,7 +1,7 @@
import assert from "node:assert/strict";
import { test } from "bun:test";
import { withWebObserveCommandRendered } from "../hwlab-node-web-observe-render";
import { withWebObserveCommandRendered, withWebObserveStatusRendered } from "../hwlab-node-web-observe-render";
import { renderWebProbeScriptResult } from "./web-observe-render";
import { webProbeScriptCommandGovernance } from "./web-observe-scripts";
@@ -21,9 +21,51 @@ test("observe command renderer separates control completion from async turn term
assert.match(text, /CONTROL.*TURN_SUBMIT.*TURN_TERMINAL/u);
assert.match(text, /completed.*accepted.*not-observed.*trc_fixture/u);
assert.match(text, /does not imply the asynchronous business turn reached a terminal state/u);
assert.match(text, /observe status webobs-fixture --command-id cmd-fixture/u);
assert.match(text, /--view turn-summary --command-id cmd-fixture/u);
});
test("observe status renderer exposes the exact command phase and failed report evidence", () => {
const rendered = withWebObserveStatusRendered({
ok: true,
status: "running",
command: "web-probe observe status",
id: "webobs-fixture",
node: "NC01",
lane: "v03",
observer: {
processAlive: true,
manifest: { baseUrl: "https://hwlab.example.test", targetPath: "/workbench" },
heartbeat: { status: "running", sampleSeq: 12, commandSeq: 3, updatedAt: "2026-07-10T01:00:01.000Z" },
diagnostics: { effectiveLiveness: "alive", heartbeatStale: false },
commands: { pendingCount: 0, processingCount: 0, abandonedCount: 0, failedCount: 1 },
exactCommand: {
commandId: "cmd-fixture",
type: "validateRealtimeFanout",
phase: "failed",
ok: false,
error: {
message: "terminal event arrived before subscriber disconnect",
details: {
reportPath: "artifacts/realtime-fanout/cmd-fixture/report.json",
reportSha256: "sha256:fixture-report",
},
},
},
tails: { samples: [], control: [], network: [] },
},
next: {
status: "bun scripts/cli.ts web-probe observe status webobs-fixture",
},
});
const text = String(rendered.renderedText);
assert.match(text, /Exact command:/u);
assert.match(text, /cmd-fixture.*validateRealtimeFanout.*failed.*false/u);
assert.match(text, /sha256:fixture-report/u);
assert.match(text, /terminal event arrived before subscriber disconnect/u);
});
test("web-probe script render warns to promote repeated scripts into commands", () => {
const commandPromotionHint = {
schemaVersion: "unidesk.web-probe.command-promotion.v1",