diff --git a/docs/reverse-engineering-tools.md b/docs/reverse-engineering-tools.md index 2ce266e76c7..3917019e1ea 100644 --- a/docs/reverse-engineering-tools.md +++ b/docs/reverse-engineering-tools.md @@ -113,7 +113,9 @@ has `provider_identity: "banner"`. The probe's exit status and output, each stream cut to 2,048 UTF-8 bytes in the same way, are recorded in `provider_version_probe`, where `stdout_invalid_utf8` and `stderr_invalid_utf8` mark output that was not -valid UTF-8 and so holds replacement characters. +valid UTF-8 and so holds replacement characters, and `completion_status` is +`unknown`, as for the command, when the probe's output was not fully collected +or the probe was killed, signalled or left no exit code. Each call's lookup, hash and probe use that call's `command_timeout_ms` budget and cancellation; a lookup or hash that reaches the deadline ends the call without running the command. A hash that fails for another reason, for example diff --git a/src/application/reverse/ReverseEngineeringService.ts b/src/application/reverse/ReverseEngineeringService.ts index 1e95a7a8067..9af645be146 100644 --- a/src/application/reverse/ReverseEngineeringService.ts +++ b/src/application/reverse/ReverseEngineeringService.ts @@ -1203,6 +1203,7 @@ const versionProbeDiagnostics = ( readonly stdout: string; readonly stderr: string; readonly signal?: string | null; + readonly killed?: boolean; readonly outputTruncated?: boolean; readonly collectionFailure?: boolean; readonly stdoutInvalidUtf8?: boolean; @@ -1230,6 +1231,15 @@ const versionProbeDiagnostics = ( stderr: stderr.text, output_truncated: output?.outputTruncated === true || stdout.truncated || stderr.truncated, + // As for the command: output that was not fully collected, or a probe that + // was killed, signalled or left no exit code, did not observably complete. + completion_status: + output?.collectionFailure !== true && + output?.killed !== true && + (output?.signal ?? null) === null && + typeof code === "number" + ? "complete" + : "unknown", // Invalid UTF-8 is decoded as replacement characters; these mark it. stdout_invalid_utf8: output?.stdoutInvalidUtf8 === true, stderr_invalid_utf8: output?.stderrInvalidUtf8 === true, diff --git a/tests/boundary/filesystem/reverseEngineeringToolIdentity.test.ts b/tests/boundary/filesystem/reverseEngineeringToolIdentity.test.ts index 89318fc893e..d032f27f9ab 100644 --- a/tests/boundary/filesystem/reverseEngineeringToolIdentity.test.ts +++ b/tests/boundary/filesystem/reverseEngineeringToolIdentity.test.ts @@ -281,6 +281,7 @@ posix( stdout: "usage: tool [options]\n", stderr: "unknown option -v\n", output_truncated: false, + completion_status: "complete", }, }); expect(result.value.parameters).not.toHaveProperty( @@ -907,6 +908,7 @@ posix( expect(first.value.provider.version).toBeNull(); expect(first.value.parameters.provider_version_probe).toMatchObject({ exit_code: null, + completion_status: "unknown", }); }, ); @@ -955,6 +957,7 @@ posix.each([ expect(result.value.parameters.provider_version_probe).toMatchObject({ exit_code: outcome === "failed" ? 2 : null, error_code: outcome === "timed-out" ? "ETIMEDOUT" : null, + completion_status: outcome === "failed" ? "complete" : "unknown", stdout_invalid_utf8: invalid.stdout, stderr_invalid_utf8: invalid.stderr, });