Repository navigation
fix(cli): say when a command did nothing (upgrade sourcePathFound, doctor validated) - #6618
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression17 of 420 shot(s) changed. A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
upgrade --apply reported a complete upgrade when it migrated nothing: --path
defaults to ./src, so a project laid out as app/ skipped every code codemod and
still got exit 0, filesChanged 0, errors [] and "Upgrade complete". The only
warning was a log line --json suppresses by design. upgrade.run now carries
sourcePathFound.
doctor integration validate|components|docs|templates returned {name: null,
version: null, issues: []} and exit 0 when no manifest was found — the same
envelope a validated, healthy integration produces. All four now carry
validated.
4430899 to
a51079f
Compare
# Conflicts: # packages/cli/README.md # packages/cli/api/upgrade/run/run.mjs # packages/cli/api/upgrade/upgrade.doc.mjs # packages/cli/foundation/response/response-types.doc.mjs
Main added an early upgrade.run receipt for protected codemod changes while the config loads. The receipt type now requires sourcePathFound, so that path reports it too.
There was a problem hiding this comment.
Thanks — this closes a real silent-success hole. Two commands could do nothing and return envelopes indistinguishable from a clean pass; both now say so in a field a machine consumer can branch on: sourcePathFound on upgrade.run, and validated on the four integration doctor envelopes (false only when no manifest was found, so an empty issue list can no longer mean both "healthy" and "never looked").
I verified the supporting pieces ship together: the canonical response types, the per-command docs and generated README tables (the README sync check passes), and tests covering both directions — missing versus present source directory (including following --path), no-manifest versus a real integration, and a missing installed package still reporting as a real finding. The targeted CLI suites pass locally (78 + 144 tests), as do the CLI structure and Changeset checks. Exit codes and existing field meanings are unchanged, so current consumers are unaffected.
One small non-blocking note: the new human-readable lines ("Nothing was validated…", the completion line naming the missing directory) are exercised for ASCII-only output but their exact wording is not content-asserted, so a wording regression there would not fail CI — the contractual JSON fields are covered.
[Automated review]
# Conflicts: # packages/cli/README.md
There was a problem hiding this comment.
Thanks — this closes a real silent-success hole. Two commands could do nothing and return envelopes indistinguishable from a clean pass; both now say so in a field a machine consumer can branch on: sourcePathFound on upgrade.run, and validated on the four integration doctor envelopes (false only when no manifest was found, so an empty issue list can no longer mean both "healthy" and "never looked").
I verified the supporting pieces ship together: the canonical response types, the per-command docs and generated README tables (the README sync check passes), and tests covering both directions — missing versus present source directory (including following --path), no-manifest versus a real integration, and a missing installed package still reporting as a real finding. The targeted CLI suites pass locally, as do the CLI structure and Changeset checks. Exit codes and existing field meanings are unchanged, so current consumers are unaffected.
One small non-blocking note: the new human-readable lines ("Nothing was validated…", the completion line naming the missing directory) are exercised for ASCII-only output but their exact wording is not content-asserted, so a wording regression there would not fail CI — the contractual JSON fields are covered.
[Automated review]
# Conflicts: # packages/cli/README.md # packages/cli/api/upgrade/upgrade.doc.mjs
There was a problem hiding this comment.
Thanks — this closes a real silent-success hole. Two commands could do nothing and return envelopes indistinguishable from a clean pass; both now say so in a field a machine consumer can branch on: sourcePathFound on upgrade.run, and validated on the four integration doctor envelopes (false only when no manifest was found, so an empty issue list can no longer mean both "healthy" and "never looked").
I verified the supporting pieces ship together: the canonical response types, the per-command docs and generated README tables (the README sync check passes), and tests covering both directions — missing versus present source directory (including following --path), no-manifest versus a real integration, and a missing installed package still reporting as a real finding. The targeted CLI suites pass locally, as do the CLI structure and Changeset checks. Exit codes and existing field meanings are unchanged, so current consumers are unaffected.
One small non-blocking note: the new human-readable lines ("Nothing was validated…", the completion line naming the missing directory) are exercised for ASCII-only output but their exact wording is not content-asserted, so a wording regression there would not fail CI — the contractual JSON fields are covered.
[Automated review]
Mechanical refresh. #6621 (merged as 31feb21) moved template copy's source read before the write and wrapped the mkdir and write in ERR_WRITE_FAILED; this PR changed that read to replaceDemoMedia(). The resolution keeps both: the replaceDemoMedia() read before the guarded mkdir+write. #6618 (merged as 6e56409) changed the generated README tables, so they are regenerated.
User impact
Two commands could legitimately do nothing and hand back an envelope identical
to a clean success, so a machine consumer had no way to tell the two apart.
./srcrunsastryx upgrade --apply, gets exit0,
filesChanged: 0,errors: []and "Upgrade complete", and shipsunmigrated code.
--pathdefaults to./src; a project laid out asapp/(or a typo) skips every code codemod.
astryx doctor integration validate --jsonfrom the wrong directory,gets
{"name": null, "version": null, "issues": []}and exit 0, and is greenforever. Same shape on
doctor integration components|docs|templates.Problem and solution fit
Why does it happen? Both checks pass on "I found no problems" rather than
"I looked and there were none" — the absent case and the clean case are
represented identically, so success is what doing nothing produces.
Why does that harm the task? The whole point of both commands is to tell you
whether your project is in good shape. An answer that cannot distinguish
"healthy" from "never looked" answers nothing.
Why does that matter? Both are the commands people wire into CI and upgrade
runbooks, which is exactly where nobody reads the human text.
Both already knew the fact.
runCodemodsreturns{ok: false, reason: 'source_path_missing'}and the runner logsSource path not found: …, which--jsonsuppresses by design; the responsetype had no field for it.
validateIntegrationcomputesfoundand thencollapses it into
name: null.Expected behavior and authority
A command that can legitimately do nothing says so in a field of its own
envelope — not a zero count, not an empty array, not a warning that exists only
in human text. New response fields are public schema under AST-017 DEC-4:
canonical type, contract test, text projection, and consumer docs ship together,
and per AST-042 the text comes from the command's own output layer.
Smallest restoration
Two boolean fields. No behavior changes, no exit-code changes, nothing new is
computed — both facts were already on hand and thrown away.
upgrade.rungainssourcePathFound, from a singleexistsSyncon thealready-resolved, already-confined
--path.integration.validate,integration.component-conflicts,integration.doc-conflictsandintegration.template-conflictsgainvalidated, straight from thefoundthe validators already return.Text projections:
upgrade's completion line now names the directory it did notfind and how to point it at the right one; the doctor leaves' existing
no-manifest hint now leads with "Nothing was validated" / "Nothing was checked"
and keys off
validatedinstead of inferring it from a null name.Exit codes are deliberately untouched — the diagnosis calls for a field, and
turning a missing
--pathinto a failure is a separate, breaking decision.Evidence
Reproduction before the change, in a project laid out as
app/:Result after the change:
Representative unchanged path: the same project with a real
src/reportssourcePathFound: true; a real integration package reportsvalidated: trueand the same issue list it reported before.
Regression test or other mutation-sensitive proof: 6 tests across
api/upgrade/run/run.test.mjsandapi/integration/validate-integration.test.mjs.Verified in both directions — with the two API files reverted to their
maincontents and only the tests applied, all 6 fail (
expected undefined to be false);with the fix, all 6 pass. Full
packages/clinode suite: 308 files, 4695 tests,all passing.
check:repo,eslint, and all four CLI typechecks green in anunbuilt tree.
One extra test, for a gate that was green by luck
upgrade.ascii-output.test.mjsrequires plain ASCII on every human path, and itpassed on the first draft of this change even though the new completion line
contained an em dash — every fixture in that suite has a real
src/, so theline was never reached. That is the same shape as the defect this PR fixes: a
check that passes because it did not look. The suite now covers a project whose
source is not in
./src, and the line is ASCII. With the em dash put back, thenew case fails.
Scope
Two faces of one defect, so they ship together; the other silent-success
findings from the same sweep are going up as their own PRs.
Refreshed on main 5bb03cf
Main changed the generated README tables twice (#6867, then #6615's removal of the
layoutrows next to this PR'sintegration.doc-conflictsrow), so this PR conflicted there. Main is merged in and the tables are regenerated. All five of this PR's README rows are present by content. On main 5bb03cf plus this head: the full CLI node suite (346 files, 5,515 tests),check:cli-structure,check:changesets,readme:check, both typechecks,cli-api-types-verify, eslint and prettier pass.Refreshed on main ebd939b
#6737's doc pass rewrote
upgrade.doc.mjs, and this PR's only change there is theupgrade.rundescription. The resolution takes #6737's new wording and insertssourcePathFound (false when the resolvedpathdoes not exist, so nothing was scanned)into it. The README tables are regenerated, and all five of this PR's README rows are present by content. On main ebd939b plus this head: the full CLI node suite (342 files, 5,322 tests) and every gate listed above pass.