Skip to content

fix(cli): make doctor text output use its JSON field names - #6516

Merged
josephfarina merged 1 commit into
mainfrom
cli-spec/doctor-gap/doctor-text-keys
Sep 24, 2026
Merged

josephfarina merged 1 commit into
mainfrom
cli-spec/doctor-gap/doctor-text-keys

Conversation

@josephfarina

Copy link
Copy Markdown
Contributor

User impact

astryx doctor text output is the documented projection of astryx doctor --json, and agents and CI scripts grep it. Three fields did not match their JSON keys:

  • each check printed its label as check:;
  • the check's stable id was not printed at all;
  • the summary counts were a prose sentence (Summary: 8 passed, 0 warnings, 0 failures, 4 info), so pass, warn, fail, and info could not be matched.

A caller that matched ^id:, ^label:, or ^fail: found nothing. After this change each check prints id, status, label, message, and fix, and the summary prints pass, warn, fail, and info under a summary heading.

Problem and solution fit

  • Why does it occur? printHuman in clients/cli/commands/doctor.mjs renamed label with the formatter's labels option, left id out of the field list, and wrote the summary as a prose line.
  • Why does it harm the task? The two views drift. The stable id, which is the one value a caller can match across releases, was visible only in JSON, so a text reader had to match the human label, which can change.
  • Why does that matter? The caller is usually an agent. Text output is a supported view and must stay greppable by the same keys as the JSON.

The fix lists the JSON keys as the text fields, removes the rename, and renders the summary with the shared record() formatter.

Expected behavior and authority

docs/architecture/cli-surface.md (authority: current):

INV5 — Text field names mirror JSON keys one to one. The two views cannot drift, and every field stays greppable.

docs/specs/AST-017/spec.md (authority: current), FR13, decided by DEC-4:

Every field is present in the canonical response type, contract tests, text projection where the command provides one, and complete consumer-facing schema documentation.

Compatibility under AST-017: the --json envelope, the exit codes, and the status tokens do not change. The text view is restored to the documented contract (FR5), so this is a nonbreaking patch.

Smallest restoration

Only printHuman changes. The [ok] / [warn] / [fail] / [info] status tokens and the closing sentence stay as they are. The doctor integration leaves are not touched. The example output in the CLI README's Doctor section is updated to match.

Evidence

  • Reproduction before the change: astryx doctor in a project prints status: [ok], check: Node.js version, message: ... with no id: line, then Summary: 8 passed, 0 warnings, 0 failures, 4 info.
  • Result after the change: id: node-version, status: [ok], label: Node.js version, message: ..., then a summary heading with pass: 8, warn: 0, fail: 0, info: 4.
  • Representative unchanged path: astryx doctor --json emits the same envelope; the exit code is still 0 with no failures and 1 when a check fails.
  • Regression test or other mutation-sensitive proof: doctor — text output mirrors the JSON in clients/cli/commands/doctor.test.mjs runs the command with and without --json, requires each text record's keys to equal that check's JSON keys, and requires the summary record to equal data.summary. It fails on main. Each of these mutations also makes it fail: restoring the old printer, re-adding only the label to check rename, or dropping only the summary record.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

pnpm exec vitest run packages/cli/clients/cli/commands/doctor.test.mjs packages/cli/api/doctor
pnpm -F @astryxdesign/cli exec tsc --project tsconfig.api-dts.json
pnpm check:cli-structure
pnpm -F @astryxdesign/cli readme:check
pnpm -F @astryxdesign/cli typecheck:json-api
ASTRYX_STRICT_LINT=1 pnpm exec eslint packages/cli/clients/cli/commands/doctor.mjs packages/cli/clients/cli/commands/doctor.test.mjs
pnpm check:repo
pnpm exec vitest run packages/cli

The doctor text view printed `label` as `check`, left out the stable `id`,
and wrote the summary counts as a prose line, so a caller could not grep it
by the keys it sees in --json. Each check and the summary now print under
their JSON keys.
@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 24, 2026 7:12am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 24, 2026
@astracat-bot

astracat-bot Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Sep 24, 2026, 7:12 AM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused fix — this restores the documented contract for astryx doctor text output.

  • Each check now prints id, status, label, message, and fix under the same names as --json (previously label appeared as check: and the stable id was missing), and the summary prints pass, warn, fail, and info under a summary heading instead of a prose line, so agents and CI scripts can grep text output by the JSON keys.
  • The JSON envelope, exit codes, status tokens, and check logic are unchanged, and the patch changeset correctly treats this as a nonbreaking restoration.
  • The new regression test ties each text record's keys to its JSON keys and the summary record to data.summary, and the README Doctor example is updated to match.

One note for readers: callers that matched the old check: label or the prose Summary: sentence should switch to the documented JSON keys. No changes are requested.

[Automated review]

github-actions Bot added a commit that referenced this pull request Sep 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox were not published for this CI run.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

19 of 420 shot(s) changed. View the report

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Slider Default probe light 15,617
Slider Default probe dark 15,615
Chat With Attachments probe light 12,964
Chat With Attachments probe dark 12,114
InputGroup With Typeahead probe light 11,012
InputGroup With Typeahead probe dark 9,189
ComplexSelector Tree list with search probe light 6,245
TextArea Vertical Form Alignment probe light 5,634
ComplexSelector Tree list with search probe dark 5,602
TextArea Vertical Form Alignment probe dark 5,047
ComplexSelector Fruit ripeness selector neutral light 4,007
ComplexSelector Fruit ripeness selector neutral dark 3,825
ToggleButton Group Single probe dark 1,538
ToggleButton Group Single probe light 1,538
MediaTheme On Dark neutral dark 838
Banner Collapsible Content (Expanded) probe dark 92
Banner Collapsible Content (Expanded) probe light 90
AlertDialog Delete neutral light 71
TableRowStatus Default neutral light 23
Slider — Default — probe light
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
Slider — Default — probe dark
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
Chat — With Attachments — probe light
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame

Generated by PR Enrichment workflow | View full report

@josephfarina
josephfarina marked this pull request as ready for review September 24, 2026 21:05
@josephfarina
josephfarina merged commit a2d80a2 into main Sep 24, 2026
38 checks passed
@github-actions
github-actions Bot deleted the cli-spec/doctor-gap/doctor-text-keys branch September 25, 2026 06:23

This branch was successfully deployed

1 active deployment
Preview — 1e761a20 Deployed Sep 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant