ADR-0023: A conversion's risk is in what the component layer does not say — the class it never defined, and the value two components disagree on
- Status: Accepted
- Date: 2026-08-19
- Deciders: Renaissance workstream 002, phase 02 (
DataTable, the fourth conversion); follows ADR-0019, ADR-0020, ADR-0021 and ADR-0022
Context
ADR-0020 established the standalone component layer: a consumer carrying its
own component CSS — Cardsite carries ~4,600 lines of it — imports
@studio/core/css/components rather than the full stylesheet, and the build
checks what makes taking one layer alone safe, by failing if any selector
in it reaches outside the .lk-/.studio- namespace.
That check is one-directional. It proves the layer cannot touch anything it
should not. It says nothing about whether the layer contains everything the
component needs. DataTable found both halves of that gap on the same
afternoon, and neither was visible to tsc, to ESLint, to the parity gate, to
the Studio lint, to the namespace check, or to any test in the repository.
One: a class the layer never defined
Studio's Table and DataTable both render
<caption className="visually-hidden">{caption}</caption>
caption is required on both, and the docstring and the type both promise it
is "required, and visually hidden". .visually-hidden is defined in
packages/core/src/90-a11y.css — which is in the full bundle, and in none
of the four layers apps/web/src/index.css imports (css/fonts, the app's own
tokens, css/resource, css/components).
So the conversion would have shipped, on all fourteen call sites, a table with the words Domains, Payments, vCards, Activity logs rendered as visible unstyled text above it. Not a subtle regression — a caption in body copy on thirteen product pages, in an element the author believed was hidden because the class name says so.
This is the same shape as three defects already on the record, and the repetition is the point:
resource.jsxdrew<i class="ph …">against an icon font Studio does not ship — a blank tile.confirm.jsxdid it again, andPagination's two carets did it a third time, so the only visible affordance on both controls was nothing at all.- The
ConfirmDialogconversion foundDrawerandResourceUrlemittinglk-btn,lk-field,lk-input— defined nowhere in the resource layer they shipped in, so they had been falling back to the app's element resets on 17 pages.
Every one is a Studio component naming something its own shipped layer does not define. The icon-font cases are named as such in the session file and fixed one component at a time; this one is the same defect wearing a class name instead of a font.
Two: a value two components in the layer disagree on
ADR-0022 gave .lk-pagination an unconditional --space-5 inline gutter, and
wrote the reason into the rule: "The inline value is the --space-5 a table's
cells use, so the range readout lines up with the first cell."
That was measured against the app's .data-table, which pads its cells by
var(--space-4) var(--space-5). Studio's own .lk-table padded by
var(--space-3) var(--space-4) — 16px, not 20px. The sentence was true of
the table the footer sat under at the time and false of the table Studio
ships.
Nothing surfaced that, because until this conversion the two had never been
rendered together. The moment DataTable converts, five pages stack them —
UserLogsPage, PaymentsPage, DataRecordsPage, NotificationHandlersPage,
VcardsPage — and the footer's readout stands 4px proud of the first cell
above it, which is precisely the misalignment ADR-0022 was written to prevent,
arrived at from the other direction.
Three, related: a cell that pads what its content already padded
.lk-table td.lk-table__empty set padding: var(--space-10) var(--space-4),
which is right for the bare 'No records' string Studio falls back to and
wrong for everything else. All fourteen call sites pass
empty={<EmptyState compact …/>}, and .empty-state.is-compact is
padding: var(--space-5). The app's equivalent rule is
.data-table td.is-empty-cell { padding: 0 } — the cell deliberately padding
nothing, because the node brings its own. Converting without noticing would
have opened every empty list in the product with 40px of dead space stacked on
the message's own 20px.
Decision
A Studio component's standalone layer defines every class the component's markup names, and a conversion checks that before it checks anything else.
Concretely, for each component converted:
Enumerate the class names the Studio component emits — including ones that look like framework-level utilities (
visually-hidden,t-mono) and ones inherited from a base the consumer may never mount (.studio-base).Grep each against the layer the consumer actually imports, not against
studio.css. A rule that exists only in the full bundle is a rule the consumer does not have.Where a utility is missing, prefer moving the behaviour into a rule the markup cannot forget over adding the utility to the layer. The caption is hidden by
.lk-table > captionand carries no class at all, so there is no class to be absent.The alternative — a namespaced
.lk-visually-hiddenin the component layer — would satisfy the namespace check just as well; that is not the reason to prefer the element rule, and an earlier draft of this ADR claimed it was. The reason is that a utility class is a thing the markup can omit and this one already had been, in a component whose own docstring said it was applied. The cost is real and is accepted here rather than waved past: a.lk-tablecan no longer show a visible caption at all, which a printed report might legitimately want (95-print.cssgives.lk-tablepaged output). No consumer does today — all four static demos already hid theirs — so the capability is being removed before it was used. If one appears, the answer is an explicit.lk-table > caption.lk-caption--visibleopt-out, not a return to the utility: an opt-out is remembered by the person who wants it, where a default must be remembered by everyone.
And: two Studio components that render against each other agree on the values
that make them line up, in the layer, before either ships to a consumer that
stacks them. ADR-0022 said to check a new rule against every call site. This
extends it to the other axis: check it against every component the rule
claims a relationship with. .lk-table's cells and .lk-pagination's gutter
are now both --space-5, .lk-table__bulk with them, and the comment in
.lk-pagination names .lk-table rather than "a table".
A cell is a slot, not a frame. Where a component renders consumer content
in a container of its own, the container does not pad it; the component's own
default content carries its spacing. .lk-table__empty is padding: 0 and
.lk-table__empty-text carries var(--space-10) var(--space-5).
Consequences
The
DataTableconversion ships with zero horizontal movement on all fourteen call sites, because.lk-tablenow pads by the--space-5the app's.data-tablealways did. Two things about the cells do change, and both are Studio's material under ADR-0019, stated rather than hidden:- Rows are about 8px shorter — cells go from
var(--space-4)tovar(--space-3)vertically. - Cell text goes from weight 400 to 500.
.lk-table tdsetsfont-weight: 500and.data-table tdset none. The proof that 400 was deliberate sits three rules below the one this conversion deleted from:.cell-primary { font-weight: 500 }exists to lift one cell above its siblings. So the emphasis idiom flattens at converted call sites — on/pwas,<span className="medium">around the app name is 500 on 500 and no longer reads as the primary field. Thirteen pages read heavier; one loses an emphasis. An adversarial pass found this after the first draft of this ADR had enumerated the padding and missed it, which is itself the lesson: the rule you are comparing has other declarations in it. Left as Studio's material rather than fixed, because unlike the gutter no two components disagree — but a.cell-primaryequivalent is what the affected call sites want when someone looks at them.
- Rows are about 8px shorter — cells go from
The same pass found
.lk-table thhad lostwhite-space: nowrap, which.data-table thsets. That one is fixed: 31 hand-rolled.data-tables keep the app's behaviour, so leaving it would have given the app two table styles that wrap differently, and the first two-word header would have found it.DataTableColumn.numericshipped wired to nothing and is fixed here rather than deferred, because AGENTS.md non-negotiable #7 does not have a latency exemption. It emitted.t-mono, which is wrong twice: that class is a whole type style (11px, its own tracking and leading) rather than the "tabular figures" the prop is documented as, and it lives in the type layer that a component-layer consumer does not have — so the prop did nothing in Cardsite and the wrong thing everywhere else. It emits.lk-table__cell--numericnow, defined beside the other cell modifiers. It was found by the adversarial pass reading this ADR's own decision back against the component the ADR is about, which is the check working.Changing
.lk-table's gutter is a design-system change affecting every consumer, not only Cardsite. It is one line, it makes the system internally consistent where it was not, and the alternative — moving.lk-paginationto--space-4— would have broken alignment on the six pages that already pair a convertedPaginationwith a hand-rolled.data-tableat--space-5. Fixing the component that no consumer had rendered yet was the cheap side.Six assertions in
apps/web/src/components/DataTable.test.tsxreadstudio/packages/core/dist/studio.components.cssand assert on rules rather than on the DOM. That is unusual and deliberate: every defect above is a padding, a weight or an absent rule, and no DOM assertion can see any of them. Where a fact must hold between two files, the test reads both. Each was watched failing against a rebuilt, deliberately broken layer.They are not, however, in the gate this repository currently merges on.
npm run verifyruns the Studio build, the Studio lint, eight parity checks and the web build — no vitest. The unit project runs fromapps/weband in the CI job that the Actions outage has made advisory. So the protection this ADR claims is real but is one command away from the merge decision: revert.lk-table's gutter, runnpm run verify, and it passes. Wiring the unit project intoverifyis the obvious answer and is a change to the merge gate rather than to a component, so it is queued as its own item rather than taken here.Not fixed here, and the obvious next step: the build checks that the layer does not reach out of the namespace, but nothing checks that it is complete. The mechanical form — collect every
classNameliteral inpackages/react/src/*.jsx, subtract what the standalone layers define, fail on the remainder — would have caught both of this conversion's missing classes,visually-hiddenandt-mono, and both were found by hand instead: the first by reading the layer, the second by an adversarial pass reading this ADR back against its own component. Two escapes in one component is the argument for the check. It is a change to a gate rather than to a component, so it wants its own item, and it should land before the conversions that emit the most utility classes (Form/FormField,Modal).Modal'sph-xand the icon glyphs inchrome,controls,feedbackandshellremain on the same list, to be fixed as each component converts.DataTable's three sort glyphs came off it here, and they were the worst of the set: sort direction is carried in that icon and nowhere else on screen, so on a consumer without Phosphor a sorted column was indistinguishable from an unsorted one.
Source: docs/decisions/0023-a-component-layer-is-only-as-good-as-what-it-does-not-say.md