Skip to content

fix(cli): use a stored doc parse only with the zod release that made it - #12425

Closed
josephfarina wants to merge 1 commit into
mainfrom
fix/stored-parse-zod-release-match
Closed

josephfarina wants to merge 1 commit into
mainfrom
fix/stored-parse-zod-release-match

Conversation

@josephfarina

Copy link
Copy Markdown
Contributor

User impact

The published CLI ships each of its own docs already parsed, so a run reads the parse instead of running the doc parsers. The parsers are zod schemas, and the CLI depends on zod by a range (^4.6.7), not an exact version. An install can resolve another zod release than the one the parses were made with (a range bump, dedupe with a project's zod, an override). The CLI then served the stored parse anyway, so a valid doc's answer could differ from what parsing it gives under the installed zod (key order, defaults, transforms). The per-user kept parses already key on the installed zod release; the stored parses did not.

Problem and solution fit

  • Why can the answer differ? A stored parse is the output of one zod release, served to every install.
  • Why does it matter? Docs commands promise the parse of the doc; a stale parse prints different JSON or text than a fresh one for the same file.
  • Why does the fix close it? A stored parse is now stored under the zod release that made it, and read only when the doc parsers load that same release. Any other release misses the store and parses the doc, exactly as an unshipped doc is parsed today (and the result is then kept per user, keyed by that release, as before).

Expected behavior and authority

A stored parse is "what parsing the doc gives" (stored-docs.mjs, generate-stored-docs.mjs); the kept parses already hold that rule across zod releases. No record states the stored parses' conditions, so no record changes.

Smallest restoration

  • storedParseKey(key, name, zod): the store key names the zod version.
  • storedParse reads the zod version once per run (the same cached read the kept parses use) and returns nothing when it cannot be read.
  • The generator stores parses under the zod version it loads, and stores none when it cannot read it.

No new public API (the touched module is internal), no output change for an install that resolves the publish-time zod release.

Evidence

  • Reproduction before the change: with the store key not naming zod, a run whose parsers load another zod release reads the stored parse (the new test fails: expected +0 to be 1 doc parses).
  • Result after the change: another zod release → one parse, output byte-equal to a fresh parseDoc; the matching release → zero parses, the same output.
  • Representative unchanged path: the existing stored-parse and kept-parse tests pass unchanged apart from the key's new argument.
  • Packed comparison (both packages packed with every prepack file, unpacked to sibling folders of equal path length, CI=1, median of 15 alternating runs, two rounds), base vs this change, ms:
command first run warm
docs principles --dense 565 / 560, 576 / 590 459 / 472, 498 / 502
docs 534 / 547, 655 / 653 447 / 454, 525 / 514
docs tokens --dense 786 / 775, 646 / 643 561 / 544, 526 / 520

Differences are within run-to-run noise and change sign between rounds; outputs are identical.

Scope

Components: CLI doc compiler (stored docs)

  • 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

  • CI=1 pnpm vitest run --project node packages/cli/foundation/doc-compiler packages/cli/foundation/fs packages/cli/test/packed-stored-docs.test.mjs packages/cli/test/packed-gather-cache.doc-parses.test.mjs packages/cli/test/lazy-dependencies.test.mjs
  • pnpm -F @astryxdesign/cli typecheck (no new errors), prettier, pnpm check:changesets, pnpm review:pre (0 findings)

@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 17, 2026 9:21pm 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
@josephfarina
josephfarina marked this pull request as ready for review November 17, 2026 21:04
@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 17, 2026, 9:25 PM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 0ad42f7

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@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: its run stopped because CI was full, so it needs a re-run, and its required checks still need to pass.

The stored doc parses are now keyed by the zod release that made them, and the CLI reads one only when it loads that same release. The new two-release test fails when the key leaves the release out and passes with it, and the existing stored-parse and kept-parse tests still pass.

Claims and files checked

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

  • Changeset: a stored parse is used only with the zod release that made it, and another release parses the doc, so the answer matches a fresh parse: verified (storedParse, storedDocsText, new test).
  • The CLI ships its own docs already parsed and depends on zod by a range: verified (generate-stored-docs.mjs, the zod dependency in packages/cli/package.json).
  • Before this change, an install on another zod release was served the stored parse: verified (the new test fails with the old key, 0 parses instead of 1).
  • The per-user kept parses already key on the zod release: verified (keptParse).
  • The store key now names the zod release: verified (storedParseKey).
  • The reader reads the release once per run and skips the store when it cannot read it: verified (storedParse, docParserZodVersion).
  • The generator stores parses under the release it loads, and none when it cannot read it: verified (storedDocsText).
  • No new public API: verified (the module is not reachable through the package exports).
  • No output change for an install on the publish-time release: verified (that case parses nothing and prints the same).
  • Another release parses once with output equal to a fresh parse, and the matching release parses nothing: verified (new test).
  • The existing stored-parse and kept-parse tests pass with only the key's new argument: verified.
  • The timing table shows no material difference: consistent; the common path adds one cached manifest read of about a millisecond (not re-timed end to end).
  • Typecheck adds no new errors, and formatting, the changeset check and the pre-review report pass: verified.
  • One defect, no tagalong, and no internal context in public text: verified.
  • .changeset/stored-parses-zod-release.md: clear.
  • packages/cli/foundation/doc-compiler/stored-docs.mjs: clear.
  • packages/cli/foundation/doc-compiler/stored-docs.test.mjs: clear.
  • packages/cli/scripts/generate-stored-docs.mjs: clear.

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 18, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12252 docs(cli): agent docs name the prop names that differ from other libraries
  Author: Joey Farina <[email protected]>
- #12154 fix(core): a numeric typography weight builds through an extended base's adaptation rules
  Author: Joey <[email protected]>
- #12092 fix(cli): theme build reads the Core it builds with for variant declarations, and names the build command alone
  Author: Joey Farina <[email protected]>
- #12316 fix(core): a shorthand never follows its own longhand in one style merge
  Author: josephfarina <[email protected]>
- #12357 fix(core): a Table stays the scroll region when a host scrolls every table's parent
  Author: Joey Farina <[email protected]>
- #12349 fix(core): end a mouse drag a sandboxed frame never saw released
  Author: josephfarina <[email protected]>
- #12425 fix(cli): use a stored doc parse only with the zod release that made it
  Author: Joey <[email protected]>
- #12396 fix(AppShell): with the standard width points, a server-rendered shell hides its inline side nav on a phone before its script runs
  Author: Joey <[email protected]>
- #12438 fix(charts): end dots draw whole and a thinned axis keeps its last label
  Author: Joey Farina <[email protected]>
- #12448 fix(cli): upgrade outside a project names the project, not --from
  Author: Joey Farina <[email protected]>
- #12459 fix(templates): the dashboard scorecard fits a phone screen
  Author: Joey Farina <[email protected]>
- #12428 fix(core): Field labels draw in a bolder face than their description
  Author: Joey Farina <[email protected]>
- #12435 fix(theme-matcha): dark menus, popovers and muted fills take the theme's deep gray neutral
  Author: Joey <[email protected]>
- #12432 fix(templates): dashboard chart labels show whole instead of clipped by the chart edge
  Author: Joey Farina <[email protected]>
- #12441 fix(cli): mark icon-set generated calls pure so apps drop unused icons
  Author: Joey Farina <[email protected]>
- #12472 fix(MetadataListItem): a value breaks only a word longer than its line
  Author: Joey <[email protected]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12718.

@github-actions
github-actions Bot deleted the fix/stored-parse-zod-release-match branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 0ad42f72 Deployed Nov 17, 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