fix(web-probe): add mdtodo visual sentinel coverage
This commit is contained in:
@@ -2217,6 +2217,8 @@ function runSentinelQuickVerify(state: SentinelCicdState, reason: string, timeou
|
||||
"--screenshot-interval-ms", String(numberAt(scenario, "screenshotIntervalMs")),
|
||||
"--command-timeout-seconds", "55",
|
||||
];
|
||||
const viewport = stringAtNullable(scenario, "viewport");
|
||||
if (viewport !== null) startArgs.push("--viewport", viewport);
|
||||
const started = runChildCli(startArgs, remainingSeconds(deadline, 55), undefined, accountEnv.env);
|
||||
steps.push({ phase: "observe-start", ok: started.ok, result: started.result });
|
||||
const observerId = observerIdFromText(String(record(started.result).stdoutPreview ?? ""));
|
||||
@@ -2291,6 +2293,7 @@ function runSentinelQuickVerify(state: SentinelCicdState, reason: string, timeou
|
||||
args.push("--text", prompts.prompts[promptIndex % prompts.prompts.length] ?? "");
|
||||
promptIndex += 1;
|
||||
}
|
||||
appendScenarioObserveCommandArgs(args, item, { skipText: type === "sendPrompt" });
|
||||
const commandResult = runChildCli(args, remainingSeconds(deadline, 60));
|
||||
steps.push({ phase: `observe-command-${type}`, ok: commandResult.ok, promptIndex: type === "sendPrompt" ? promptIndex : null, result: commandResult.result });
|
||||
if (!commandResult.ok) {
|
||||
@@ -2452,6 +2455,42 @@ function runQuickVerifySessionInvarianceChecks(
|
||||
return { ok: true, promptIndex, checkCount: checks.length, warnings, valuesRedacted: true };
|
||||
}
|
||||
|
||||
function appendScenarioObserveCommandArgs(args: string[], item: Record<string, unknown>, options: { readonly skipText?: boolean } = {}): void {
|
||||
const mappings: readonly (readonly [string, string])[] = [
|
||||
["path", "--path"],
|
||||
["label", "--label"],
|
||||
["sessionId", "--session-id"],
|
||||
["provider", "--provider"],
|
||||
["accountId", "--account-id"],
|
||||
["fromAccountId", "--from-account-id"],
|
||||
["toAccountId", "--to-account-id"],
|
||||
["sourceId", "--source-id"],
|
||||
["fileRef", "--file-ref"],
|
||||
["filename", "--filename"],
|
||||
["taskRef", "--task-ref"],
|
||||
["taskId", "--task-id"],
|
||||
["task", "--task"],
|
||||
["field", "--field"],
|
||||
["link", "--link"],
|
||||
["title", "--title"],
|
||||
["body", "--body"],
|
||||
["status", "--status"],
|
||||
["hwpodId", "--hwpod-id"],
|
||||
["nodeId", "--node-id"],
|
||||
["workspaceRoot", "--workspace-root"],
|
||||
["root", "--root"],
|
||||
];
|
||||
for (const [key, flag] of mappings) {
|
||||
if (args.includes(flag)) continue;
|
||||
const value = stringAtNullable(item, key);
|
||||
if (value !== null) args.push(flag, value);
|
||||
}
|
||||
if (options.skipText !== true && !args.includes("--text")) {
|
||||
const text = stringAtNullable(item, "text") ?? stringAtNullable(item, "value");
|
||||
if (text !== null) args.push("--text", text);
|
||||
}
|
||||
}
|
||||
|
||||
function finalizeQuickVerifyFailure(state: SentinelCicdState, input: {
|
||||
readonly runId: string;
|
||||
readonly scenarioId: string;
|
||||
|
||||
@@ -419,17 +419,20 @@ function checkSqlite(db: Database): Record<string, unknown> {
|
||||
|
||||
function buildObserveCommandPlan(config: WebProbeSentinelServiceConfig, scenario: Record<string, unknown>): readonly CommandPlanStep[] {
|
||||
const targetPath = stringAt(scenario, "observeTargetPath");
|
||||
const startArgv = [
|
||||
"bun", "scripts/cli.ts", "web-probe", "observe", "start",
|
||||
"--node", config.node,
|
||||
"--lane", config.lane,
|
||||
"--target-path", targetPath,
|
||||
"--sample-interval-ms", String(numberAt(scenario, "sampleIntervalMs")),
|
||||
"--screenshot-interval-ms", String(numberAt(scenario, "screenshotIntervalMs")),
|
||||
"--command-timeout-seconds", "55",
|
||||
];
|
||||
const viewport = stringOrNull(scenario.viewport);
|
||||
if (viewport !== null) startArgv.push("--viewport", viewport);
|
||||
const start: CommandPlanStep = {
|
||||
phase: "observe-start",
|
||||
argv: [
|
||||
"bun", "scripts/cli.ts", "web-probe", "observe", "start",
|
||||
"--node", config.node,
|
||||
"--lane", config.lane,
|
||||
"--target-path", targetPath,
|
||||
"--sample-interval-ms", String(numberAt(scenario, "sampleIntervalMs")),
|
||||
"--screenshot-interval-ms", String(numberAt(scenario, "screenshotIntervalMs")),
|
||||
"--command-timeout-seconds", "55",
|
||||
],
|
||||
argv: startArgv,
|
||||
stdinSource: "none",
|
||||
};
|
||||
const commands = arrayAt(scenario, "commandSequence").map((item) => {
|
||||
@@ -447,6 +450,7 @@ function buildObserveCommandPlan(config: WebProbeSentinelServiceConfig, scenario
|
||||
if (fromAccountId !== null) argv.push("--from-account-id", fromAccountId);
|
||||
if (toAccountId !== null) argv.push("--to-account-id", toAccountId);
|
||||
}
|
||||
appendObserveCommandArgs(argv, item, { skipText: type === "sendPrompt" });
|
||||
return { phase: `observe-command-${type}`, argv, stdinSource: type === "sendPrompt" ? "prompt-source" : "none" } satisfies CommandPlanStep;
|
||||
});
|
||||
const analyze: CommandPlanStep = {
|
||||
@@ -457,6 +461,42 @@ function buildObserveCommandPlan(config: WebProbeSentinelServiceConfig, scenario
|
||||
return [start, ...commands, analyze];
|
||||
}
|
||||
|
||||
function appendObserveCommandArgs(argv: string[], item: Record<string, unknown>, options: { readonly skipText?: boolean } = {}): void {
|
||||
const mappings: readonly (readonly [string, string])[] = [
|
||||
["path", "--path"],
|
||||
["label", "--label"],
|
||||
["sessionId", "--session-id"],
|
||||
["provider", "--provider"],
|
||||
["accountId", "--account-id"],
|
||||
["fromAccountId", "--from-account-id"],
|
||||
["toAccountId", "--to-account-id"],
|
||||
["sourceId", "--source-id"],
|
||||
["fileRef", "--file-ref"],
|
||||
["filename", "--filename"],
|
||||
["taskRef", "--task-ref"],
|
||||
["taskId", "--task-id"],
|
||||
["task", "--task"],
|
||||
["field", "--field"],
|
||||
["link", "--link"],
|
||||
["title", "--title"],
|
||||
["body", "--body"],
|
||||
["status", "--status"],
|
||||
["hwpodId", "--hwpod-id"],
|
||||
["nodeId", "--node-id"],
|
||||
["workspaceRoot", "--workspace-root"],
|
||||
["root", "--root"],
|
||||
];
|
||||
for (const [key, flag] of mappings) {
|
||||
if (argv.includes(flag)) continue;
|
||||
const value = stringOrNull(item[key]);
|
||||
if (value !== null) argv.push(flag, value);
|
||||
}
|
||||
if (options.skipText !== true) {
|
||||
const text = stringOrNull(item.text) ?? stringOrNull(item.value);
|
||||
if (text !== null) argv.push("--text", text);
|
||||
}
|
||||
}
|
||||
|
||||
function schedulerSummary(config: WebProbeSentinelServiceConfig, db: Database): Record<string, unknown> {
|
||||
return {
|
||||
enabledScenarios: config.scenarios.filter((item) => boolAt(item, "enabled")).map((item) => stringAt(item, "id")),
|
||||
|
||||
Reference in New Issue
Block a user