diff --git a/scripts/src/hwlab-node-help.ts b/scripts/src/hwlab-node-help.ts index 176b29c0..9e04f329 100644 --- a/scripts/src/hwlab-node-help.ts +++ b/scripts/src/hwlab-node-help.ts @@ -60,7 +60,7 @@ export function hwlabNodeHelp(): Record { "bun scripts/cli.ts hwlab nodes web-probe sentinel control-plane trigger-current --node D601 --lane v03 --dry-run", "bun scripts/cli.ts hwlab nodes web-probe sentinel validate --node D601 --lane v03", "bun scripts/cli.ts hwlab nodes web-probe sentinel maintenance stop --node D601 --lane v03 --confirm --wait", - "bun scripts/cli.ts hwlab nodes web-probe sentinel report --node D601 --lane v03 --view turn-summary", + "bun scripts/cli.ts hwlab nodes web-probe sentinel report --node D601 --lane v03 --latest --view turn-summary", "bun scripts/cli.ts hwlab nodes observability plan --node D601 --lane v03", "bun scripts/cli.ts hwlab nodes observability status --node D601 --lane v03", "bun scripts/cli.ts hwlab nodes observability apply --node D601 --lane v03 --dry-run", @@ -120,8 +120,8 @@ export function hwlabNodeWebProbeHelp(): Record { "bun scripts/cli.ts hwlab nodes web-probe sentinel validate --node D601 --lane v03 --quick-verify --confirm --wait", "bun scripts/cli.ts hwlab nodes web-probe sentinel maintenance start --node D601 --lane v03 --confirm --wait --release-id ", "bun scripts/cli.ts hwlab nodes web-probe sentinel maintenance stop --node D601 --lane v03 --confirm --wait --release-id ", - "bun scripts/cli.ts hwlab nodes web-probe sentinel report --node D601 --lane v03 --view summary", - "bun scripts/cli.ts hwlab nodes web-probe sentinel report --node D601 --lane v03 --view trace-frame", + "bun scripts/cli.ts hwlab nodes web-probe sentinel report --node D601 --lane v03 --latest --view summary", + "bun scripts/cli.ts hwlab nodes web-probe sentinel report --node D601 --lane v03 --latest --view trace-frame", "bun scripts/cli.ts hwlab nodes web-probe script --node D601 --lane v03 <<'JS'\nexport default async ({ waitWorkbenchReady, fetchJson, fetchApiMatrix, recordStep, collectText, safeEvaluate, screenshot }) => {\n const ready = await waitWorkbenchReady();\n const workspace = await fetchJson('/v1/workbench/workspace?projectId=prj_hwpod_workbench');\n const apiMatrix = await fetchApiMatrix(['/v1/workbench/workspace?projectId=prj_hwpod_workbench', '/auth/session']);\n const workspaceText = await collectText('#workspace');\n const evaluated = await safeEvaluate(({ a, b }) => ({ sum: a + b }), { a: 1, b: 2 });\n await screenshot('workbench.png');\n recordStep('workbench-summary', { finalUrl: ready.finalUrl, workspaceOk: workspace.ok, apiMatrixOk: apiMatrix.ok });\n return { finalUrl: ready.finalUrl, workspaceOk: workspace.ok, workspaceText, evaluated };\n};\nJS", ], actions: { diff --git a/scripts/src/hwlab-node-web-sentinel-cicd.ts b/scripts/src/hwlab-node-web-sentinel-cicd.ts index 3f7d8f7c..3a90ace8 100644 --- a/scripts/src/hwlab-node-web-sentinel-cicd.ts +++ b/scripts/src/hwlab-node-web-sentinel-cicd.ts @@ -75,6 +75,7 @@ export type WebProbeSentinelOptions = readonly lane: string; readonly view: WebProbeSentinelReportView; readonly runId: string | null; + readonly latest: boolean; readonly traceId: string | null; readonly sampleSeq: number | null; readonly raw: boolean; @@ -1270,7 +1271,7 @@ function runSentinelValidate(state: SentinelCicdState, options: Extract): RenderedCliResult { - const command = `hwlab nodes web-probe sentinel report --view ${options.view}`; + const command = `hwlab nodes web-probe sentinel report ${options.latest ? "--latest " : ""}--view ${options.view}`; const query = new URLSearchParams({ view: options.view }); if (options.runId !== null) query.set("run", options.runId); if (options.traceId !== null) query.set("traceId", options.traceId); diff --git a/scripts/src/hwlab-node/web-probe-observe.ts b/scripts/src/hwlab-node/web-probe-observe.ts index 78687a04..da25fd9b 100644 --- a/scripts/src/hwlab-node/web-probe-observe.ts +++ b/scripts/src/hwlab-node/web-probe-observe.ts @@ -60,7 +60,7 @@ export function parseNodeWebProbeSentinelOptions(args: string[]): NodeWebProbeSe "--run-id", "--trace-id", "--sample-seq", - ]), new Set(["--dry-run", "--confirm", "--wait", "--quick-verify", "--raw"])); + ]), new Set(["--dry-run", "--confirm", "--wait", "--quick-verify", "--raw", "--latest"])); const node = requiredOption(args, "--node"); assertNodeId(node); const lane = requiredOption(args, "--lane"); @@ -105,6 +105,9 @@ export function parseNodeWebProbeSentinelOptions(args: string[]): NodeWebProbeSe sentinel = { kind: "validate", action: "validate", node, lane, dryRun, confirm, wait: args.includes("--wait"), timeoutSeconds, quickVerify: args.includes("--quick-verify") }; } else { const view = parseWebProbeSentinelReportView(optionValue(args, "--view") ?? "summary"); + const latest = args.includes("--latest"); + const runId = optionValue(args, "--run") ?? optionValue(args, "--run-id") ?? null; + if (latest && runId !== null) throw new Error("web-probe sentinel report accepts --latest or --run/--run-id, not both"); const sampleSeqRaw = optionValue(args, "--sample-seq") ?? null; const sampleSeq = sampleSeqRaw === null ? null : Number(sampleSeqRaw); if (sampleSeq !== null && (!Number.isInteger(sampleSeq) || sampleSeq < 1)) throw new Error("web-probe sentinel report --sample-seq must be a positive integer"); @@ -114,7 +117,8 @@ export function parseNodeWebProbeSentinelOptions(args: string[]): NodeWebProbeSe node, lane, view, - runId: optionValue(args, "--run") ?? optionValue(args, "--run-id") ?? null, + runId, + latest, traceId: optionValue(args, "--trace-id") ?? null, sampleSeq, raw: args.includes("--raw"),