fix web-probe observe status null handling
This commit is contained in:
@@ -6882,17 +6882,29 @@ function runNodeWebProbeObserveStatus(options: NodeWebProbeObserveOptions, spec:
|
|||||||
const result = runTransWorkspaceStdinScript(options.node, spec.workspace, script, options.commandTimeoutSeconds);
|
const result = runTransWorkspaceStdinScript(options.node, spec.workspace, script, options.commandTimeoutSeconds);
|
||||||
const status = parseJsonObject(result.stdout);
|
const status = parseJsonObject(result.stdout);
|
||||||
const observerId = webObserveIdFromStatus(status, options);
|
const observerId = webObserveIdFromStatus(status, options);
|
||||||
const index = status?.ok !== false && observerId !== null && options.stateDir !== null
|
const statusReadable = status !== null;
|
||||||
|
const ok = result.exitCode === 0 && statusReadable && status.ok !== false;
|
||||||
|
const degradedReason = result.timedOut
|
||||||
|
? "web-probe-command-timeout"
|
||||||
|
: result.exitCode !== 0
|
||||||
|
? "web-probe-observe-status-failed"
|
||||||
|
: !statusReadable
|
||||||
|
? "web-probe-observe-status-unreadable"
|
||||||
|
: typeof status.degradedReason === "string"
|
||||||
|
? status.degradedReason
|
||||||
|
: null;
|
||||||
|
const index = ok && observerId !== null && options.stateDir !== null
|
||||||
? upsertWebObserveIndexEntry(webObserveIndexEntryFromOptions(options, spec, observerId, status))
|
? upsertWebObserveIndexEntry(webObserveIndexEntryFromOptions(options, spec, observerId, status))
|
||||||
: null;
|
: null;
|
||||||
return {
|
return {
|
||||||
ok: result.exitCode === 0 && status?.ok !== false,
|
ok,
|
||||||
status: result.exitCode === 0 ? "observed" : "blocked",
|
status: ok ? "observed" : "blocked",
|
||||||
command: webObserveCommandLabel("status", options),
|
command: webObserveCommandLabel("status", options),
|
||||||
id: observerId,
|
id: observerId,
|
||||||
node: options.node,
|
node: options.node,
|
||||||
lane: options.lane,
|
lane: options.lane,
|
||||||
workspace: spec.workspace,
|
workspace: spec.workspace,
|
||||||
|
degradedReason,
|
||||||
observer: withWebObserveShortcuts(status, observerId),
|
observer: withWebObserveShortcuts(status, observerId),
|
||||||
index,
|
index,
|
||||||
next: observerId === null ? null : webObserveNextCommands(observerId),
|
next: observerId === null ? null : webObserveNextCommands(observerId),
|
||||||
|
|||||||
Reference in New Issue
Block a user