Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit f7fcc2c

Browse files
os-justinclaude
andauthored
fix(components): pin source(none) on the root stylesheet entry so prose stops compiling into the published sheet (#9579)
Fixes #9569 `packages/components/src/index.css` opened with a bare `@import 'tailwindcss';` — the only one of this repo's four stylesheet entries without a `source(none)` pin. It now reads `@import 'tailwindcss' source(none);`, keeping the FULL Tailwind import because this is the root sheet: preflight, the `@theme` block and the base layer still emit exactly as before. ## The card's mechanism sentence is falsified, and the PM had already measured it The card asks for "the `source(none)` pin its three siblings carry (`@import 'tailwindcss' source(none);` … mirroring `fields`)". The siblings carry no such thing. `packages/fields/src/index.css` states verbatim *"This file has no `@import 'tailwindcss'` on purpose"*; what `fields`, `plugin-grid` and `plugin-kanban` carry is `@reference` on components' entry plus a utilities-only `@import 'tailwindcss/utilities.css' layer(utilities) source(none);`. Mirroring them literally would have dropped preflight and the shared theme from the only sheet that ships them. The PM seat flagged this before dispatch and the landed spelling is the one it proposed; I verified it is legal Tailwind v4 and that preflight and the theme survive it. ## Three things measured rather than assumed **1. The `@source` lines actually fire.** This was the highest-risk failure mode: once detection is off, those lines are the only thing keeping the sheet non-empty, and a near-empty sheet builds just as green as a correct one. `packages/runner/src/index.css` records five `@source` lines that were each wrong by one `src` segment and contributed nothing. Two legs, both restoring from `HEAD` with the restore proven by blob hash: - *Ablation* — deleting `@source '../src/**/*.{ts,tsx}'` collapses the compilation from 158,345 bytes / 1289 classes to 9,694 bytes / 4 classes. The line is load-bearing. - *Absolute-path probe* — rewriting all three `@source` paths to absolute and moving the compile base to the package root produces a **byte-identical** sheet. So the relative spelling lands exactly on `packages/components/src`, and `base` governs only the automatic root, never the `@source` lines. **2. Detection roots at the PROCESS CWD, not at `packages/components/`.** The card says the latter; `fields` and `runner` say the former, and they are right. Same commit, same command: 1312 classes / 161,225 bytes with the cwd at the package, 3303 classes / 439,726 bytes from the repo root. After the pin the compiled sheet is byte-identical from either directory, which it was not before. **3. Class census re-derived, not quoted.** 1312 → 1289, so exactly 23 leave, and each one traces to a prose file: 12 to `CHANGELOG.md`, 3 to `README.md`, 2 to `README_SHADCN_SYNC.md`, 4 to the JSON examples in the renderer docs, 1 to `shadcn-components.json`, and `invert` to an ordinary English word inside a comment in `tsconfig.test.json`. **Zero of the 23 is emitted by any shipped source under `packages/components/src`**, checked with a matcher that respects Tailwind candidate boundaries — a substring grep scores `disabled:cursor-not-allowed` as a hit for `cursor-not-allowed`, which is a different candidate producing a different rule — and run with three lit positive controls (`bg-background`, `text-muted-foreground`, `w-full` are found in 25, 59 and 59 shipped files). ## MUST_SURVIVE, both legs, on both kinds of injection Reproducing what `changeset:version` does — appending the changeset body line to `packages/components/CHANGELOG.md` — then running each plugin's own builder with `write: false` against the components sheet compiled from the entry as it stands on each leg: | injection | leg | components sheet | plugin-kanban | |---|---|---|---| | `text-muted-foreground/60` (not in MUST_SURVIVE) | BEFORE | 1313 classes, has it | BUILD_OK — and the class is **stripped** from kanban's sheet | | `text-muted-foreground/60` | AFTER | 1289, absent | BUILD_OK, class **survives** | | `bg-card/60` (in MUST_SURVIVE) | BEFORE | 1313, has it | **BUILD_THREW** — `The subtraction removed 1 utility(ies) that only this build can produce: .bg-card/60` | | `bg-card/60` | AFTER | 1289, absent | BUILD_OK, class survives | All six MUST_SURVIVE entries pass for `plugin-kanban`, `plugin-grid` and `fields` on the AFTER leg. ## Beyond the card: this is already breaking three published packages today Running the same harness with a **non-Tailwind** injection isolates the fix from the injection, and the plugin sheets still change — the prose contamination is stripping classes from sibling published artifacts on `main` right now, with no `changeset:version` needed. Restored by this PR: - `@object-ui/plugin-kanban` — `h-[600px]`, `sm:px-6`, `sm:py-4` - `@object-ui/plugin-grid` — `bg-blue-50`, `cursor-not-allowed` - `@object-ui/fields` — `bg-blue-50`, `bg-blue-500`, `bg-gray-50`, `text-white` Each is emitted by that package's own shipped source (`KanbanImpl.tsx` spells `px-4 sm:px-6`, `FormulaBar.tsx` spells `cursor-not-allowed`, `ImageLightbox.tsx` spells `text-white`), and each was being subtracted out because components' prose-polluted sheet happened to contain it. That is why the changeset names four packages, not one. ## Deviations from the card, all measurement-driven 1. **`minor`, not `patch`.** Removing utilities from a published stylesheet contracts a published artifact. This repo forbids `major` outside the `@objectstack` major-sync release and ships its own breaking changes as `minor` with the break spelled out, which is what the changeset body does. 2. **Four packages named, not one.** The three siblings' published sheets change too, measured above. 3. **The `@source` pin test needed repairing, and gained a leg.** Its docblock asserted the entry "opens with a bare `@import 'tailwindcss'`, so automatic source detection is ON" — a claim this branch falsifies, and it also had `base` backwards. Corrected, and a second test now pins the prose door shut: it asserts `.flex-shrink-0` is absent from the compiled sheet behind a lit control asserting `CHANGELOG.md` still names it. Reverting the entry to its bare import turns that test red (vitest exit 1); it passes on the fix. 4. **One ledger entry.** The new test reads a markdown file, so `scripts/markdown-test-inputs.mjs` needs a verdict for it. Adjudicated with what it reads and what the scanner offered that it does not. `flex-shrink-0` is worth a second look: it is a deprecated Tailwind v3 alias this repo deliberately migrated away from, and it was shipping in the published bundle **solely because the changelog entry announcing that migration names it**. Same for `w-[--sidebar-width]` and the `origin-[--radix-` pair — the changelog entry recording the move to v4 syntax quotes the old spelling, and that quote recreated the v3 classes. ## `changeset-release.yml` One sentence, next to the claim it qualifies. `THE VERSION STEP CANNOT MOVE A SOURCE BYTE` is the design note that made this defect invisible from the release lane: a generated `CHANGELOG.md` is a Tailwind source input, which is exactly how a changeset body reached `dist/index.css`. ## Gates Derived by hand from this repo's own `package.json` and `.github/workflows/`, ⛔ not from the dispatch prompt. `scripts/pm/dispatch-gates.mjs` lives only in `objectstack` and **refuses** to answer for this repo — asserted with `--repo objectstack-ai/objectui`, exit 2: *"Gate families are derived from the workflows and check scripts of the tree this process runs in."* | gate | exit | |---|---| | `check-changeset-presence` | 0 | | `check-changeset-no-major` | 0 | | `check-changeset-fixed` | 0 | | `check-changeset-claims` (report-only) | 0 | | `check-control-bytes` | 0 | | `check-new-cross-file-line-citations` | 0 — 0 new citations | | `check-lint-coverage` | 0 — 46/46 packages, 0 errors | | `eslint --no-inline-config` on the changed files | 0 | | `check-governed-queue-guard --self-test` | 0 | | build of the dependency closure | 0 | | `@object-ui/components` `type-check` | 0 | | `vitest run packages/components/` | 0 — 276 files, 2699 tests | | `vitest run scripts/__tests__` | 0 — 164 files, 4779 tests | NOT MEASURED, with reasons, ⛔ not read as green: `check-governed-queue-guard` (exit 1, needs `GITHUB_EVENT_PATH`; it refuses to exit 0 when it cannot look), `check-required-check-set` (exit 2, HTTP 401 on the branch-rules API), `check-merge-queue-head` (exit 2, `GITHUB_REPOSITORY` unset). All three are CI-credentialed patrols, and none reads a path in this diff. This diff touches **no governed surface** — classified against the guard's own `GOVERNED_SURFACES` export with three lit controls (`AGENTS.md`, `docs/adr/…`, `skills/…` all classify correctly). ## Acceptance notes - `objectui#8455` covers `packages/runner/src/index.css`, which carries the same bare import: its census names that row explicitly as **published**, and its shape C is a repo-wide gate over exactly this. It genuinely covers it, so this PR does not widen to runner and no duplicate card was filed. Its shape A is this card, and it predicted the removal at 23 rules including `.flex-shrink-0` — which is what was measured here. - Noted, not filed: `objectui#9569`'s own body cites `plugin-published-stylesheet.test.ts:196/:252` and `KanbanImpl.tsx:492`, cross-file line addresses of the form this repo's `#11` bans. An issue body is not a carrier that rule names, and nothing re-reads it. Successor: none. - Noted, not filed: `packages/components/src/index.css` spells its scan `@source '../src/**'` where the three siblings spell `'./**'`. Both resolve to the same directory, proven byte-identically above, so this is cosmetic drift, not a defect. Successor: whoever implements `objectui#8455`'s repo-wide gate. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XeoGH6X7MtfbjcRDscyXi1 --- _Generated by [Claude Code](https://claude.ai/code/session_01XeoGH6X7MtfbjcRDscyXi1)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4a94c38 commit f7fcc2c

5 files changed

Lines changed: 190 additions & 10 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
'@object-ui/components': minor
3+
'@object-ui/fields': minor
4+
'@object-ui/plugin-grid': minor
5+
'@object-ui/plugin-kanban': minor
6+
---
7+
8+
fix(components): Tailwind no longer compiles this package's prose into the published stylesheet
9+
10+
`@object-ui/components`' Tailwind entry opened with a bare `@import 'tailwindcss'`
11+
— the only one of this repository's four stylesheet entries without a
12+
`source(none)` pin. Tailwind v4's automatic source detection was therefore ON,
13+
and it roots at the PROCESS working directory, so it scanned every non-ignored
14+
file in the package: `CHANGELOG.md`, `README.md`, the markdown beside the
15+
renderers, `shadcn-components.json`, even an English sentence in a comment inside
16+
`tsconfig.test.json`. Every class-shaped token in that prose compiled into a real
17+
rule in the published `dist/index.css`.
18+
19+
The entry now reads `@import 'tailwindcss' source(none);`. It keeps the FULL
20+
Tailwind import, because this is the root sheet: preflight, the `@theme` block
21+
and the base layer are emitted exactly as before. Only automatic detection is
22+
off, so the entry's own `@source` lines are the whole input set — and the
23+
compiled sheet is now byte-identical whatever directory the build is launched
24+
from, which it previously was not.
25+
26+
## Breaking: 23 prose-derived utilities leave `@object-ui/components/style.css`
27+
28+
None of these is emitted by any component under this package's `src`; each one
29+
existed solely because some prose in the package mentioned it. Grouped by the
30+
file that was creating it:
31+
32+
- from `CHANGELOG.md` — `cursor-not-allowed`, `flex-shrink-0`, `lg:p-8`,
33+
`md:text-2xl`, `origin-[--radix-...]`, `pb-20`, `scale-0`, `sm:px-6`,
34+
`sm:py-4`, `space-y-8`, `w-[--sidebar-width]`, `xl:flex`
35+
- from `README.md` — `bg-blue-500`, `hover:bg-blue-700`, `text-white`
36+
- from `README_SHADCN_SYNC.md` — `dark:backdrop-blur-sm`, `dark:bg-background/95`
37+
- from the JSON examples in the renderer docs — `bg-blue-50`, `bg-gray-50`,
38+
`h-[600px]`, `h-[800px]`
39+
- from `shadcn-components.json` — a variant of `origin-[--radix-` ending in a
40+
typographic ellipsis
41+
- from a prose comment in `tsconfig.test.json` — `invert`, which is an ordinary
42+
English word there
43+
44+
Two of them are worth calling out. `flex-shrink-0` is a deprecated Tailwind v3
45+
alias this repository deliberately migrated away from, and it was shipping only
46+
because the changelog entry announcing that migration names it.
47+
`w-[--sidebar-width]` and the `origin-[--radix-` pair are the v3 bracket syntax,
48+
shipping only because the changelog entry recording the move to v4 syntax quotes
49+
the old spelling. A consumer who had come to rely on any of the 23 should add it
50+
to their own Tailwind sources; they were never this package's to publish.
51+
52+
## Fixed: three sibling packages get back classes their own components emit
53+
54+
The plugin stylesheets subtract every rule `@object-ui/components` already
55+
ships, so any class the prose invented was subtracted out of THEIR sheets while
56+
their components still emitted it — under-styled published packages with a green
57+
build. Restored by this change:
58+
59+
- `@object-ui/plugin-kanban` — `h-[600px]`, `sm:px-6`, `sm:py-4`
60+
- `@object-ui/plugin-grid` — `bg-blue-50`, `cursor-not-allowed`
61+
- `@object-ui/fields` — `bg-blue-50`, `bg-blue-500`, `bg-gray-50`, `text-white`
62+
63+
The same mechanism was also a loaded gun for the release lane: `changeset:version`
64+
writes changeset bodies into `packages/components/CHANGELOG.md`, so a changeset
65+
that merely QUOTED a class name promoted it to a real utility in this sheet and
66+
stripped it out of the plugin sheets at the next release. That is no longer
67+
possible for these four packages — which is why this body can safely quote 23
68+
class names.
69+
70+
## Why `minor` rather than `patch`
71+
72+
Removing utilities from a published stylesheet is a contraction of a published
73+
artifact, so it carries a breaking semantic. This repository does not ship
74+
`major` outside the `@objectstack` major-sync release, and marks its own breaking
75+
changes `minor` with the break spelled out — which is what the section above is.

‎.github/workflows/changeset-release.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,12 @@ jobs:
10781078
# runner time daily for a PR nobody reads until release day. That is the
10791079
# cost objectstack#10850 was closed to REMOVE, walking back in.
10801080
#
1081+
# ⚠️ "SOURCE" ABOVE MEANS `.ts`/`.tsx`/config AND NOT EVERY BUILD INPUT: a
1082+
# generated `CHANGELOG.md` IS a Tailwind source input for any package whose
1083+
# stylesheet entry scans it, which is how a changeset body that merely
1084+
# QUOTED a class name used to compile that class into a published sheet and
1085+
# subtract it back out of the plugin sheets (objectui#9569).
1086+
#
10811087
# So the validation is scoped to what the diff can actually move, and the
10821088
# union — `ci.yml` on the source, these steps on the version outputs — is
10831089
# the whole post-version tree.

‎packages/components/src/__tests__/index-css-scan-excludes-tests.test.ts‎

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
*/
88

99
/**
10-
* `src/index.css` must not scan this package's own TEST files — objectui#8446.
10+
* `src/index.css` must not scan this package's own TEST files (objectui#8446),
11+
* nor its own PROSE (objectui#9569).
1112
*
1213
* ## What was wrong
1314
*
@@ -38,15 +39,29 @@
3839
* production-sourced utility and a floor on the rule count, so an empty or
3940
* gutted sheet fails.
4041
*
41-
* ## Why `base` is passed explicitly
42+
* ## Why `base` is still passed explicitly
4243
*
43-
* `src/index.css` opens with a bare `@import 'tailwindcss'`, so Tailwind's
44-
* automatic source detection is ON and resolves against the PROCESS CWD. Vitest
45-
* runs from the repo root while `pnpm build` runs from this package directory,
46-
* and the two produce different stylesheets from the same bytes (measured:
47-
* 3430 rules vs 1385). Pinning `base` to the package root makes this reading
48-
* reproduce the artifact the BUILD produces, from either working directory.
49-
* The CWD dependence itself is out of scope here and reported separately.
44+
* It no longer has to be. `src/index.css` used to open with a bare
45+
* `@import 'tailwindcss'`, leaving automatic source detection ON and rooted at
46+
* the PROCESS CWD: vitest runs from the repo root while `pnpm build` runs from
47+
* this package directory, and the two compiled different stylesheets from the
48+
* same bytes. That entry now carries `source(none)` (objectui#9569), so nothing
49+
* is detected automatically and this reading is CWD-independent by construction
50+
* -- `base` governs only the automatic root, never the `@source` lines, which
51+
* resolve against the entry stylesheet's own directory. It is kept because it
52+
* costs nothing and still pins this reading to the directory the build runs in
53+
* if that entry ever loses the `source(none)`.
54+
*
55+
* ## The prose half (objectui#9569)
56+
*
57+
* Automatic detection scanned every non-ignored file in the package, so class
58+
* names quoted in `CHANGELOG.md`, `README.md` and the docs beside the renderers
59+
* compiled into the published sheet. `changeset:version` writes changeset bodies
60+
* into `CHANGELOG.md`, which made that a live channel from a release note into
61+
* `dist/index.css` -- and, through the plugin builders' subtraction, out of the
62+
* sibling packages' sheets. The second test below pins the door shut with its
63+
* own lit control, because a negative assertion about a token nothing mentions
64+
* any more would pass for the wrong reason.
5065
*/
5166
import { readFile } from 'node:fs/promises';
5267
import { dirname, resolve } from 'node:path';
@@ -73,6 +88,12 @@ const SENTINEL = 'mt-[3.7331px]';
7388
*/
7489
const SENTINEL_VALUE = '3.7331px';
7590

91+
/**
92+
* Named by this package's `CHANGELOG.md` and by no shipped source in it. Under
93+
* the pre-objectui#9569 entry this compiled a real rule into `dist/index.css`.
94+
*/
95+
const PROSE_ONLY_CLASS = 'flex-shrink-0';
96+
7697
async function compilePublishedStylesheet(): Promise<{
7798
css: string;
7899
selectors: Set<string>;
@@ -100,4 +121,22 @@ describe('packages/components/src/index.css @source scan', () => {
100121
expect(SENTINEL).toContain(SENTINEL_VALUE);
101122
expect(css).not.toContain(SENTINEL_VALUE);
102123
}, 60_000);
124+
125+
it("does not compile a class that only this package's CHANGELOG prose names", async () => {
126+
const changelog = await readFile(resolve(packageRoot, 'CHANGELOG.md'), 'utf8');
127+
128+
// CONTROL — the door this asserts is shut must still exist. `CHANGELOG.md`
129+
// is append-only, so an entry that once named this class keeps naming it; if
130+
// this ever goes red the probe needs re-pointing at a token the file does
131+
// carry, NOT deleting.
132+
expect(changelog).toContain(PROSE_ONLY_CLASS);
133+
134+
// `flex-shrink-0` is the deprecated Tailwind v3 alias this repo migrated
135+
// away from, so no shipped source emits it — compiling it would not merely
136+
// be waste, it would be wrong. The only reason it was ever in the published
137+
// sheet is the changelog entry announcing that migration.
138+
const { css, selectors } = await compilePublishedStylesheet();
139+
expect(selectors.has(`.${PROSE_ONLY_CLASS}`)).toBe(false);
140+
expect(css).not.toContain(`.${PROSE_ONLY_CLASS}`);
141+
}, 60_000);
103142
});

‎packages/components/src/index.css‎

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
1-
@import 'tailwindcss';
1+
/*
2+
* `source(none)` is load-bearing, not tidiness.
3+
*
4+
* This entry is the ROOT sheet, so it keeps the FULL `@import 'tailwindcss'`:
5+
* preflight, the `@theme` block and the base layer are this package's to emit.
6+
* The narrow siblings (`fields`, `plugin-grid`, `plugin-kanban`) deliberately
7+
* emit none of those and therefore spell their entry differently -- `@reference`
8+
* on this file plus `@import 'tailwindcss/utilities.css' layer(utilities)
9+
* source(none)`. Read `packages/fields/src/index.css`'s own header before
10+
* copying anything from it: it states "This file has no `@import 'tailwindcss'`
11+
* on purpose". Mirroring the siblings literally here would drop preflight and
12+
* the shared theme from the only sheet that ships them.
13+
*
14+
* What `source(none)` switches off is Tailwind's AUTOMATIC source detection,
15+
* which roots at the PROCESS CWD. Two defects followed from leaving it on:
16+
*
17+
* 1. The published artifact depended on where the build was launched from --
18+
* same commit, same command, two different stylesheets. The ratio measured
19+
* on objectui#9569: compiling with the cwd at this package emitted roughly a
20+
* third of the classes that compiling from the repo root emitted.
21+
* 2. It scanned this package's own `CHANGELOG.md` -- 473 kB of published prose
22+
* -- and compiled every class-shaped token in it into `dist/index.css`.
23+
* That is worse than dead weight: `pnpm changeset:version` WRITES changeset
24+
* bodies into that CHANGELOG, so a changeset that merely quotes a class name
25+
* turned it into a real utility here, and the plugin builders subtract every
26+
* rule this sheet already ships -- silently stripping that class out of
27+
* THEIR published sheets while their components still emit it (objectui#9569).
28+
* objectui#8446 already tried the narrow route on this same file, enumerating
29+
* bad doors with `@source not` while leaving detection ON; `CHANGELOG.md` is
30+
* the door it did not enumerate. Enumerating doors is what failed. The door
31+
* list is unbounded -- any published file in this package is a door -- so
32+
* detection is off and the inputs are declared instead.
33+
*
34+
* With it, the ONLY inputs are the explicit `@source` lines below, and the
35+
* output is byte-identical from any working directory.
36+
*/
37+
@import 'tailwindcss' source(none);
238

339
/* Class-based dark variant: follow `.dark` on <html>/ancestor instead of
440
the OS `prefers-color-scheme`, so the in-app theme toggle controls UI.
@@ -10,6 +46,19 @@
1046
@custom-variant dark (&:where(.dark, .dark *));
1147

1248
/* Scan sources for Tailwind classes.
49+
*
50+
* Since the entry above carries `source(none)`, these three lines are now the
51+
* ONLY thing that keeps this sheet non-empty -- there is no automatic detection
52+
* left to cover for a path that names nothing. Every path is resolved relative
53+
* to THIS FILE's directory: `@tailwindcss/postcss` compiles with its base set to
54+
* the entry stylesheet's own directory, so `../src/**` and `./**` below both
55+
* land on `packages/components/src`. `packages/runner/src/index.css` records the
56+
* failure mode in detail -- five `@source` lines there were each wrong by one
57+
* `src` segment, named directories that do not exist, and contributed nothing,
58+
* while automatic detection quietly kept that sheet populated. A near-empty
59+
* sheet and a correct one both build green, so the lines below were re-measured
60+
* by ablation on objectui#9569 rather than assumed: deleting the first one
61+
* collapses this compilation to its base layer.
1362
*
1463
* Only SHIPPED source. Tailwind v4 scans source TEXT, so any class-shaped
1564
* token in a file that is scanned compiles a real rule into the published

‎scripts/markdown-test-inputs.mjs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,17 @@ export const ADJUDICATED = new Map([
238238
reads: ['content/docs/guide/schema-rendering.md', 'packages/react/README.md'],
239239
},
240240
],
241+
// objectui#9569. This one reads a CHANGELOG as a CONTROL, not as a spec: the
242+
// test asserts a class named only by that prose is absent from the compiled
243+
// stylesheet, and reads the file to prove the prose still names it -- so the
244+
// negative assertion cannot pass because the token quietly went away.
245+
[
246+
'packages/components/src/__tests__/index-css-scan-excludes-tests.test.ts',
247+
{
248+
reads: ['packages/components/CHANGELOG.md'],
249+
notRead: ['CHANGELOG.md'],
250+
},
251+
],
241252
[
242253
'packages/components/src/__tests__/page-body-single-node-8310.test.tsx',
243254
{

0 commit comments

Comments
 (0)