Repository navigation
fix(cli): make every command's text output match its --json data - #6616
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
c8c4534 to
7ee0646
Compare
|
AI review status for this pull request.
|
PR Analysis Report
|
There was a problem hiding this comment.
Requesting changes — the direction is right and most of it lands, but two regressions introduced by this change need fixing first.
What works: upgrade --list now renders name, title, version, and optional from the JSON result (no more (undefined) rows), docs shows package, and theme targets uses the shared formatter instead of a hand-drawn table.
1. theme targets loses information in text mode. The new field list drops states and deprecatedFor, which --json still returns and the old text showed. Measured on the current data, 52 of 295 targets have supported states and 24 are deprecated with a canonical replacement — neither appears in the new text output, so a reader choosing theme overrides from text can pick a deprecated key or miss legal states with no signal anything was omitted. The new parity test passes this only because it allowlists exactly those two fields. Please include states and deprecatedFor in the rendered fields (inline rendering already skips empty values), update the subtitle field list, and remove those allowlist entries so the guard actually proves parity here.
2. upgrade --list failures are silent in text mode. Silencing the logger for --list also suppresses handled errors: astryx upgrade --list --registry exits 1 and prints nothing in text mode, while --json prints the invalid-argument error. Please render the handled error in text mode (or don't silence the logger on the error path) and cover that failure combination in the parity test.
Finally, the changeset's claim that the guard fails whenever a command's text and JSON differ overstates what the skipped/allowlisted cases enforce — please narrow that wording or the skips to match.
[Automated review]
7ee0646 to
bb34d99
Compare
There was a problem hiding this comment.
Requesting changes — this revision fixes most of the earlier feedback, and one issue remains.
What now works: theme targets includes states and deprecatedFor again (verified against --json: 52 of 295 targets have states and 24 are deprecated with a replacement; both now appear in text, and the parity test no longer allowlists them), upgrade --list renders name, title, version, and optional with no (undefined) rows, docs shows package, and the changeset wording now matches what the guard test actually enforces.
Remaining: upgrade --list failures are still silent in text mode. The new catch-block line re-enables the logger, but the error was already logged — and suppressed — inside the API while the logger was silent for --list, and the logger does not replay suppressed lines. The catch then sets the exit code without printing the error, so astryx upgrade --list --registry still exits 1 and prints nothing about why, while --json prints the ERR_INVALID_ARGUMENT envelope. Please emit the handled error in text mode in the catch (for example, log e.message after re-enabling the logger), and add a parity-test case for this failing combination so the guard covers it.
[Automated review]
bb34d99 to
f8c0e61
Compare
There was a problem hiding this comment.
Requesting changes — this revision fixes the remaining silent failure, and one over-correction from that fix needs scoping.
What now works: upgrade --list --registry in text mode now exits 1 and prints its error once, matching the --json envelope; upgrade --list renders name, title, version, and optional with no (undefined) rows; docs shows package; and theme targets includes states and deprecatedFor again, verified against --json.
Remaining: non-list upgrade failures print the error twice. The catch block now replays e.message unconditionally, but for non-list calls the logger was never silent, so the API already printed the error before throwing. Measured examples: bare upgrade (missing --from), upgrade --from notsemver, and upgrade --registry --from 1.0.0 each show the identical message twice on stderr, while --json shows it once. Please scope the replay to the case where the logger was actually silent (the --list path; --json is handled separately), update the catch comment that still says human mode already saw the error, and add a regression check asserting the stderr message occurs once for both the --list --registry failure and a non-list failure — the parity guard currently reads stdout only and has no upgrade failure case, which is how this escaped it.
PUBLIC DELTA RECEIPT: afada75126e9c96cd1f4b06fa4ce438d13fe26af7f310960d50e644164f30f66
[Automated review]
f8c0e61 to
ad53507
Compare
There was a problem hiding this comment.
Requesting changes — the behaviour is now right, and two small guard issues remain before approval.
What now works: upgrade --list renders name, title, version, and optional with no (undefined) rows; docs shows package; theme targets includes className, states, and deprecatedFor again, verified against --json; upgrade --list --registry in text mode exits 1 and prints its error exactly once, and non-list failures (for example bare upgrade or an invalid --from) also print exactly once — no silent failures and no duplicated errors.
1. No test covers the upgrade failure paths this change fixes. The parity guard's only upgrade case is the --list success path, and it checks stdout and exit status only, although the harness also returns stderr. The two failure regressions that already happened here (silent list failures, then duplicated non-list errors) both passed the existing suites, and they still would. Please add a regression case asserting the handled error occurs exactly once on stderr with exit 1 in text mode for both upgrade --list --registry and a non-list failure, and update the catch comment that still says human mode already saw the error line — that is not true for --list.
2. Running the parity suite leaves a file behind. The theme template case runs with the repository root as its working directory, so a suite run writes an untracked theme.template.ts there, which can be committed by accident. Please give that case a temp working directory, like the other writing cases, or clean the file up afterwards.
PUBLIC DELTA RECEIPT: "107a258a6cef4273a3c33dbbd1759eda82b471447a9aaeade5257d297ba02946"
[Automated review]
29b2f49 to
af58561
Compare
There was a problem hiding this comment.
Approving — the text output now matches --json, and every issue raised on earlier revisions is fixed at this revision.
Verified: upgrade --list renders name, title, version, and optional with no (undefined) rows; docs shows package; theme targets uses the shared formatter and includes className, states, and deprecatedFor; upgrade --list --registry in text mode exits 1 and prints its error exactly once, as do non-list failures such as bare upgrade or an invalid --from; the parity suite passes (98 tests), now including upgrade failure-path cases, and a suite run leaves the working tree clean.
Non-blocking note: the non-list failure case asserts the error is not duplicated rather than asserting it occurs exactly once on stderr (the --list failure case does assert exactly once). Behaviour was measured directly as exactly once, so this does not hold approval, but tightening that assertion would make the guard stronger.
PUBLIC DELTA RECEIPT: f00c6cc834eab7ed099861fc7cad38f11ece38d8d3cfec6649be160cf5e9d61f
[Automated review]
af58561 to
8095ee0
Compare
There was a problem hiding this comment.
Approving — the text output now matches --json, and every issue raised on earlier revisions is fixed at this revision.
Verified: upgrade --list renders name, title, version, and optional with no (undefined) rows; docs shows package; theme targets uses the shared formatter and includes className, states, and deprecatedFor (shown as deprecated; use …); arrow-bearing titles render in plain ASCII; upgrade --list --registry in text mode exits 1 and prints its error exactly once, as do non-list failures such as bare upgrade or an invalid --from; the parity suite passes (98 tests, with the full CLI client suite also passing), now including upgrade failure-path cases, and a suite run leaves the working tree clean.
Non-blocking note: the non-list failure case asserts the error is not duplicated rather than asserting it occurs exactly once on stderr (the --list failure case does assert exactly once). Behaviour was measured directly as exactly once, so this does not hold approval, but tightening that assertion would make the guard stronger.
PUBLIC DELTA RECEIPT: 8fa34074578ca6bffa4d8a56b019b39c5602487f52f6396fd5fffabb3524fb19
[Automated review]
8095ee0 to
cc37ca7
Compare
Fixes: - build-theme targets: replace character-drawn formatTargetsTable with records() inline layout (INV23); show className field - docs list: add package field to text projection - upgrade --list: render from JSON result via records() instead of API logger (was printing undefined, showing PR numbers, missing version) Deferred (open PRs would conflict): - template: id, isReady fields (#6265) - component: themeData, findRelatedBlocks, --blocks fields (#6507) - component --props: type union in formatProps code block Guard test (text-json-parity.test.mjs): - manifest-driven: fails on a new JSON-capable command with no case - checks text->JSON (record keys, text blocks, list items) - checks JSON->text (leaf fields by label or per-key value presence) - per-command allowlist with stale-entry check
cc37ca7 to
eb26a5f
Compare
User impact
Every caller of the CLI sees the same facts in text as in
--json. Three commands had divergences that reached stdout:(undefined)on 24 of 65 rows and showed PR numbers the JSON does not carry, while theversionfield that decides whether a codemod applies never appeared.classNamefield.packagefield.Problem and solution fit
Each command wrote its own text renderer, and nothing checked that the text was a projection of the JSON. INV4 says human output is produced only by the formatters; INV5 says text field names mirror JSON keys. This PR fixes the divergences it can reach without conflicting with open PRs, and adds a manifest-driven guard test that fails when any new command ships without a parity case.
Expected behavior and authority
docs/architecture/cli-surface.mdINV4, INV5, INV12docs/specs/AST-042-cli-command-admission/spec.mdFR1, FR3Smallest restoration
(undefined)rowsDeferred (open PRs would conflict)
idto the list fields and edits the same lines; the WIP marker folded into name remains a divergenceDivergences the sweep fixed
Evidence
Mutation proofs
record({hardcodedFact})— test fails withText record keys not in JSON: hardcodedFactText record keys not in JSON: dirNametext("A fact the JSON does not have.")— test fails with[text] A fact the JSON does not have.JSON fields not in text: packageScope
Testing
Rebased onto current main. The stale doc-route inventory failure on the prior head is gone; focused checks pass (129/129), and the full CLI suite passes (5,232 passed, 2 expected failures). Strict typecheck and repository checks pass; required CI and exact-head review passed at this head. Nonrequired visual checks may still be running. The docs-list projection overlaps draft #6626 and the lint allowlist in #6617 must drop its fixed
build-themeentry once both changes are together.