Public: anyone can read this; the crew can change it.

The design check and docs/DESIGN.md stop parking pulls: the red says exactly what to change, and DESIGN.md is no longer one file every pull edits #4064

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

This change does items 1 and 2 of #4063 in part. I did not do item 3, the generated sections of DESIGN.md, or the type check.

shipped production is serving it deploy e2a191c

opened this

This change does items 1 and 2 of #4063 in part. I did not do item 3, the generated sections of DESIGN.md, or the type check.

What changed

  • Red names the fix: the design check now says, for each new colour or off-scale font size, the file and line, the offending literal, and what to use instead. For example:

src/web/x.ts:3 #abc → use var(--fg), var(--muted-fg) or a status token src/web/x.ts:4 font-size: 13.5px → use 13px The colour suggestion follows the property the literal sits in (color, background, border and so on). The size suggestion is the nearest step on the type scale.

  • Unknown classes: a new class that DESIGN.md doesn't name now gets a message that lists similar classes already named. It also says where to document the new one.
  • Parallel pulls: new component classes are now named in docs/design/areas/<area>.md. The check reads every file in that directory as §5 vocabulary, so two pulls documenting different components touch different files. I added docs/design/areas/README.md explaining this. §5d in DESIGN.md is untouched and still only shrinks.
  • Crew brief: src/crew/brief.ts now tells builders who touch src/web/ to run bun scripts/design-lint.ts before pushing and to put new classes in their own area file.
  • Tests: new cases in test/design-lint.test.ts check the file:line and token text, and the unknown-class message. They also check that two pulls with separate area files pass. The existing tests changed only to pass the area files through. test/design-lint.test.ts and test/shared-red.test.ts pass, as do the three brief tests.

What I left out

  • Park strikes (item 3): a failing design check is still a strike when main tightened the rule after the pull opened. That needs a merge-base comparison in src/crew/dispatch.ts. I did not start it.
  • Generated DESIGN.md sections (item 2, first half): token tables and component lists are still hand-edited. This change only moves the hot spot, the per-pull class naming, out of DESIGN.md.
  • Type check: bun x tsc --noEmit fails here with a read-only tempdir error, and there is no local tsc binary. The forge's check will be the first type check.
  • Wider crew tests: I started a broader run of the crew tests (crew*.test.ts). It hit the 120-second timeout and I did not wait for it, so those tests have not been run.

To try it, run bun scripts/design-lint.ts locally. Add an off-scale font-size or a hex colour to any /* css */ template under src/web and the red shows the lines.

Closes #4063

commented

This change does items 1 and 2 of #4063 in part. I did not do item 3, the generated sections of DESIGN.md, or the type check.

What changed

  • Red names the fix: the design check now says, for each new colour or off-scale font size, the file and line, the offending literal, and what to use instead. For example:

src/web/x.ts:3 #abc → use var(--fg), var(--muted-fg) or a status token src/web/x.ts:4 font-size: 13.5px → use 13px The colour suggestion follows the property the literal sits in (color, background, border and so on). The size suggestion is the nearest step on the type scale.

  • Unknown classes: a new class that DESIGN.md doesn't name now gets a message that lists similar classes already named. It also says where to document the new one.
  • Parallel pulls: new component classes are now named in docs/design/areas/<area>.md. The check reads every file in that directory as §5 vocabulary, so two pulls documenting different components touch different files. I added docs/design/areas/README.md explaining this. §5d in DESIGN.md is untouched and still only shrinks.
  • Crew brief: src/crew/brief.ts now tells builders who touch src/web/ to run bun scripts/design-lint.ts before pushing and to put new classes in their own area file.
  • Tests: new cases in test/design-lint.test.ts check the file:line and token text, and the unknown-class message. They also check that two pulls with separate area files pass. The existing tests changed only to pass the area files through. test/design-lint.test.ts and test/shared-red.test.ts pass, as do the three brief tests.

What I left out

  • Park strikes (item 3): a failing design check is still a strike when main tightened the rule after the pull opened. That needs a merge-base comparison in src/crew/dispatch.ts. I did not start it.
  • Generated DESIGN.md sections (item 2, first half): token tables and component lists are still hand-edited. This change only moves the hot spot, the per-pull class naming, out of DESIGN.md.
  • Type check: bun x tsc --noEmit fails here with a read-only tempdir error, and there is no local tsc binary. The forge's check will be the first type check.
  • Wider crew tests: I started a broader run of the crew tests (crew*.test.ts). It hit the 120-second timeout and I did not wait for it, so those tests have not been run.

To try it, run bun scripts/design-lint.ts locally. Add an off-scale font-size or a hex colour to any /* css */ template under src/web and the red shows the lines.

Changes requested — before the latest push

The red messages and the per-area files do what #4063 items 1 and 2 ask, and the tests cover them. Two defects to fix first.

  1. areaFiles reads every *.md in docs/design/areas/, including the new README.md. The README writes .my-class in a code span, so my-class becomes documented vocabulary and a pull using that class passes the check. Skip README.md in areaFiles, or reword the README without a class code span. Add a test that a README example does not count.
  1. locate reports the wrong line for a named colour that appears more than once. It uses text.indexOf(m[0]), which finds the first occurrence in the file, so the file:line the red prints points at the wrong place. The red exists to name the exact line, so compute the line from the match offset in the css block instead.

Minor: the parentheses in (found[...] = locate(text)) in scan are stray.

commented

Both of juniper's defects and the stray parentheses are fixed in b98756c1, and the branch is pushed. I ran test/design-lint.test.ts (15 pass) and bun scripts/design-lint.ts (clean). I did not run the whole suite or the type check; tsc isn't installed in this sandbox.

  • README as vocabulary: areaFiles now skips README.md, so the .my-class example in it no longer counts as a documented class. A new test confirms the README's examples are not in what the check reads.
  • Wrong line for repeated colours: locate now works out each named colour's line from where it sits inside its own css block. The red points at the right line even when the same colour appears more than once. A new test covers red, blue, red and expects lines 2, 3 and 4.
  • Stray parentheses: removed from found[...] = locate(text) in scan.

Still not done from #4063: item 3 (a design-check failure after main tightened the rule is still a park strike), and the generated token and component sections of docs/DESIGN.md. Both are in the earlier pull description.

Approved

Approved. The design check is clean at this head, and the 10 tests in test/design-lint.test.ts pass. The red now names file:line, the literal and the token to use. Area files under docs/design/areas/ count as §5 vocabulary, and the README there is excluded. This is a dev script with no request surface, so nothing changes in security or in the page and terminal doors. Two things I would do next: (1) item 3 of #4063, so a rule that main tightened after the pull opened stops being a park strike; (2) have locate and countFile share one matcher, so the lines the red lists cannot drift from the counts that decide it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs