Skip to content

fix(cli): say when a command did nothing (upgrade sourcePathFound, doctor validated) - #6618

Merged
josephfarina merged 7 commits into
mainfrom
fix/cli-report-when-nothing-was-checked
Oct 5, 2026
Merged

josephfarina merged 7 commits into
mainfrom
fix/cli-report-when-nothing-was-checked

Conversation

@josephfarina

@josephfarina josephfarina commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • A team whose source is not in ./src runs astryx upgrade --apply, gets exit
    0, filesChanged: 0, errors: [] and "Upgrade complete", and ships
    unmigrated code. --path defaults to ./src; a project laid out as app/
    (or a typo) skips every code codemod.
  • CI runs astryx doctor integration validate --json from the wrong directory,
    gets {"name": null, "version": null, "issues": []} and exit 0, and is green
    forever. 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. runCodemods returns
{ok: false, reason: 'source_path_missing'} and the runner logs
Source path not found: …, which --json suppresses by design; the response
type had no field for it. validateIntegration computes found and then
collapses 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.run gains sourcePathFound, from a single existsSync on the
    already-resolved, already-confined --path.
  • integration.validate, integration.component-conflicts,
    integration.doc-conflicts and integration.template-conflicts gain
    validated, straight from the found the validators already return.

Text projections: upgrade's completion line now names the directory it did not
find 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 validated instead of inferring it from a null name.

Exit codes are deliberately untouched — the diagnosis calls for a field, and
turning a missing --path into a failure is a separate, breaking decision.

Evidence

Reproduction before the change, in a project laid out as app/:

$ astryx --json upgrade --from 0.1.0 --apply
{"type":"upgrade.run","data":{"from":"0.1.0","to":"0.6.3","codemods":25,
 "filesChanged":0,"errors":[], ...}}      # exit 0, "Upgrade complete"

$ astryx --json doctor integration validate
{"type":"integration.validate","data":{"name":null,"version":null,"issues":[]}}

Result after the change:

$ astryx --json upgrade --from 0.1.0 --apply
  ... "sourcePathFound": false, "filesChanged": 0 ...
$ astryx upgrade --from 0.1.0 --apply
  Upgrade complete — but src does not exist, so no source files were scanned.
  Pass --path <your source directory> if your code does not live in ./src.

$ astryx --json doctor integration validate
  ... "validated": false, "name": null ...
$ astryx doctor integration validate
  Nothing was validated: no astryx.integration.* found next to package.json. …

Representative unchanged path: the same project with a real src/ reports
sourcePathFound: true; a real integration package reports validated: true
and the same issue list it reported before.

Regression test or other mutation-sensitive proof: 6 tests across
api/upgrade/run/run.test.mjs and api/integration/validate-integration.test.mjs.
Verified in both directions — with the two API files reverted to their main
contents and only the tests applied, all 6 fail (expected undefined to be false);
with the fix, all 6 pass. Full packages/cli node suite: 308 files, 4695 tests,
all passing. check:repo, eslint, and all four CLI typechecks green in an
unbuilt tree.

One extra test, for a gate that was green by luck

upgrade.ascii-output.test.mjs requires plain ASCII on every human path, and it
passed 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 the
line 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, the
new case fails.

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.

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 layout rows next to this PR's integration.doc-conflicts row), 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 the upgrade.run description. The resolution takes #6737's new wording and inserts sourcePathFound (false when the resolved path does 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.

@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 Oct 2, 2026 4:57pm 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) Oct 2, 2026, 5:05 PM UTC

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

17 of 420 shot(s) changed.

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
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 155,733
Chat Full AI Chat probe dark 155,005
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,229
Chat With Attachments probe dark 11,065
SideNav Resizable in AppShell probe dark 3,208
Markdown Default probe dark 897
Markdown Default probe light 897
Markdown Default neutral dark 882
Markdown Default neutral light 858

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.
@josephfarina
josephfarina force-pushed the fix/cli-report-when-nothing-was-checked branch from 4430899 to a51079f Compare September 24, 2026 23:25
github-actions Bot added a commit that referenced this pull request Sep 24, 2026
# 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.

@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 — 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]

@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 — 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]

@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 — 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]

@josephfarina
josephfarina merged commit 6e56409 into main Oct 5, 2026
41 checks passed
josephfarina added a commit that referenced this pull request Oct 5, 2026
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.
@github-actions
github-actions Bot deleted the fix/cli-report-when-nothing-was-checked branch October 6, 2026 06:25

This branch was successfully deployed

1 active deployment
Preview — b67c5f88 Deployed Oct 2, 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