Skip to content

sandbox(motion-lab): the motion audit is written formatted, checkable, and regenerated - #8831

Draft
vjeux wants to merge 2 commits into
meta:mainfrom
vjeux:sandbox/motion-audit-formatted
Draft

vjeux wants to merge 2 commits into
meta:mainfrom
vjeux:sandbox/motion-audit-formatted

Conversation

@vjeux

@vjeux vjeux commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review only this PR's change: vjeux/astryx@84e8552...230185f

Why

Every Sandbox build runs the Motion Lab's audit generator, and the generator wrote its file unformatted while the checked-in copy is formatted. So each build left about 1,650 changed lines in the working tree (+243/−1,413) even when no count had changed, and anyone building the Sandbox had to discard them. The checked-in numbers were also stale: the file was last regenerated on Oct 26 (#8620), and core and lab have changed since.

What led to it

Running Sandbox builds left this file changed every time. Formatting it with Prettier gave exactly what the generator had written, so the churn was formatting alone; the real count changes were on top of that.

Options and tradeoffs

  • Regenerate the file only: current numbers today, but the next build dirties the tree again.
  • Stop checking the file in and generate it at build time: the lab's TypeScript modules import it, so typecheck and editors need it on disk.
  • Format what the generator writes, regenerate, and add a check (this pull request).

Why this choice

The generator now formats its output with the repository's Prettier config, as scripts/generate-cldr-weekdays.mjs does, so a run whose counts are current changes nothing. check:motion-audit (--check) fails when the checked-in file is not what a run would write. The walk skips Core's generated locale modules, so the check passes in an install without scripts, and the Sandbox declares prettier.

The check is not part of the required checks: the audit measures core and lab sources, so requiring it would make every motion change in core or lab regenerate a Sandbox file and conflict with the others. The Sandbox build regenerates the file before building, so the published lab is current either way.

How to check it

  1. pnpm -F @astryxdesign/sandbox check:motion-audit: on main it fails ("is not what a run writes now"); here it passes.
  2. pnpm -F @astryxdesign/sandbox generate:motion-audit, twice: here the tree stays clean; on main one run changes about 1,650 lines.
  3. Format main's generator output with Prettier: it equals the formatted file, so nothing but formatting separated them.

Evidence

Counts that moved since Oct 26: getComputedStyle reads 85 → 112, setTimeout literals 1 → 3, files with reduced motion 52 → 55, animated files 96 → 99, files scanned 917 → 910, durations without a curve 12 → 13; several sites moved lines.

…, and regenerated

The generator wrote its output unformatted (quoted keys, one-line arrays) while the checked-in file was formatted, so every Sandbox build, which runs it, left 1,600 changed lines in the tree even when no count had changed. It now formats what it writes with the repository's Prettier config, so a run whose counts are current changes nothing, and `check:motion-audit` (`--check`) fails when the checked-in file is not what a run would write. The audit is regenerated: it was last written on Oct 26 (meta#8620), and core and lab have changed since (getComputedStyle reads 85 to 112, setTimeout literals 1 to 3, files with reduced motion 52 to 55, among others).
@vercel

vercel Bot commented Oct 28, 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 29, 2026 12:35am UTC

Request Review

@vjeux
vjeux requested a review from josephfarina as a code owner October 28, 2026 20:31
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 28, 2026
@astracat-bot

astracat-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 29, 2026, 12:52 AM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues: the generator now writes the formatted file, check:motion-audit passes on this head, and the regenerated audit is exactly what the previous generator produces for the same sources once formatted. Two optional follow-ups:

  • Declare prettier (catalog:) in apps/sandbox/package.json, since the Sandbox build now imports it and the workspace expects each package to declare its imports.
  • filesScanned counts the 31 gitignored locale modules that pnpm install generates, so the check fails in a checkout installed without scripts; skipping generated-locales in the walk would remove that dependence.

[Automated review]

import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';
import {format, resolveConfig} from 'prettier';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: @astryxdesign/sandbox doesn't declare prettier, so this import resolves only through the workspace root's devDependency. Since the generator now runs in every Sandbox dev and build, consider adding "prettier": "catalog:" to the Sandbox devDependencies, as pnpm-workspace.yaml asks of every consumer and apps/docsite does.

labComponentDirs: 22,
hardcodedInLab: 10,
filesScanned: 917,
filesScanned: 941,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: 941 includes the 31 gitignored packages/core/src/i18n/generated-locales/*.generated.ts modules that pnpm install writes through the root prepare script. Without them a run writes 910, so check:motion-audit fails in a checkout installed with scripts disabled. If the check shouldn't depend on install scripts, adding generated-locales to SKIP_DIRS and regenerating would remove that dependence.

… and the Sandbox declares prettier (meta#8831)

The audit walked packages/core/src/i18n/generated-locales, 31 modules that pnpm install writes and git ignores, so `filesScanned` depended on how the checkout was installed and `check:motion-audit` failed in a checkout installed without scripts. The walk skips that directory now, and the audit is regenerated (files scanned 941 to 910, no other count moves). The generator imports prettier, which the Sandbox did not declare and resolved only through the root's install; it is declared as `catalog:`, as the root declares it. Red first: the check failed on 3f2f8dc with the generated locales moved aside, and passes here with and without them.
@vjeux

vjeux commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Both done in 230185f: the audit's walk skips packages/core/src/i18n/generated-locales, so check:motion-audit passes in a checkout installed without scripts (it failed on 3f2f8dc with those modules absent; files scanned 941 → 910, no other count moves).
apps/sandbox/package.json declares prettier as catalog:, as the root does; the lockfile change is the Sandbox importer's entry alone.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues: the generator writes the formatted file, check:motion-audit passes on this head with and without the generated locale modules, and the regenerated audit is exactly what the previous generator produces for the same tracked sources once formatted. Both earlier suggestions are addressed: the Sandbox declares prettier, and the walk skips generated-locales. Optionally, refresh the description: its Evidence still lists files scanned 917 → 941 and its first line links a compare that stops at the first commit, while the file now records 910.

[Automated review]

@vjeux
vjeux marked this pull request as draft October 29, 2026 22:40

This branch was successfully deployed

1 active deployment
Preview — 230185fa Deployed Oct 29, 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