Repository navigation
[walk test] runtime-node: doctor --quiet and --version #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
97417e3
runtime-node: doctor --quiet and autter-runtime --version
0213064
Re-run Autter product walk (after walk fixes #426-#428)
sagnik11 39122a5
Re-run Autter's product walk on the fixed runner (test PR)
5c6a059
Re-run Autter product walk (after fixes #429)
sagnik11 0353562
Re-run Autter product walk (after fixes #430)
sagnik11 85e0b9a
Re-run Autter product walk (after fixes #431)
sagnik11 a44c637
Re-run Autter product walk (after fixes #434 #433)
sagnik11 6200ac3
Re-run Autter product walk (after fixes #437)
sagnik11 a3a2d46
Re-run Autter product walk (after fixes #439)
sagnik11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import assert from "node:assert/strict"; | ||
| import { test } from "node:test"; | ||
| import { formatDoctorReport, parseDoctorArgs } from "../dist/index.js"; | ||
|
|
||
| const compatible = { | ||
| endpoint: "https://otlp.example.test", | ||
| sdks: [{ name: "@autter/runtime-node", version: "1.5.0" }], | ||
| ingester: { version: "1.5.0", schema: null }, | ||
| features: [{ id: "logs", title: "Logs", status: "ok" }], | ||
| issues: [], | ||
| exitCode: 0, | ||
| }; | ||
|
|
||
| test("--quiet and -q are parsed, and cannot be combined with --json", () => { | ||
| assert.deepEqual(parseDoctorArgs(["--quiet"], {}), { quiet: true }); | ||
| assert.deepEqual(parseDoctorArgs(["-q", "--endpoint", "http://x"], {}), { quiet: true, endpoint: "http://x" }); | ||
| assert.deepEqual(parseDoctorArgs(["--json", "--quiet"], {}), { error: "--json and --quiet cannot be combined" }); | ||
| }); | ||
|
|
||
| test("a quiet report is empty when everything is compatible", () => { | ||
| assert.equal(formatDoctorReport(compatible, { quiet: true }), ""); | ||
| assert.match(formatDoctorReport(compatible), /Compatible\./); | ||
| }); | ||
|
|
||
| test("a quiet report lists only the problems", () => { | ||
| const broken = { | ||
| ...compatible, | ||
| key: "rejected", | ||
| features: [{ id: "traces", title: "Traces", status: "incompatible" }], | ||
| issues: [{ message: "ingester 1.3.0 is older than the SDK expects" }], | ||
| exitCode: 1, | ||
| }; | ||
| assert.equal( | ||
| formatDoctorReport(broken, { quiet: true }), | ||
| [ | ||
| "autter doctor: ingest key rejected (401)", | ||
| "autter doctor: feature traces is incompatible", | ||
| "autter doctor: ingester 1.3.0 is older than the SDK expects", | ||
| ].join("\n"), | ||
| ); | ||
| const unreachable = { ...compatible, ingester: null, ingesterError: "ECONNREFUSED", features: [], exitCode: 2 }; | ||
| assert.equal( | ||
| formatDoctorReport(unreachable, { quiet: true }), | ||
| "autter doctor: ingester unreachable at https://otlp.example.test (ECONNREFUSED)", | ||
| ); | ||
| }); | ||
|
|
||
| test("the CLI prints its version and exits 0", async () => { | ||
| const { spawnSync } = await import("node:child_process"); | ||
| const { fileURLToPath } = await import("node:url"); | ||
| const { readFileSync } = await import("node:fs"); | ||
| const cli = fileURLToPath(new URL("../dist/cli.js", import.meta.url)); | ||
| const { version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")); | ||
| for (const flag of ["--version", "-v", "version"]) { | ||
| const run = spawnSync(process.execPath, [cli, flag], { encoding: "utf8" }); | ||
| assert.equal(run.status, 0, flag); | ||
| assert.equal(run.stdout.trim(), `@autter/runtime-node ${version}`); | ||
| } | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 [verified] Simulation failed: Quiet doctor reports mismatch, key, and unreachable-ingester failures — Risk: 75/100
Ran: node '.autter/scratch/doctor-quiet-harness.mjs'
The 503 key-check case exits nonzero and reports the storage-unavailable problem rather than only a generic incompatible status.: expected The 503 invocation exits nonzero and stderr identifies storage unavailable without relying only on a generic incompatible message.; observed {"exitCode":1,"stdout":"","stderr":"autter doctor: incompatible (exit 1)"}
Confirmed changed-code cause: runDoctor classifies a POST /v1/traces 503 as key="storage_unavailable" and exitCode=1, but formatQuietDoctorReport only renders rejected/client_key keys, feature mismatches, and issues. With a compatible /v1/compat response and no other problems, its lines remain empty and it falls through to "autter doctor: incompatible (exit 1)". The CLI correctly sends this nonzero report to stderr, so the missing diagnostic is specifically in quiet report formatting.
🛠 AI fix prompt (copy & paste into your coding agent)
Flagged by Autter security & observability checks.