Skip to content

perf(cli): issues() reads Core templates only for integration templates - #10008

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:c04/issues-templates-gate
Nov 5, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:c04/issues-templates-gate

Conversation

@vjeux

@vjeux vjeux commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

doctor/icon-sets.test.mjs's first case times out in full node runs on a loaded machine. It runs the whole doctor three times on projects whose integrations are icon-set packages, and every Project.issues() with an integration loaded resolves the whole template catalog, importing every Core template doc. Users pay the same import on every astryx doctor in such a project.

Intended invariant

issues() returns the same issues whichever discovery method ran first, and reads Core's templates only when an integration's templates could replace one.

Change

foundation/config/project.mjs: issues() resolves the template catalog only when a loaded integration has a templates root that exists, the same check discoverIntegrationTemplatesForOne makes before it reads any template. Without one, that discovery finds nothing, and applyTemplateReplacements has no replacement to judge, because Core templates declare none; every other issue source (#collectIssues, component replacements) still runs.

Evidence

  • Red first, by count: project.issues.test.mjs counts template doc imports. With one loaded integration that ships only a themes root, issues() imports 749 template docs on the parent commit and none here.
  • An integration with a templates root still gets its issues: a page template replacing a missing Core template still reports missing_template_replacement_target, and the broken-template case still reports invalid_template.
  • Local probe, not part of this change: the icon-sets case's doctor runs load 1,271 modules (749 template docs) on the parent and 522 (none) here.
  • Same probe pattern under contained pressure (the file pinned to 2 CPUs shared with 6 busy loops), one box, order-balanced, 3 runs per round: the first case takes 28.3–31.1 s on the parent and fails 2 of 6 against its 30 s limit; here it takes 19.2–21.9 s and passes 6 of 6.

Scope

  • No behavior change: the issue set is unchanged.
  • One cause: a catalog read with nothing to validate.

Testing

At 44d4950 on main e2b522f:

  • vitest run --project node packages/cli/foundation/config packages/cli/api/doctor packages/cli/foundation/discovery/template-adapter packages/cli/clients/cli/commands/doctor: 20 files, 448 tests passed.
  • eslint (CI=true), pnpm lint on the changed files, the CLI's pnpm typecheck, Prettier and check:changesets pass. pnpm review:pre: 0 findings.

@vercel

vercel Bot commented Nov 4, 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 5, 2026 3:03am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 5, 2026, 3:10 AM UTC

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

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 44d4950

Storybook · Sandbox · built from this PR's head

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

API changes: none in this pull request

Committed API report behind this build: cli 9 rows, core 3 rows; run pnpm api:report.

Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.


Generated by PR Enrichment workflow | View full report

@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: CI has not run on this head yet.

Project.issues() now skips the Core template catalog when no loaded integration has a templates root, and, through the commit from #9965 carried here, when no integration is loaded. The issues it returns are unchanged: an integration that ships templates still gets its replacement and template errors, and doctor, discover and component print the same output while Core template doc imports drop from 749 to 0 in those projects. There are no blocking findings.

Next step: once the draft is marked ready for review, a maintainer adds the ci:run label so CI runs on the fork branch.

[Automated review]

@vjeux
vjeux marked this pull request as ready for review November 4, 2026 22:55
@vjeux
vjeux marked this pull request as draft November 5, 2026 02:53
issues() resolved the whole template catalog whenever an integration
was loaded, which imports every Core template doc. Only an
integration's own templates can carry a replacement, so with no
integration templates root that read finds no issue. issues() now
resolves the catalog only when a loaded integration has a templates
root, the same check discoverIntegrationTemplatesForOne makes. A
doctor run in a project whose integrations ship only icon sets reads
none of them.

@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: CI has not run on this head yet.

Project.issues() now reads Core's template catalog only when a loaded integration ships a templates root, so astryx doctor in an icon-set-only project imports no Core template doc and reports the same issues, while an integration that ships templates still gets its replacement and template errors. There are no blocking findings.

Next step: once the draft is marked ready for review, a maintainer adds the ci:run label so CI runs on the fork branch.

[Automated review]

@vjeux
vjeux marked this pull request as ready for review November 5, 2026 03:28
@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 5, 2026
@cixzhang
cixzhang marked this pull request as draft November 5, 2026 03:33
@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 03:33
@cixzhang
cixzhang merged commit e657e2e into meta:main Nov 5, 2026
150 of 155 checks passed
@vjeux
vjeux deleted the c04/issues-templates-gate branch November 5, 2026 05:26

This branch was successfully deployed

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

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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.

2 participants