Skip to content

fix(cli): a not-ready page template no longer takes a search result place in build's kit - #11968

Merged
josephfarina merged 5 commits into
mainfrom
josephfarina/build-unready-as-if-absent
Nov 16, 2026
Merged

josephfarina merged 5 commits into
mainfrom
josephfarina/build-unready-as-if-absent

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

User impact

astryx build asks search for the kit (page templates, blocks, components) with a result limit. A page template that is not ready yet is still a search match, so it took one of those result slots: the last result fell off, and with it a ready page from the page list or a searched block the block suggestions read. Adding a not-ready template to the catalog therefore changed build's page list and block suggestions for unrelated ideas, even though build never starts or lists it.

For example, with a not-ready template whose docs match "export report", build "export report" listed two dashboard pages instead of three, and its reason named two matches instead of three.

Problem and solution fit

  • Why does it happen? Search caps its results at the requested count, and not-ready page templates are counted.
  • Why does it matter? The kit's page list and block suggestions then depend on templates build does not use.

Build now asks search for one more result per not-ready page template in the project, sets the not-ready page entries aside, and keeps the same number of results, so a not-ready template no longer pushes a page, a block suggestion or a component out of the kit. This fixes the result places only: search can still read the query itself differently while a not-ready template exists (for example, an idea that is exactly a not-ready template's identifier), which is a separate gap. The only use of the set-aside entries is the existing reason that says a template the idea names is not ready yet; that reason now finds the named template wherever it ranks among search's page matches, not only when it ranks first.

Expected behavior and authority

spec:AST-048 FR4 (after #11940): build starts only from ready page templates, and a not-ready template steers no start. This extends the same rule to the rest of the kit.

matchCount stays search's own total of matches, so it still counts a not-ready template that matches; its field doc now says so.

Smallest restoration

  • kit/signals.mjs: the wider search, the set-aside, and the named-not-ready reason's lookup.
  • _adapter.mjs: loadTemplates also reports how many page templates are not ready.
  • Tests: kit/unready-blocks.test.mjs (new) and one case in kit/unready-search.test.mjs.

Evidence

  • Before: of the new test's four ideas (a not-ready template ranked first, with search's real result cap), two change: the page list for "export report" and the block order for the grouped-rows table idea; the other two are controls whose kit stays the same apart from matchCount. After: all four kits are identical with and without it, except matchCount, which counts it.
  • The named-not-ready case (a not-ready template the idea names, ranked below another not-ready template) keeps its start and reason; it fails before.
  • On a build replay set (15,635 requests): no start or alternative changes; block suggestions change on 52 requests (the current catalog's not-ready templates no longer take their slots); block pick accuracy unchanged; on a stricter judged subset, no first block changes.
  • With a not-ready template added on top of this change, the same replay shows no start, alternative or block change.

Scope

Components: cli (build)

  • 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.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run --project node packages/cli/api/build packages/cli/api/search: 441 pass, 1 skipped.
  • eslint on the changed files.

Build's kit search asks for one more result per page template that is not
ready yet, sets those entries aside, and keeps the same number of results, so
a not-ready template never takes the place of a ready page, a block or a
component. The named-not-ready reason now finds the template the idea names
wherever it ranks among search's page matches.
@vercel

vercel Bot commented Nov 16, 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 16, 2026 3:30am UTC

Request Review

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

astracat-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

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

Requesting changes for one wording fix; the code change itself looks right and is well tested.

  • The changeset (.changeset/build-unready-as-if-absent.md, line 5) says the page list, the block suggestions "and the rest of the kit" are what they would be without a not-ready template, but data.matchCount and data.hasResults still count a matching not-ready template, as build.type.mjs now documents; please narrow the sentence, for example: "…so the page list, the block suggestions and the components are what they would be without it; matchCount still counts it."

The new tests fail on main and pass on this branch, and the start and the kit's page, block and component lists stay the same with or without Core's not-ready templates. The kit test's search mock keeps matchCount unchanged, which is why it does not catch the count difference; counting the injected entry there would keep the test honest.

Claims and files checked

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

Claims:

  • Build reads search as if a not-ready page template were absent, so it no longer takes a result's place: verified (kit/signals.mjs:156-177; the new kit test fails on main and passes here).
  • The page list, the block suggestions and the rest of the kit are what they would be without it: false in part; the start, pages, blocks and components match, but matchCount and hasResults still count it (kit/answer.mjs:95-96).
  • When the idea names a not-ready template, the reason still says so even if another not-ready template ranks above it: verified (kit/signals.mjs:214-221; kit/unready-search.test.mjs:84-90 fails on main).
  • A not-ready template took one of search's capped result slots, so the last result fell off: verified (on main the limit is applied before not-ready templates are dropped).
  • With a leading not-ready template, build "export report" listed two dashboard pages instead of three and its reason named two: verified (the new test's failure on main).
  • Build asks for one more result per not-ready page template, sets those entries aside and keeps the same number: verified (kit/signals.mjs:156-177).
  • Search's scores do not depend on those entries, so the kit is exactly what it would be without them: partly verified; each entry's score is its own, but whole-name and named-run ordering reads every candidate (search/_lexical.mjs:205, :321-347), and matchCount differs; the kit lists matched in every idea tried.
  • The set-aside entries serve only the named-not-ready reason, which now finds the template wherever it ranks: verified (kit/signals.mjs:177, :214-221).
  • spec:AST-048 FR4 governs the change: verified (FR4 covers the start and the reason; FR11 and the record's non-goals leave which blocks and pages appear to ranking).
  • matchCount stays search's own total and its field doc says so: verified (build.type.mjs:76).
  • The change touches kit/signals.mjs, _adapter.mjs and two tests as described: verified.
  • The new kit test changes the kit for four ideas before the fix and none after: verified after the fix; before the fix, the first idea fails and stops the loop.
  • The named-not-ready case fails before the fix: verified.
  • Replay results over 15,635 requests (52 block changes, accuracy unchanged, no change with an added not-ready template): not checked; the request set is not available.
  • The build and search suites pass: verified (442 tests pass).
  • eslint passes on the changed files: verified.
  • One defect restored, no tagalongs, no hidden public API, no internal context: verified.

Files:

  • .changeset/build-unready-as-if-absent.md: finding (overstated kit claim).
  • packages/cli/api/build/_adapter.mjs: clear.
  • packages/cli/api/build/build.type.mjs: clear.
  • packages/cli/api/build/kit/signals.mjs: clear.
  • packages/cli/api/build/kit/unready-blocks.test.mjs: clear (its mock keeps matchCount, noted above).
  • packages/cli/api/build/kit/unready-search.test.mjs: clear.

Automated review (maintainer link)

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 376efe7

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.06 MB packed (+395 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

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

Requesting changes for one remaining wording issue; the code change and its tests look right, and the earlier matchCount wording is fixed.

  • Miss: the title, the changeset (.changeset/build-unready-as-if-absent.md, line 5) and the description say the page list, the block suggestions and the components are what they would be without a not-ready template, but search still reads a one-word identifier idea differently while one exists (build "MessagingShell" returns no pages, blocks or components with Core's not-ready messaging-shell in the catalog, and 3 pages, 5 blocks and 6 components without it), so please word the claim as the slot fix it is, for example "…such a template no longer takes one of search's result places, so it no longer pushes a page, a block suggestion or a component out of the kit; matchCount still counts it."

The earlier review suggested that wording and missed these ideas; main behaves the same way, so only the claim needs to change, unless search is changed to leave not-ready page templates out of how it reads the query for build. The new tests fail on main and pass on this branch, and the build and search suites pass.

Claims and files checked

Review mode: incremental; reason: none

Changeset claims:

  • Build treats a not-ready page template as absent from search: false for a one-word identifier idea that names one (MessagingShell, IncidentConsole); search decides how to read that idea from every template (search/_lexical.mjs:159-179).
  • Such a template no longer takes a search result's place: verified (kit/signals.mjs:167, :177; the new kit test fails on main).
  • So the page list, the block suggestions and the components are what they would be without it: false for those identifier ideas; verified for every multi-word idea tried.
  • matchCount still counts it: verified (kit/signals.mjs:183, kit/answer.mjs:96).
  • When the idea names a not-ready template, the reason still says so even when another not-ready template ranks above it: verified (kit/signals.mjs:214-221; kit/unready-search.test.mjs:84-90 fails on main).

Description claims:

  • A not-ready template took one of search's capped result places, so the last result fell off: verified (on main the cap applies before not-ready templates are dropped).
  • Adding one changed the page list and block suggestions for unrelated ideas: verified (the new kit test fails on main).
  • With a leading not-ready template, build "export report" listed two dashboard pages instead of three and its reason named two: verified (that failure on main).
  • Search caps its results at the requested count and counts not-ready templates: verified.
  • Build asks for one more result per not-ready template, sets those entries aside and keeps the same number of results: verified (kit/signals.mjs:156-177).
  • Search's scores do not depend on those entries, so the kit is exactly what it would be without them: false for one-word identifier ideas (above).
  • The set-aside entries serve only the not-ready reason, which now finds the named template wherever it ranks among search's page matches: verified (kit/signals.mjs:214-221).
  • The start rule governs the change and the rest of the kit is ranking: verified (the build recommendation record's FR4, FR11 and non-goals).
  • matchCount stays search's own total and its field doc says so: verified (build.type.mjs:76).
  • The change touches kit/signals.mjs, _adapter.mjs and two tests: verified.
  • Before the fix the new kit test changes the kit for four ideas, and after it the whole kit is identical: before, it fails on the first idea and stops; after, verified for the injected template apart from matchCount, which the test expects to grow by one.
  • The named-not-ready case fails before the fix: verified.
  • The replay over 15,635 requests (52 block changes, accuracy unchanged): not checked; the request set is not available.
  • With another not-ready template added, the replay shows no change: not checked; the request set is not available.
  • One defect restored, no tagalongs, no hidden public API, no internal context: verified.
  • The build and search suites pass: verified (442 tests).
  • eslint passes on the changed files: verified.

Files:

  • .changeset/build-unready-as-if-absent.md: finding (the kit claim is broader than the change).
  • packages/cli/api/build/_adapter.mjs: clear.
  • packages/cli/api/build/build.type.mjs: clear.
  • packages/cli/api/build/kit/signals.mjs: clear.
  • packages/cli/api/build/kit/unready-blocks.test.mjs: clear (it injects its template after search has ranked, so it cannot cover search's reading).
  • packages/cli/api/build/kit/unready-search.test.mjs: clear.

Automated review (maintainer link)

@josephfarina josephfarina changed the title fix(cli): build reads search as if a not-ready page template were absent fix(cli): a not-ready page template no longer takes a search result place in build's kit Nov 16, 2026

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

Requesting changes for one description fix; the code, its tests and the narrowed changeset look right, and the earlier changeset finding is fixed.

  • Miss: the description's Evidence section says the new kit test changes the kit for four ideas before the fix, but on this branch's base only export report (its page list) and the grouped-rows idea (its block order) change, while the settings and retention-cohort ideas give the same kit apart from matchCount, so please say two ideas there or swap in two ideas whose kit changes before the fix.

This is a description edit; no code change is needed. The new tests fail before the fix and pass on this branch, and the build and search suites pass here and when merged into the current main.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Changeset: a not-ready page template no longer takes a place in the search results build reads: verified (kit/signals.mjs:167, :177; the new kit test fails before the fix).
  • Changeset: so it no longer pushes a page, a block suggestion or a component out of the kit: verified for result places (kit/unready-blocks.test.mjs, four of four ideas identical here); search's own reading of an identifier idea is outside it, as the description says.
  • Changeset: matchCount still counts it: verified (kit/signals.mjs:183; the test expects one more).
  • Changeset: the reason still names a not-ready template the idea names when another not-ready template ranks above it: verified (kit/signals.mjs:214-221; kit/unready-search.test.mjs:84-90 fails before the fix).
  • Title: a not-ready page template no longer takes a search result place in build's kit: verified (as above).
  • Description: a not-ready template took one of search's capped places, so the last result fell off: verified (before the fix, search was capped at max(limit, 200) and not-ready pages were dropped afterwards).
  • Description: adding one changed the page list and block suggestions for unrelated ideas: verified (export report and the grouped-rows idea before the fix).
  • Description: with a not-ready template matching the idea, build "export report" listed two dashboard pages instead of three and the reason named two: verified (red-first failure).
  • Description: search caps at the requested count and counts not-ready templates: verified (search/_lexical.mjs:407).
  • Description: build asks for one more result per not-ready template, sets them aside and keeps the same number: verified (kit/signals.mjs:156-177).
  • Description: search can still read the query differently while a not-ready template exists, for example an idea that is exactly its identifier: verified (search/_lexical.mjs:156-181; build MessagingShell returns an empty kit here).
  • Description: the set-aside entries serve only the not-ready reason, which now finds the named template wherever it ranks: verified (kit/signals.mjs:176-177, :214-221).
  • Description: the start rule governs, and the change extends it to the rest of the kit: verified as within the build record's ranking latitude (FR4, FR11, non-goals).
  • Description: matchCount stays search's total and its field doc says so: verified (build.type.mjs:76).
  • Description: the files the change touches: verified.
  • Description: before the fix the new kit test changes the kit for four ideas: false (two; see above).
  • Description: after the fix the kit is identical with and without the template, except matchCount: verified (four of four ideas).
  • Description: the named-not-ready case keeps its start and reason and fails before the fix: verified.
  • Description: the replay over about 15,600 requests (52 block changes, accuracy unchanged): not checked; the request set is not available.
  • Description: the replay with another not-ready template added shows no change: not checked; same reason.
  • Description: one defect restored, no tagalongs, no hidden public API, no internal context: verified.
  • Description: the build and search suites pass (441 pass, 1 skipped): verified (442 pass here; the skip depends on host locale data).
  • Description: eslint passes on the changed files: verified.
  • .changeset/build-unready-as-if-absent.md: clear (the earlier finding is fixed).
  • packages/cli/api/build/_adapter.mjs: clear.
  • packages/cli/api/build/build.type.mjs: clear.
  • packages/cli/api/build/kit/signals.mjs: clear.
  • packages/cli/api/build/kit/unready-blocks.test.mjs: clear; two of its four ideas also pass before the fix (the finding above).
  • packages/cli/api/build/kit/unready-search.test.mjs: clear.

Automated review (maintainer link)

@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 is still running on this head.

The earlier finding is fixed: the description now says that two of the new kit test's four ideas change before the fix and the other two are controls, which is what the base does. The code, its tests and the release note look right, and nothing else is needed from you; merging waits for the required checks.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Changeset: a not-ready page template no longer takes a place in the search results build reads: verified (kit/signals.mjs:167, :177; the new kit test fails before the fix).
  • Changeset: so it no longer pushes a page, a block suggestion or a component out of the kit: verified for result places (kit/unready-blocks.test.mjs, four of four ideas identical apart from matchCount).
  • Changeset: matchCount still counts it: verified (kit/signals.mjs:183; the test expects one more).
  • Changeset: the reason still names a not-ready template the idea names when another not-ready template ranks above it: verified (kit/signals.mjs:214-221; kit/unready-search.test.mjs:84-90 fails before the fix).
  • Title: a not-ready page template no longer takes a search result place in build's kit: verified (as above).
  • Description: build asks search for the kit with a result limit: verified (kit/signals.mjs:156-168).
  • Description: a not-ready template took one of those places, so the last result fell off, with a ready page or a searched block: verified (before the fix, search was capped and not-ready pages were dropped afterwards; export report and the grouped-rows idea).
  • Description: adding a not-ready template changed the page list and block suggestions for unrelated ideas: verified (same two ideas before the fix).
  • Description: with a not-ready template matching the idea, build "export report" listed two pages instead of three and its reason named two: verified (failure before the fix).
  • Description: search caps at the requested count and counts not-ready templates: verified (search/_lexical.mjs:407, :414; search's template gather keeps not-ready pages).
  • Description: the page list and block suggestions then depend on templates build does not use: verified.
  • Description: build asks for one more result per not-ready template, sets them aside and keeps the same number: verified (kit/signals.mjs:167, :174-177; _adapter.mjs:110-112).
  • Description: so a not-ready template no longer pushes a page, a block suggestion or a component out: verified for result places.
  • Description: search can still read the query differently while a not-ready template exists, for example an idea that is exactly its identifier: verified (build MessagingShell returns no pages, blocks or components here).
  • Description: the set-aside entries serve only the not-ready reason, which now finds the named template wherever it ranks: verified (kit/signals.mjs:177, :214-221).
  • Description: the build record's start rule governs, and the change extends it to the rest of the kit: verified as within the build record's ranking latitude (FR4, FR11, non-goals); the cited earlier fix is merged into the base.
  • Description: matchCount stays search's total and its field doc says so: verified (build.type.mjs:76).
  • Description: the files the change touches: verified.
  • Description: before the fix, two of the new test's four ideas change (the export report page list and the grouped-rows block order) and two are controls: verified (one test per idea on the base).
  • Description: after the fix, all four kits are identical with and without the template except matchCount: verified.
  • Description: the named-not-ready case keeps its start and reason and fails before the fix: verified.
  • Description: the replay over about 15,600 requests (no start or alternative change, 52 block changes, accuracy unchanged): not checked; the request set is not available, and no conclusion rests on it.
  • Description: the replay with another not-ready template added shows no change: not checked; same reason.
  • Description: one defect restored, no tagalongs, no hidden public API, no internal context: verified.
  • Description: the build and search suites pass (441 pass, 1 skipped): verified (442 pass here; the skip depends on host locale data).
  • Description: eslint passes on the changed files: verified.
  • .changeset/build-unready-as-if-absent.md: clear.
  • packages/cli/api/build/_adapter.mjs: clear.
  • packages/cli/api/build/build.type.mjs: clear.
  • packages/cli/api/build/kit/signals.mjs: clear.
  • packages/cli/api/build/kit/unready-blocks.test.mjs: clear (the earlier note on its two control ideas is resolved by the description).
  • packages/cli/api/build/kit/unready-search.test.mjs: clear.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit ae1cab0 into main Nov 16, 2026
78 checks passed
@github-actions
github-actions Bot deleted the josephfarina/build-unready-as-if-absent branch November 16, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 376efe75 Deployed Nov 16, 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