Skip to content
Toolkit

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.jsx drew <i class="ph …"> against an icon font Studio does not ship — a blank tile.
  • confirm.jsx did it again, and Pagination's two carets did it a third time, so the only visible affordance on both controls was nothing at all.
  • The ConfirmDialog conversion found Drawer and ResourceUrl emitting lk-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.

.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:

  1. 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).

  2. 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.

  3. 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 > caption and carries no class at all, so there is no class to be absent.

    The alternative — a namespaced .lk-visually-hidden in 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-table can no longer show a visible caption at all, which a printed report might legitimately want (95-print.css gives .lk-table paged 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--visible opt-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 DataTable conversion ships with zero horizontal movement on all fourteen call sites, because .lk-table now pads by the --space-5 the app's .data-table always 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) to var(--space-3) vertically.
    • Cell text goes from weight 400 to 500. .lk-table td sets font-weight: 500 and .data-table td set 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-primary equivalent is what the affected call sites want when someone looks at them.
  • The same pass found .lk-table th had lost white-space: nowrap, which .data-table th sets. 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.numeric shipped 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--numeric now, 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-pagination to --space-4 — would have broken alignment on the six pages that already pair a converted Pagination with a hand-rolled .data-table at --space-5. Fixing the component that no consumer had rendered yet was the cheap side.

  • Six assertions in apps/web/src/components/DataTable.test.tsx read studio/packages/core/dist/studio.components.css and 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 verify runs the Studio build, the Studio lint, eight parity checks and the web build — no vitest. The unit project runs from apps/web and 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, run npm run verify, and it passes. Wiring the unit project into verify is 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 className literal in packages/react/src/*.jsx, subtract what the standalone layers define, fail on the remainder — would have caught both of this conversion's missing classes, visually-hidden and t-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's ph-x and the icon glyphs in chrome, controls, feedback and shell remain 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

Library