Skip to content

[experimental] render: the missing-package refusal offers no install line that would install in the wrong place - #12429

Merged
josephfarina merged 3 commits into
mainfrom
josephfarina/render-missing-package-advice
Nov 18, 2026
Merged

josephfarina merged 3 commits into
mainfrom
josephfarina/render-missing-package-advice

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

When a page imports packages that are not installed, astryx experimental render refuses it and suggests an install line in the package manager of the folder the render runs from. That line could install in the wrong place: when the project's lockfiles disagree it still said npm install; in a folder that no package.json holds, running it would make the folder a project; and for a page in another package than the run folder, it added the packages to the run folder's package.json, not the page's.

Problem and solution fit

  1. Why it occurs: the refusal took its line from the run folder's install step, which falls back to npm install with a note, rather than from the page's own package with the rule astryx template and astryx build follow.
  2. Why it harms the task: an agent runs the line it is given; npm install in a pnpm project writes a second lockfile, in a scratch folder it makes a project there, and in the wrong package it leaves the page's import missing.
  3. Why that matters: the same missing package gets the same advice from every command, and the advice works when run.

When the run folder's integrations give their own line for adding packages, that line still comes first for a page in the run folder's package, then a command the render named; for a page in another package it is not offered, since it would add the packages to the run folder's project. Otherwise the page's own package decides the line, with the CLI's version ranges, through the rule template and build use. When its lockfiles disagree, there is no install line, and the message names the folder, from where the render runs, and its lockfiles. For a page in another package than the folder the render runs from, the message names the page's package and the line to run there, with no suggestion (spec:AST-048 FR18). In a folder that no package.json holds, the message says to install them in the project that uses the page, and suggests no install.

Expected behavior and authority

spec:AST-048 FR17–FR19 (one install command, in the project's package manager, none when the package manager is ambiguous, and none in a folder no package.json holds, since an install would make it a project, spec:AST-081 FR3). No record yet says render follows them; this change asks for that owner decision. astryx experimental render is experimental (spec:AST-017 FR27).

Smallest restoration

  • api/render/_adapter.mjs: the refusal's suggestion and message.
  • foundation/discovery/template-needs.mjs: installCommandFor takes the folder its reason names others from.
  • api/render/render.doc.mjs: the error's description.
  • A changeset.

Evidence

  • api/render/render.test.mjs: a page in a pnpm project gets pnpm add not-real-a-xyz not-real-b-xyz, one in an npm project npm install not-real-a-xyz; a page in a folder no package.json holds gets "… which are not installed. Install them in the project that uses this page." and no suggestion; a page in a subfolder of a project whose lockfiles disagree gets no suggestion, and the message names the lockfiles' folder (.) from where the render runs; a page in a pnpm package rendered from that package gets pnpm add …, and rendered from the package above gets no suggestion, with a message naming pnpm-app and the line to run there. With an integration line declared for the run folder, a page there gets that line, and a page in another package gets no suggestion and a message with that package's own line.

Scope

  • One defect is restored.
  • 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 --project node packages/cli/api/render packages/cli/foundation/render packages/cli/foundation/doc-compiler/doc-loads.test.mjs packages/cli/test/lazy-dependencies.test.mjs packages/cli/foundation/discovery/template-needs.test.mjs.
  • Typecheck; ESLint on the changed files; pnpm check:knowledge.

@vercel

vercel Bot commented Nov 17, 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 Nov 18, 2026 3:35am UTC

Request Review

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

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 3:42 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.

Approval waits on an engineering owner's decision, and one fix is needed.

  • The note shown when lockfiles disagree names their folder relative to the page instead of the folder render runs from, so rendering src/app/page.tsx from a project root that holds pnpm-lock.yaml and package-lock.json says "the lockfiles in ../.. disagree" (packages/cli/api/render/_adapter.mjs:431 passes the page's folder to installStepFor); name the folder from the run folder and add a test with a page in a subfolder.

What must be settled: no current record yet states which install line astryx experimental render suggests inside a project, since spec:AST-048 FR17-FR19 cover only template.copy and build, so an engineering owner needs to confirm that render follows those clauses (including no command when lockfiles disagree, and the CLI's own version ranges such as recharts@"^3.10.1") or name the rule it should follow, by commenting /approve-spec <full head SHA> or adding a record clause; the author may record it as an engineering owner. The outside-a-project change matches spec:AST-081 FR3, and its tests fail before the change and pass after it. Two small points: the changeset and the error description could mention the version ranges, and the test title at render.test.mjs:2536 still says "with one install line" although the test now expects none.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Description: the refusal always suggested npm install, also in pnpm, Yarn and Bun projects and outside any package.json: verified (the changed tests fail on the base with npm install ...).
  • Description: template and build already pick the project's package manager and print no install outside a package.json: verified (template-needs.mjs:383-403).
  • Description: inside a project the suggestion is one line for every missing package in the project's package manager, by the rule template and build use: verified for pnpm, npm, Yarn and Bun; false when lockfiles disagree, where render prints npm install with a note and template and build print no command.
  • Description: outside a package.json the message says to install in the project that uses the page, with no suggestion: verified (render.test.mjs:2551-2553).
  • Description: the suggestion rests on spec:AST-048 FR17: that clause covers template.copy and build only; an owner decision is open.
  • Description: an install outside a package.json would make the folder a project, which spec:AST-081 FR3 rules out: verified; render answers outside a project as in a new project.
  • Description: the command is experimental: verified.
  • Description: tests show the pnpm, npm and no-package.json results: verified (render.test.mjs:2107-2125, :2536-2604).
  • Description: no new public API, default or interaction model, and no internal context: verified.
  • Description: the stated test command, typecheck, ESLint and the knowledge check pass: verified on the head (481 tests).
  • Changeset: the install line uses the project's package manager, as template and build do, where it always said npm install: verified, except when lockfiles disagree.
  • Changeset: outside a package.json the message names the project that uses the page and suggests no install: verified.
  • .changeset/render-missing-package-advice.md: clear; does not mention the version ranges.
  • packages/cli/api/render/_adapter.mjs: blocking finding (lockfile folder at line 431).
  • packages/cli/api/render/render.doc.mjs: clear; consistent with the adapter apart from the version ranges.
  • packages/cli/api/render/render.test.mjs: clear; stale test title at line 2536.

Automated review (maintainer link)

Comment thread packages/cli/api/render/_adapter.mjs Resolved
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 1096982

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.38 MB packed (+670 B); no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): inside a project, the missing-package suggestion of astryx experimental render follows spec:AST-048 FR17–FR19: one command in the project's own package manager with the CLI's version ranges, and no install line when lockfiles disagree, naming the lockfile folder from the folder render runs in. Outside a project it follows spec:AST-081 FR3: no install line, and the message names the project that uses the page. It uses the same shared package-manager detector as template and build, with a test per package manager plus the disagreeing-lockfiles and outside-a-project cases.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec dccfce8

@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.

Changes requested: one fix remains before approval.

  • Newly live check: a page whose nearest package.json is not the one of the folder render runs from gets an install line (decided at packages/cli/api/render/_adapter.mjs:434) that, run as printed, adds the packages to the run folder's package instead of the page's, as the test at packages/cli/api/render/render.test.mjs:2107 shows by rendering pnpm-app/page.tsx from its parent package and expecting pnpm add …, which spec:AST-048 FR18 (now adopted for render) rules out; print a line that installs into the page's package from the run folder (for example pnpm --dir pnpm-app add …) or none with that folder named, and pin it with a test rendered from each side.

The owner decision settles which rule render follows, and the earlier lockfile-folder issue is fixed: disagreeing lockfiles now get no command and a reason that names their folder from the run folder. The outside-a-project, package-manager and disagreeing-lockfiles results are each covered by tests that fail before the change and pass after it.

Claims and files checked

Review mode: incremental; reason: none

  • Description: the refusal always suggested npm install, also in pnpm, Yarn and Bun projects and outside any package.json: verified (the seven changed or new tests fail on the base).
  • Description: template and build already pick the project's package manager and print no install outside a package.json: verified (template-needs.mjs:385-405).
  • Description: in a project the suggestion is one line for every missing package, in the project's package manager with the CLI's version ranges, by the rule template and build use: verified for pnpm, npm, Yarn, Bun and recharts@"^3.10.1"; for a page outside the run folder's package the line installs into the wrong package (finding above).
  • Description: disagreeing lockfiles give no line, and the message names their folder from the run folder and the lockfiles: verified (render.test.mjs:2128-2148).
  • Description: outside a package.json the message says to install in the project that uses the page, with no suggestion: verified (render.test.mjs:2555-2620).
  • Description: the expected behavior is the build-recommendation record's install clauses, with the outside-a-project case resting on the global-mode record, and an owner decision is needed for render: verified; that decision is now recorded for this head.
  • Description: the command is experimental: verified.
  • Description: the change touches the render adapter, the shared install helper, the error description and a changeset: verified (plus the tests).
  • Description: the tests show the pnpm, npm, outside-a-project and nested disagreeing-lockfiles results: verified.
  • Description: no new public API, default or interaction model, and no internal context: verified.
  • Description: the stated test command, typecheck, ESLint and the knowledge check pass: verified on the head (482 tests passed).
  • Changeset: the line uses the project's package manager and the CLI's version ranges, as template and build do, where it always said npm install: verified, except for a page outside the run folder's package.
  • Changeset: when lockfiles disagree the message says so and suggests none: verified.
  • Changeset: outside a package.json the message says to install in the project that uses the page and suggests no install: verified.
  • .changeset/render-missing-package-advice.md: clear.
  • packages/cli/api/render/_adapter.mjs: finding above (line 434).
  • packages/cli/api/render/render.doc.mjs: clear; matches the adapter.
  • packages/cli/api/render/render.test.mjs: the test at line 2107 pins the line of the finding; the rest clear.
  • packages/cli/foundation/discovery/template-needs.mjs: clear; the other callers keep two arguments, so their output is unchanged.

Automated review (maintainer link)

Comment thread packages/cli/api/render/_adapter.mjs Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec aa07056

@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.

Approved pending CI: the CI run found no room under its ceiling and was cancelled, so typecheck, the node tests and the build have not run on this head yet; re-run the CI jobs so they do.

The missing-package refusal of astryx experimental render now suggests one install in the page project's package manager with the CLI's version ranges, and for a page in another package than the folder render runs from it names that package and the line to run there, so it no longer prints a line that would install into the wrong package. The new and changed refusal tests fail on the base and pass on this head, and the earlier finding is fixed.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim, release note: the suggested install uses the project's package manager and the CLI's version ranges, as astryx template and astryx build do, where it always said npm install: verified (packages/cli/api/render/_adapter.mjs:435-441, render.test.mjs:2107, head checks for Yarn, Bun and a recharts range).
  • Claim, release note: when the project's lockfiles disagree, the message says so and suggests none: verified (render.test.mjs:2140).
  • Claim, release note: for a page in another package than the run folder, the message names that package and the line to run there: verified (_adapter.mjs:442-447, render.test.mjs:2121).
  • Claim, release note: in a folder that no package.json holds, the message says to install in the project that uses the page, with no install: verified (_adapter.mjs:426-430, render.test.mjs:2567-2635).
  • Claim, description: the line comes through the rule template and build use, and the lockfile folder is named from where the render runs: verified (template-needs.mjs:294, :310, render.test.mjs:2140).
  • Claim, description: installCommandFor takes the folder its reason names others from, and the error description is updated: verified (template-needs.mjs:294, render.doc.mjs:100).
  • Claim, description: the listed tests, the typecheck, ESLint on the changed files and the knowledge check pass: verified (re-run on this head).
  • Claim, description: no new public API, and no internal context in public text: verified (no export, command, option or error code changes; no such text in the added lines).
  • File .changeset/render-missing-package-advice.md: clear.
  • File packages/cli/api/render/_adapter.mjs: clear.
  • File packages/cli/api/render/render.doc.mjs: clear.
  • File packages/cli/api/render/render.test.mjs: clear.
  • File packages/cli/foundation/discovery/template-needs.mjs: clear.

Automated review (maintainer link)

…l-command rule, with the page's package named when it is not the run folder's

Rebased onto main as one commit after the integration install guidance
landed: the guidance still comes first, then the command the render
named. Otherwise the line is installCommandFor's, as template and build
give it (the project's package manager, the CLI's version ranges, none
when lockfiles disagree); outside a project the message names the
project to install in; for a page in another package than the run
folder's, the message names that package and the line to run there.
@josephfarina
josephfarina force-pushed the josephfarina/render-missing-package-advice branch from aa07056 to 2f9dca5 Compare November 18, 2026 01:19
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 2f9dca5

@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.

Changes requested: the code changes are owner-decided and tested, but the pull request's text credits it with a change the base already has.

  • Regression: the title, description and changeset say the refusal moves from a fixed npm install to the project's package manager with the CLI's version ranges, but since the integration install-guidance change landed on main the base already prints pnpm add, yarn add, bun add or npm install with those ranges (this pull request's own pnpm and npm test cases pass on the base), so please describe only what changes here: no install line when the lockfiles disagree or no package.json holds the page, and the page's package named when it is not the run folder's.

Editing the changeset makes a new commit, so an engineering owner's /approve-spec for that new head is needed again.

Claims and files checked

Review mode: full; reason: history

  • Claim: the refusal now uses the project's package manager and the CLI's ranges instead of a fixed npm install (title, description, changeset): false, the base already does this.
  • Claim: integration install guidance still comes first: verified in _adapter.mjs.
  • Claim: disagreeing lockfiles give no install line and a message naming the folder and its lockfiles: verified, the new test fails on the base and passes here.
  • Claim: a page in another package than the run folder's gets a message naming that package and the line to run there: verified by test and a workspace-root check.
  • Claim: a folder with no package.json gets no install line and is told to install in the project that uses the page: verified, five tests fail on the base and pass here.
  • Claim: the shared install helper names the lockfile folder from the run folder: verified.
  • Claim: the pnpm and npm cases in the evidence: true, but they already pass on the base.
  • Claim: no new public API and no internal context: verified.
  • File .changeset/render-missing-package-advice.md: finding above.
  • File packages/cli/api/render/_adapter.mjs: clear.
  • File packages/cli/api/render/render.doc.mjs: clear.
  • File packages/cli/api/render/render.test.mjs: clear.
  • File packages/cli/foundation/discovery/template-needs.mjs: clear.

Automated review (maintainer link)

@josephfarina josephfarina changed the title [experimental] render: the missing-package refusal installs in the project's package manager, and names the project to install in outside one [experimental] render: the missing-package refusal offers no install line that would install in the wrong place Nov 18, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec e8cbe60

@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.

Changes requested: the earlier wording fix landed, but the new title and the changeset's opening sentence claim more than the code does.

  • The title and .changeset/render-missing-package-advice.md say no install line is offered where running it would install in the wrong place, but when the folder you run from loads an integration that declares installGuidance, that integration's line is still the suggestion for a page in another package (packages/cli/api/render/_adapter.mjs:427 and :431-432), so please either say that this line still comes first from the folder you run from, or put it through the same page-package check as the package-manager line (:446) with a test (the changeset's sentence about a page in another package has the same gap, which the last review missed).

Any fix makes a new commit, so an engineering owner's /approve-spec for that new head is needed again.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules since the last review: none.
  • Claim: the refusal offers no install line that would install in the wrong place (title, changeset): false for a loaded integration's line from the folder you run from.
  • Claim: the page's own package decides the package manager: verified.
  • Claim: with disagreeing lockfiles the message names them and suggests no install, where it used to suggest npm install: verified, the test fails on the base and passes here.
  • Claim: a page in another package gets a message naming that package and the line to run there: verified without integration guidance, false with it.
  • Claim: a folder no package.json holds gets no install and is told to install in the project that uses the page: verified, five tests fail on the base and pass here.
  • Claim: on the base the line came from the run folder's install step, with npm install and a note for disagreeing lockfiles: verified.
  • Claim: an integration's own line still comes first (description): verified.
  • Claim: the shared install helper names the lockfile folder from the run folder: verified.
  • Claim: the listed tests and test command: verified, they pass on this head.
  • Claim: no new public API and no internal context: verified.
  • File .changeset/render-missing-package-advice.md: finding above.
  • File packages/cli/api/render/_adapter.mjs: clear; the integration branch is unchanged from the base.
  • File packages/cli/api/render/render.doc.mjs: clear.
  • File packages/cli/api/render/render.test.mjs: clear.
  • File packages/cli/foundation/discovery/template-needs.mjs: clear.

Automated review (maintainer link)

…a page in the run folder's package

For a page in another package, that line would add the packages to the
run folder's project, so the message names the page's package and the
line from the page's own package instead.
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 1096982

@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.

Approved pending CI: the remaining test-node shards had not finished on this head when this review was written.

The refusal now gates both the package-manager line and the run folder's integration line on the page's own package, and each changed outcome is pinned by a test that fails on the base and passes here.

  • Non-blocking: the ERR_RENDER_MISSING_DEPENDENCY description in packages/cli/api/render/render.doc.mjs says the suggestion is a package-manager line with the CLI's ranges and none when lockfiles disagree, but when a loaded integration declares installGuidance the suggestion is that integration's line; consider adding "or the line a loaded integration gives for adding packages".
Claims and files checked

Review mode: incremental; reason: none

  • Changeset: the suggested line follows the page's own package: verified (_adapter.mjs:445).
  • Changeset: no line is offered where running it would install in the wrong place: verified (_adapter.mjs:431-454; render.test.mjs:2108, :2140).
  • Changeset: the page's package decides the package manager: verified (_adapter.mjs:445).
  • Changeset: with disagreeing lockfiles the message names them and suggests no install, where it suggested npm install: verified (render.test.mjs:2173, which fails on the base).
  • Changeset: for a page in another package the message names that package and the line to run there: verified (render.test.mjs:2108, :2140).
  • Changeset: in a folder no package.json holds, the message points to the project that uses the page and suggests no install: verified (render.test.mjs:2600-2667).
  • Description: the base's wrong-place lines (npm install with disagreeing lockfiles, an install in a folder with no package.json, the run folder's package for another package's page): verified by the base code and the head's tests failing on the base.
  • Description: the run folder's integration line comes first only for a page in the run folder's package: verified (_adapter.mjs:432, render.test.mjs:2108).
  • Description: otherwise the page's package decides the line, with the CLI's ranges, through the rule template and build use: verified (template-needs.mjs:297).
  • Description: disagreeing lockfiles get no line, and the message names their folder from where the render runs: verified (template-needs.mjs:316, render.test.mjs:2173).
  • Description: a page in another package gets no suggestion and a message naming its package and line: verified (_adapter.mjs:449-454).
  • Description: a folder no package.json holds gets a message and no suggestion: verified (_adapter.mjs:437-441).
  • Description: the files listed under the smallest restoration and the test evidence bullets: verified against the diff and the test file.
  • Description: no new public API: verified (no export, command, option or response field changes).
  • Description: the listed test command, ESLint and typecheck pass: verified (486 tests pass here, ESLint is clean on the changed files, typecheck is green in CI); the knowledge check was not rerun, as no record changes.
  • File .changeset/render-missing-package-advice.md: clear.
  • File packages/cli/api/render/_adapter.mjs: clear.
  • File packages/cli/api/render/render.doc.mjs: the non-blocking note above.
  • File packages/cli/api/render/render.test.mjs: clear.
  • File packages/cli/foundation/discovery/template-needs.mjs: clear.

Automated review (maintainer link)

{code: 'ERR_RENDER_COMPILE', when: 'the page does not compile, or a stylesheet it imports is not valid CSS (the message names the file)'},
{code: 'ERR_RENDER_NO_DEFAULT_EXPORT', when: 'the page has no default export'},
{code: 'ERR_RENDER_MISSING_DEPENDENCY', when: "the page imports a package that is not installed (the suggestion is the install line), or the esbuild the CLI depends on is missing from its install"},
{code: 'ERR_RENDER_MISSING_DEPENDENCY', when: "the page imports a package that is not installed (the suggestion is one install line for every such package, in the project's package manager and with the CLI's version ranges (such as `recharts@\"^3.10.1\"`), and none when the project's lockfiles disagree, which the message then says; for a page in another package than the folder the render runs from, the message names that package and the line to run there; in a folder that no package.json holds, the message says to install them in the project that uses the page, with no install line), or the esbuild the CLI depends on is missing from its install"},

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.

Non-blocking: for a page in the run folder's package whose loaded integration declares installGuidance, the suggestion is that integration's line with bare names (acme add not-real-a-xyz in the test at render.test.mjs:2108), also when the lockfiles disagree (_adapter.mjs:432-434). This description says the suggestion is a package-manager line with the CLI's ranges and none when the lockfiles disagree. Consider adding "or the line a loaded integration gives for adding packages" after "one install line for every such package".

@josephfarina
josephfarina merged commit 7cb595c into main Nov 18, 2026
81 checks passed
@github-actions
github-actions Bot deleted the josephfarina/render-missing-package-advice branch November 18, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 10969824 Deployed Nov 18, 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