fix: improve sentinel observer evidence
This commit is contained in:
@@ -13,6 +13,7 @@ export function nodeWebObserveAnalyzerFindingsSource(): string {
|
||||
summary: "observer control commands failed; analyze must surface the first failed command with phase/status/stdout/stderr evidence.",
|
||||
count: commandFailures.length,
|
||||
firstCommandFailure,
|
||||
evidenceSummary: firstCommandFailure ? "command=" + (firstCommandFailure.commandId || "-") + " type=" + (firstCommandFailure.type || "-") + " phase=" + (firstCommandFailure.phase || "-") + " status=" + (firstCommandFailure.status || "-") + " resultOk=" + (firstCommandFailure.resultOk ?? "-") + " failedReason=" + (firstCommandFailure.failedReason || firstCommandFailure.failureKind || firstCommandFailure.message || "-") : "commandFailures>0",
|
||||
commands: compactCommandFailures.slice(0, 20)
|
||||
});
|
||||
findings.push(...buildFrontendFreezeFindings(errors, control));
|
||||
@@ -429,18 +430,36 @@ export function nodeWebObserveAnalyzerFindingsSource(): string {
|
||||
function compactObserverCommandFailure(item) {
|
||||
const result = item && typeof item.result === "object" ? item.result : {};
|
||||
const output = item && typeof item.output === "object" ? item.output : {};
|
||||
const error = item && typeof item.error === "object" ? item.error : result && typeof result.error === "object" ? result.error : {};
|
||||
const stdout = item?.stdoutPreview ?? item?.stdoutTail ?? result.stdoutPreview ?? result.stdoutTail ?? output.stdoutPreview ?? output.stdoutTail ?? null;
|
||||
const stderr = item?.stderrPreview ?? item?.stderrTail ?? result.stderrPreview ?? result.stderrTail ?? output.stderrPreview ?? output.stderrTail ?? null;
|
||||
const commandId = item?.commandId ?? item?.id ?? item?.command_id ?? null;
|
||||
const phase = item?.phase ?? item?.statusPhase ?? (item?.failedAt ? "failed" : item?.abandonedAt ? "abandoned" : item?.completedAt ? "completed" : null);
|
||||
const resultOk = item?.resultOk ?? item?.ok ?? result.ok ?? null;
|
||||
const status = item?.status ?? item?.resultStatus ?? result.status ?? (phase === "failed" || resultOk === false ? "failed" : phase === "abandoned" ? "abandoned" : phase === "completed" ? "completed" : null);
|
||||
const failureKind = item?.failureKind ?? result.failureKind ?? error.failureKind ?? null;
|
||||
const message = item?.message ?? result.message ?? error.message ?? item?.reason ?? result.reason ?? null;
|
||||
const failedReason = item?.failedReason ?? item?.reason ?? result.failedReason ?? result.reason ?? failureKind ?? message ?? null;
|
||||
const artifactBucket = item?.artifactBucket ?? (phase === "failed" ? "failed" : phase === "abandoned" ? "abandoned" : phase === "completed" ? "done" : null);
|
||||
const artifactRef = item?.artifactRef ?? item?.artifactPath ?? item?.path ?? (commandId && artifactBucket ? "commands/" + artifactBucket + "/" + commandId + ".json" : null);
|
||||
return {
|
||||
commandId: item?.commandId ?? item?.id ?? item?.command_id ?? null,
|
||||
commandId,
|
||||
type: item?.type ?? item?.commandType ?? item?.command_type ?? null,
|
||||
phase: item?.phase ?? item?.statusPhase ?? null,
|
||||
status: item?.status ?? item?.resultStatus ?? null,
|
||||
phase,
|
||||
status,
|
||||
resultOk: resultOk === true ? true : resultOk === false ? false : null,
|
||||
failureKind: failureKind == null ? null : String(failureKind).slice(0, 160),
|
||||
failedReason: failedReason == null ? null : String(failedReason).slice(0, 240),
|
||||
message: message == null ? null : String(message).slice(0, 240),
|
||||
exitCode: item?.exitCode ?? result.exitCode ?? null,
|
||||
timedOut: item?.timedOut === true || result.timedOut === true,
|
||||
stdoutPreview: stdout == null ? null : String(stdout).slice(0, 240),
|
||||
stderrPreview: stderr == null ? null : String(stderr).slice(0, 240),
|
||||
artifactRef: item?.artifactRef ?? item?.artifactPath ?? item?.path ?? null,
|
||||
artifactBucket,
|
||||
artifactRef,
|
||||
failedAt: item?.failedAt ?? null,
|
||||
completedAt: item?.completedAt ?? null,
|
||||
abandonedAt: item?.abandonedAt ?? null,
|
||||
valuesRedacted: true
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user