fix: 恢复 WebProbe AgentRun 截图验收

This commit is contained in:
Codex
2026-07-16 12:21:07 +02:00
parent 5e0010590e
commit 1a700f2bec
5 changed files with 68 additions and 1 deletions
@@ -12,6 +12,7 @@
- 默认 profile 由同一 YAML 的 `defaultConsoleVerificationProfile` 选择,CLI `--profile` 只做显式 profile 选择;
- 该命令用于已部署页面人工 closeout,不作为 CI/CD gate,不替代 Workbench Kafka、Trace 和性能专项 validator
- 成功或失败均以有界 `issueEvidence`、report SHA、screenshot SHA 和失败摘要收口,不再重复创建 `.state/probes/*.mjs`
- AgentRun 思维导图的聚焦验收使用 `--profile agentrun-tree`,直接恢复 `/agents/runs?view=tree`、等待 `.agent-mind-map` 并采集 `1920x1080` 截图。
- WebProbe 远程命令错误可见性:
- 默认文本输出必须在独立 `COMMAND_OUTPUT` 段完整展示已经脱敏并限长的 `stderrTail``stdoutTail`
- 摘要表可以继续提供单行预览,但不得用表格宽度裁剪替代完整的有界错误证据;
+22
View File
@@ -848,6 +848,28 @@ templates:
- buttonName: 表格
queryValue: table
screenshotName: agentrun-table.png
agentrun-tree:
navigationTimeoutMs: 30000
settleMs: 1200
commandTimeoutSeconds: 120
minTextLength: 8
maxHorizontalOverflowPx: 2
outputLimits:
failures: 20
consoleErrors: 20
responseErrors: 20
screenshots: 1
textPreviewChars: 160
viewports:
- id: desktop
width: 1920
height: 1080
routes:
- id: agent-runs-tree
path: /agents/runs?view=tree
readySelector: .agent-mind-map
screenshot: true
workflows: {}
realtimeFanoutProfiles:
pure-kafka-live:
subscriberCount: 2
@@ -39,6 +39,15 @@ test("Cloud Console verification profile is owned by lane YAML", () => {
assert.equal(profile.routes.length, 20);
assert.equal(profile.routes.filter((item) => item.screenshot).length * profile.viewports.length + (profile.workflows.agentObserver?.views.length ?? 0), 24);
assert.deepEqual(profile.workflows.hwpod?.requiredCommandPrefixes, ["Get-FileHash .\\", "python .\\"]);
const agentrunTree = spec.webProbe?.consoleVerificationProfiles?.["agentrun-tree"];
assert.ok(agentrunTree);
assert.deepEqual(agentrunTree.routes, [{
id: "agent-runs-tree",
path: "/agents/runs?view=tree",
readySelector: ".agent-mind-map",
screenshot: true,
}]);
assert.deepEqual(agentrunTree.viewports.map((item) => [item.width, item.height]), [[1920, 1080]]);
});
test("Cloud Console profile parser rejects unknown fields and duplicate route ids", () => {
@@ -4,7 +4,41 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { test } from "bun:test";
import { nodeWebObserveStatusNodeScript, nodeWebObserveWaitCommandShell } from "./web-observe-scripts";
import { hwlabRuntimeLaneSpecForNode } from "../hwlab-node-lanes";
import { nodeWebObserveStatusNodeScript, nodeWebObserveWaitCommandShell, nodeWebProbeScriptRemoteShell } from "./web-observe-scripts";
test("web-probe script exports generated runner paths into the guarded child shell", () => {
const script = nodeWebProbeScriptRemoteShell({
action: "script",
node: "NC01",
lane: "v03",
url: "https://lab-dev.hwpod.com",
timeoutMs: 30_000,
viewport: "1920x1080",
browserProxyMode: "auto",
commandTimeoutSeconds: 60,
scriptText: "export default async () => ({ ok: true });",
scriptSource: { kind: "generated", path: null, byteCount: 1, sha256: "fixture" },
originName: "public",
originMode: "public",
originConfigPath: "fixture",
browserProxyModeSource: "yaml-origin",
}, hwlabRuntimeLaneSpecForNode("v03", "NC01"), {
username: "fixture-user",
password: "fixture-password",
}, {
loginPath: "/auth/login",
usernameField: "username",
passwordField: "password",
cookieNames: ["hwlab_session"],
}, {
envAssignments: [],
summary: {},
}, undefined);
assert.match(script, /rm -f "[$]user_script_b64" "[$]runner_b64"\nexport run_dir user_script runner\n/u);
assert.match(script, /UNIDESK_WEB_PROBE_RUN_DIR="[$]run_dir"[\s\S]+node "[$]runner"/u);
});
async function runStatusScript(stateDir: string, commandId: string): Promise<Record<string, any>> {
const child = Bun.spawn(["bash", "-lc", nodeWebObserveStatusNodeScript(1, "NC01", "v03", commandId)], {
@@ -826,6 +826,7 @@ export function nodeWebProbeScriptRemoteShell(
"node -e \"const fs=require('fs'); fs.writeFileSync(process.argv[1], Buffer.from(fs.readFileSync(process.argv[2], 'utf8').replace(/\\s+/g, ''), 'base64'))\" \"$user_script\" \"$user_script_b64\"",
"node -e \"const fs=require('fs'); fs.writeFileSync(process.argv[1], Buffer.from(fs.readFileSync(process.argv[2], 'utf8').replace(/\\s+/g, ''), 'base64'))\" \"$runner\" \"$runner_b64\"",
"rm -f \"$user_script_b64\" \"$runner_b64\"",
"export run_dir user_script runner",
webProbeGuardedLaunchShell(spec, "manual-start", [
...webProbeProxy.envAssignments,
...webProbeBrowserEvidenceEnvAssignments(spec),