Skip to content
Toolkit

ADR-0021: A conversion deletes the app CSS it replaces on the same commit, because that is what finds the dead surfaces

  • Status: Accepted
  • Date: 2026-08-19
  • Deciders: Renaissance workstream 002, phase 02 (ConfirmDialog and Skeleton, the first two conversions); follows ADR-0019 and ADR-0020

Context

ADR-0020 settled how a converted component gets its stylesheet: Studio emits @studio/core/css/components, and apps/web/src/index.css imports it. That leaves an obvious follow-on question that looks purely cosmetic — what happens to the app's own rule for the component that just converted? Both stylesheets are now loaded, both rules are inert-but-harmless, and the app's copy could sit there indefinitely without breaking a thing.

Two conversions in, that framing is wrong. Deleting the app's rule is not tidying after the conversion; it is the only step that finds out who was really using it.

ConfirmDialog. Removing .confirm-* from styles/components.css meant reading what those rules had actually been doing, and the answer was: nothing, for the component's whole life. The app's dialog rendered class="modal is-sm confirm-dialog" with no .modal-panel — the element that carries the card's background, border, radius, shadow and its pointer-events: auto, against a .modal wrapper that sets pointer-events: none. So the dialog had no visible card and its buttons could not be clicked; a click on Delete fell through to the overlay beneath and cancelled the action. It worked by keyboard only, across 63 call sites.

Skeleton. Removing .skeleton produced a much sharper result, because this time the class had a consumer the component never knew about. apps/web/src/pages/payments/PaymentProcessorsPage.tsx rendered its loading state as {[1, 2].map(i => <div key={i} className="skeleton" />)} — the class by hand, no component, no import. And .skeleton set a colour, a radius and an animation and no dimensions. A childless <div> inside a display:flex; flex-direction:column parent is zero pixels tall, so /payments/processors rendered two invisible nothings and announced no busy state at all, for its whole life. Non-negotiable #7 ("if a control ships, it works") in the letter, and the fifth such surface on record: three in .archives/removal-safe/AUDITS-081226.md, then the confirm dialog above, then this one.

The decisive detail is how it was found. Every inventory of that conversion that started from the component — grep for Skeleton, read the barrel, list the importers — missed this file completely, because the file imports nothing. It appeared the moment the question changed from "who imports this component?" to "who names this class?".

A class shared between a component and its hand-rolled imitations is exactly where a control ships wired to nothing, and a conversion is the one moment the repository is forced to enumerate them.

Decision

A phase 02 conversion is not complete until the app's CSS for that component is deleted, on the same commit as the call-site migration. Concretely, each conversion must:

  1. Grep for the class name, not only the component name, across the whole repository — src, tests, *.css, *.html, studio/, docs/ — before deleting a rule. The component's importers are the easy half; the hand-rolled consumers of its class are the half that hides defects.
  2. Fix every hand-rolled consumer as part of the conversion, by giving it the Studio component. It is in scope: the rule it depends on is being deleted, so leaving it is knowingly shipping a broken surface. It is not "adjacent cleanup".
  3. Delete the rule and any keyframe or helper only it used — for Skeleton, .skeleton from styles/components.css and @keyframes skeleton-pulse from styles/base.css.
  4. Record what the deletion exposed in the .archives/removal-safe/ register row for the archived component, not only in the session file. The register is where the next person looks to find out why a file left the tree, and "the class it shared was load-bearing for a page that never imported it" is the most useful thing that row can say.
  5. Retire the component's card on .station/jobs/002-renaissance/preview/current-design.html, replacing it with a pv-gap "converted" card that says where the live one now is and what the app's version got wrong. That page is not a mock-up: it <link>s the app's real stylesheets out of the tree, precisely so it cannot drift from what it shows. So deleting a rule breaks its own card — a .skeleton span there renders as nothing the moment the rule goes. A conversion that skips this step leaves the "before" preview quietly blank and looks, to the next reader, like a rendering bug rather than a deletion.

The corollary for authoring (phase 01) is that a Studio component whose visual identity is only a class — a colour and an animation with no geometry, like .lk-skeleton — must carry its geometry in the component, not in the stylesheet. Studio's Skeleton defaults height to 16 and width to 100% precisely so that <Skeleton /> cannot be invisible, and apps/web/src/components/Skeleton.test.tsx asserts it. That default is what makes the component safe where the bare class was not, and it is why the fix for /payments/processors is the component rather than a height on the div.

Consequences

  • Each conversion's diff is wider than an import swap, on purpose. The Skeleton conversion touched a page that had nothing to do with Skeleton. Reviewers should expect that and read it as the conversion working.
  • The i18n and hardcoded-data ratchets will move on conversions. Archiving the app component takes its counted strings out of apps/web, which the ratchet reads as progress it did not make. Skeleton moved it 1897 → 1896 for one aria-label="Loading"; the movement is committed in scripts/i18n-baseline.json with the word relocation in it, because a ratchet that falls for the wrong reason is a ratchet nobody trusts.
  • Eighteen more conversions inherit the grep. The remaining phase 02 queue is Pagination, DataTable, DropdownMenu/Popover and the rest; each one's class family (.pagination-*, .data-table, .menu/.menu-item, .popover) is more widely hand-rolled than .skeleton was, not less. .data-table is already known to be written by hand in 31 app files, 28 of them under pages/admin/. Those are found by this rule and fixed by their own conversions, not by this one.
  • Nothing is deleted without an archive. The rules leave the stylesheet, but the component file goes to .archives/removal-safe/ with its register row, per non-negotiable #6. The CSS itself is recoverable from git history and from the archived component beside it.

Alternatives considered

  • Leave the app's rule in place and delete all of them at the end of phase 02. Rejected: it is the passive version of the same work, and it defers exactly the information that makes conversion valuable. Both dead surfaces found so far would still be dead, and would have been found — if at all — in a bulk CSS deletion at the end, with no conversion commit to attribute them to and no test landing beside them.
  • Delete the rule but leave hand-rolled consumers broken, and file them as follow-ups. Rejected outright. It converts a latent defect into a live one on the same commit, which non-negotiable #7 forbids, and a follow-up item is not a working control.
  • Keep the app's class as an alias for the Studio one (.skeleton { } extending .lk-skeleton). Rejected: it preserves the hand-rolled call sites by making them invisible again, and it puts app CSS back in the business of styling Studio components — the fork ADR-0018 and non-negotiable #2 exist to prevent.
  • Grep only for the component name and trust the type checker. This is what a careful reader does by default, and it is precisely what missed PaymentProcessorsPage. A hand-rolled <div className="skeleton" /> has no import, no type and no reference to the component; tsc and the linter are both silent on it. The class name is the only thing the two have in common, so the class name is what the grep has to be.

Source: docs/decisions/0021-a-conversion-deletes-the-app-css-it-replaces-on-the-same-commit.md

Library