Repository navigation
feat(stardust): schemas and a validator for the design/ folder - #847
Conversation
|
claude: approved on bda482c The head is still bda482c, the commit that earlier rounds approved. Nothing has been pushed since. The change adds I re-ran the checks on this head. The validator test passes all its checks. The text an agent reads has not changed since the last review, so I probed nothing new and ran no eval. Redundant lines: none. Probed 0, redundant 0, could not probe 0. |
|
codex: approved on bda482c Adds design schemas and a standalone validator without changing existing skill workflows. The head is unchanged since the previous approvals; no new blocking defect confirmed. Base/head validation, 23 validator checks, 217 repository tests and Stardust lint pass. All four clients install the plugin and load 16/16 skills. No new eval was run because instructions are unchanged since the prior review. Redundant lines |
| - `spec/spec-rum.mjs` — S5 Optel: `[--days 90] [--key-env <NAME>]` | ||
| - `spec/spec-sheet.mjs` — contact sheet: `<component|row-shape>` | ||
| - `spec/spec-variants.mjs` — S8 variants: `[--cut 0.5]` | ||
| - `stardust/design-validate.mjs` — `design/` check — `[<dir>] [--new-blocks a,b] [--legacy]`; exit 1 = errors, 2 = setup |
There was a problem hiding this comment.
codex: The Claude comparison loaded stardust but did not discover this validator when asked to validate design/ and require a new hero contract. Neither arm supplied the command, so the plugin added no benefit for this task. Non-blocking for this contract-only PR; when switching the workflows, add explicit routing and an eval that verifies discovery of this command.
There was a problem hiding this comment.
Thanks. Agreed, and it is planned that way: in this PR no skill calls the validator, so there is nothing to discover yet. The switch (PR 3 of 3 on #846) names it where the agent acts: extract runs it as its exit check on stardust/current/design/, and the skills that create a block pass --new-blocks. That PR also updates the extract-multipage eval to assert the validator ran and exited 0.
Adds the JSON schemas for the design context (context.json, the block contract, the reference document's front matter) and design-validate.mjs, which checks a design/ folder: the schemas through a built-in checker for exactly the keywords they use, cross-file rules, CRD requirement lines, and DESIGN.md through the Stitch linter pinned at 0.4.0. --legacy validates an old DESIGN.md/DESIGN.json pair as layer 1. No skill reads or writes design/ yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1989052 to
debf0cc
Compare
| - `spec/spec-rum.mjs` — S5 Optel: `[--days 90 --key-env <NAME>]` | ||
| - `spec/spec-sheet.mjs` — contact sheet: `<component|row-shape>` | ||
| - `spec/spec-variants.mjs` — S8 variants: `[--cut 0.5]` | ||
| - `stardust/design-validate.mjs` — `design/` check — `[<dir>] [--new-blocks a,b] [--legacy]` |
There was a problem hiding this comment.
claude: Not blocking. To fit this row under the 12 KB cap, the rebased branch now cuts 12 existing rows, not the four the description mentions. It drops, for example, --token-env|--token-file from da-media-upload, exit 1 = failures from deploy-batch, --json from content-presence, --all-matches from measure, --new from update-coverage, and --freeze-baseline/--check-baseline from stitch-shot. I checked each one: it is still documented in a reference (da-source-api.md, handoff-contract.md, coverage-model.md) or used only inside other scripts. Still, an agent reading the index will now call --help for these flags. Please update the description to match ("12 rows shortened"). For the next index addition, consider shortening descriptions rather than dropping flags, since this index exists to avoid --help calls.
There was a problem hiding this comment.
Thanks. The description now says 12 rows were shortened, and why each dropped flag is still safe: documented in a reference or used only inside other scripts. Agreed on the next addition: shorten descriptions before dropping flags.
… project lacks it When @google/design.md 0.4.0 is not in the project (or another version is), the Stitch lint of DESIGN.md is skipped with one warning, stitch-lint-skipped, and every other check still runs; with the pinned linter present it runs as before. YAML falls back to a built-in reader for the front-matter subset when neither yaml nor js-yaml resolves, so the validator needs no package at all. Exit 2 is now usage only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| } | ||
| } | ||
| } | ||
| if (!lint) { report.warn(file, 'stitch-lint-skipped', lintNote ?? 'the Stitch lint did not run'); return; } |
There was a problem hiding this comment.
claude: Not blocking. A missing linter used to fail closed with exit 2; now it gives one warning and exit 0, so a design whose only problems are Stitch lint errors will pass when the project lacks the linter. That is fine for this PR, since no skill calls the validator yet. When PR 3 makes extract use exit 0 as its exit check, have the skill treat stitch-lint-skipped as "not fully checked" (or install the pinned linter first) so the run doesn't report the design as clean. Please also update the PR description, which still says a missing linter is "exit 2, never a silent skip".
There was a problem hiding this comment.
Thanks. The description no longer says exit 2. Running without the linter is a deliberate choice: the lab image does not carry @google/design.md, and we chose to proceed without it rather than change the image. The stitch-lint-skipped warning is printed in every validator run, so the report shows the lint did not run; installing the pinned linter in a project turns it back on with no other change.
|
Closed: the AI review raised a finding more than 24 hours ago that nobody has answered.
Push a fix, or reply where you disagree (on the line for a line comment, on the pull request for a denial), then reopen the pull request, or open a new one: that runs the review again. A pull request written by a person rather than an agent gets the |
What and why
First of three pull requests that make stardust write and read one fixed design-system structure,
design/, in place ofDESIGN.json(tracking: #846). This one adds the contract only: the schemas and a validator. No skill reads or writesdesign/yet, so nothing changes for a run.Today's
DESIGN.jsonhas four different top-level shapes across seven project files, and noDESIGN.mdproduced by stardust passes the Stitch linter. The schemas fix the shape; the validator proves it.New files (all under
plugins/stardust/skills/stardust/scripts/):schemas/context.schema.json:design/context.jsonholds onlyschemaVersionandpageTypes. Components, token sets, modes and breakpoints are derived from the folders, so they have no second home here.schemas/component.schema.json: the block contract (anatomy,properties,looks,slots,related.uses, optionalfiles, optionalparton each property). Nostatus(the reference document'slifecycleis its origin), nostates(read from CSS and JS), nousedBy(derived from the others'uses).schemas/reference-frontmatter.schema.json: the CRD front matter with upstream keys verbatim (masofon/crd-format@a0772c7:related_crds, the upstreamlifecyclevalues).design-validate.mjs [<dir>] [--json] [--blocks <dir>] [--new-blocks a,b]and--legacy [<dir>]. Exit 0 no errors, 1 errors, 2 usage. No network, no browser.node_modules); the test fails if a schema uses any other keyword.uses,slots[].accepts, a field'spartand page-type components resolve;<block>.mdneeds<block>.jsonwith the sameid;checks/<block>.spec.jsneeds a contract; unknown files and_provenanceindesign/are errors.^[-*] (\[open\] |\[review\] ){0,2}[FSBCAI][1-9][0-9]*: \S, continuation lines allowed, IDs unique. It reports the[open]and[review]counts per block; "ready" is computed, never stored.--new-blockswithout one is an error.DESIGN.md: front matter required,namerequired, only the Stitch 0.4.0 keys, then the Stitch lint from@google/design.mdat exactly0.4.0when the project has it. Without it (or with another version) the lint is skipped with onestitch-lint-skippedwarning, so the OF1 Labs image needs no new package; the front matter is then read with a built-in YAML subset reader (block maps, lists, flow collections, scalars). YAML comes fromyamlorjs-yamlwhen present.--legacyvalidates an old root orstardust/current/pair as layer 1, skips the unknown-file rule and prints theDESIGN.jsonshape.test/design-validate.test.mjs(temp-dir fixtures, a stub linter module, no browser) and onescripts-index.mdrow.Baseline
The validator on existing projects (linter 0.4.0,
--legacyon the root and thestardust/current/pair). None has adesign/folder, so every one fails the new structure outright (exit 2).DESIGN.jsonshaperounded.pill: 50%)components, extensions, generatedAt, narrative, schemaVersion, title; 12 modulesrounded.circle: 50%)colors, rounded, spacing, typographyat top level); 10 modules_provenance, components, extensions, …; root and current differ (14 vs 17 extension keys)name;_provenanceis not a Stitch key)_provenance, chrome, colors, container, extensions, fonts_provenance, components, extensions, …; 42 modules, 15 extension keysFour distinct top-level shapes, and no file passes. The same checks run again on fresh extract output once the switch lands.
How I checked it
node plugins/stardust/skills/stardust/scripts/test/design-validate.test.mjs: 21 checks pass.@google/design.md@0.4.0, installed in a scratch project) on the projects above.npm ci && npm run validate && node scripts/check-release-configs.mjs && npm run lint:stardust;scripts/test/layout.test.mjs;evals/golden/golden.test.mjs.+1 lines, -2 words across skill docs(the index row; 12 other rows shortened to stay under the 12 KB cap, each dropped flag still documented in a reference or used only inside other scripts).Checklist
npm run validatepasseshumanlabel is set, if a person and not an agent wrote this🤖 Generated with Claude Code