ADR-0026: A shared name is not a shared contract — the parity gate counts names, and a conversion has to read the component
- Status: Accepted
- Date: 2026-08-20
- Deciders: Renaissance workstream 002, phase 02 (
Avatar, the tenth conversion); follows ADR-0018, ADR-0019, ADR-0020, ADR-0021, ADR-0022, ADR-0023 and ADR-0025
Context
ADR-0018 made the parity gate read components from source rather than from memory. It reads three sets:
- React — the capitalised exports of
studio/packages/react/src/index.js - Swift — the
public struct Studio*declarations, prefix stripped - App — the component exports of
apps/web/src/components/ui/index.ts
and it derives the workstream's scoreboard from set arithmetic on those names:
const queue = names.filter((n) => app.has(n) && !react.has(n)); // awaiting authoring
const converting = names.filter((n) => app.has(n) && react.has(n)); // awaiting conversion
That is the right way to build the gate. A name is what a source can be read for without running it, and the alternative — a hand-maintained list of which app component corresponds to which Studio component — is the hand-copied token file that non-negotiable #2 exists to prevent.
But it means converting is a set of names that appear on both sides, and
nothing more. For nine conversions that distinction never mattered, because
the name match happened to track a contract match: Studio's ConfirmDialog
really was the app's ConfirmDialog, Studio's Pagination really was the
app's Pagination. The gaps those conversions found were in the stylesheet
(ADR-0020/0021/0023), in the props (ADR-0019/0022), or in the call site's
containing box (ADR-0025). In every one of them, the two components were
recognisably the same component.
Avatar is two different components with one name
They are not variants of each other. They are not even the same element.
app components/ui/Avatar.tsx | Studio Avatar (shell.jsx) | |
|---|---|---|
| Element | <span> | <button type="button"> |
| Role | presentational — a person | a control — opens the account menu |
| Content | a photo, or two initials from name | one glyph, initial, defaulting to 'S' |
| Size | size in px, glyph at 0.36 of the box | fixed 52px, fixed 16px glyph |
| Fill | --surface-3 over --on-surface | --accent over --accent-ink, --shadow-raised |
| Photo | <img> with alt, object-fit: cover | none |
Two of the app's three call sites render the avatar inside a <button> —
Topbar's .avatar-button.glassy is the 48px glass circle that actually
takes the click, and the avatar is what sits in it. The third,
AdminLayout's footer identity row, sits beside a visible name and a
separate sign-out button.
So the import swap the ledger row implies produces, in one commit:
- A
<button>inside a<button>. Invalid DOM, an unpredictable hit target, and a second control in the tab order. Nothing innpm run verifyparses rendered markup, so no gate in this repository can see it. - A 52px circle inside a 48px container, twice, with the accent fill and a raised shadow replacing a neutral one — three screens redesigned by accident.
- No photo at all.
srcwould stop being a prop. It happens to beundefinedat every call site today, which means the regression would have shipped invisibly and surfaced the first time a user uploaded an avatar.
None of that is exotic. It is what the ledger row says when you read it as a statement about the components rather than about their names.
The cost table has the same blind spot
SESSION.md ranks the remaining conversions by blast radius — files touched
and JSX uses — and on that table Avatar is the cheapest thing left: two
files, three uses. Button and Card sit at the bottom with 70 and 74 files.
Blast radius measures call-site churn. It does not measure contract
distance, and those are independent. Avatar has the smallest blast radius
of the eleven and required more authoring than any conversion since
DataTable: a superset component, four new CSS rules, a new element-identity
decision and a tone. A component with three call sites and an identical
contract is an afternoon; a component with three call sites and a different
element is not.
Decision
A ledger row saying converting is a scheduling hint, not a finding.
Before a conversion is scheduled or costed, read both components and diff
their rendered element and prop surface. Where they differ, the phase-02
conversion contains phase-01 authoring, and it is budgeted as such.
Three rules follow.
1. Diff the element, not only the props
ADR-0019 already requires the authored component to implement a superset of the app component's behaviour. This adds the tag it renders, because the element is the one part of a component's contract that its props do not describe and no gate in this repository checks. Concretely: what tag does each side render, is it in the tab order, does it take a click, and can it legally appear where the app puts it?
Avatar resolves this by deciding the element from the intent instead of
fixing it: it is a <button> when it is given an onClick, and a <span>
otherwise. That is not a convenience. It is ADR-0022's "prefer removing a
failure mode to testing for it" applied to nesting: a consumer cannot produce
a nested button by forgetting a prop, because the prop that would make it a
button is the one that gives it something to do.
That claim only holds if there is no way to override it, and the first draft
of this component had one — an interactive prop — which the adversarial
pass showed falsifies the claim in both directions. interactive without an
onClick is a focusable control wired to nothing, which non-negotiable #7
forbids and which is the nested button again wherever the consumer's own
button surrounds it. interactive={false} with an onClick spreads the
handler onto a <span> carrying no role, no tabIndex and no accessible
name: a mouse-only control. The tests asserted both as intended behaviour
rather than catching either — two failure modes added, neither removed, which
is ADR-0022 read backwards. The prop is gone. An inference that removes a
failure mode must not ship with a way to opt out of it, or it is a default,
not a guarantee. A consumer needing richer interaction wraps the avatar in
their own control, which is what both .lk-avatarwrap and Cardsite's
.avatar-button already do.
2. Where the two sides disagree on appearance, the difference becomes a named option on the Studio component
Not a silent adoption of Studio's look, and not a className at the call
site. Studio's avatar was accent-filled because Studio's avatar was the
viewer's own account chip; the app's was surface-filled because the app's
stood beside somebody's name. Both are right, so tone is a documented prop
with accent as the default and neutral shipped as .lk-avatar--neutral,
and the three app call sites pass it.
The test is whether the difference is legible in the component. A conversion
that preserves the app's appearance by reaching for className has moved the
design decision back to the call site, which is where phase 02 is trying to
take it from.
There is a trap immediately underneath this, and the adversarial pass on this
conversion found it in a line written to avoid a regression.
.lk-avatar--static was first drafted cursor: default, on the reasoning
that a presentational span is not a control and should not claim a pointer.
But cursor is an inherited property and the app's .avatar declared none —
so it took the pointer from the <button> around it, at two of the three
call sites. default is not the neutral value; no declaration was, and the
equivalent of no declaration is cursor: inherit. So: when a conversion
adds a declaration the old rule did not have, work out what the old rule was
inheriting before calling the new one neutral. This is ADR-0022's rule one
level down — check the new declaration against every call site — applied to
the declarations a superset adds rather than the ones it copies.
3. An element-identity claim gets a test, because no gate makes one
apps/web/src/components/Avatar.test.tsx renders the component inside a
<button> and asserts the document contains exactly one. That single
assertion is the only thing in the repository that would catch a future
change reverting the component to an unconditional <button> — verified by
mutation before the conversion was trusted, alongside the ADR-0023 layer
assertions.
Consequences
- The ten remaining phase-02 conversions get a contract diff before they are
costed, and
SESSION.md's cost table carries contract distance beside blast radius. The next two,ToastProviderandToggle, are the ones to check first:ToastProvideris a provider plus a hook with five consumers, which is a shape the table cannot express at all. Avataris the eighth conversion out of ten to find its component's CSS missing from the layer the app imports (ADR-0023) —.lk-avatarlived in40-shell-app.css, a shell layer the build never copies intostudio.components.css. That is now a standing expectation rather than a surprise: assume the rule is missing and prove it is present. The enumeration cuts the other way too, and the adversarial pass caught this conversion on it:.lk-avatarwrapwas moved into the component layer alongside the avatar and does not belong there, because the rule it is coupled to is.lk-menu, which is chrome. Enumerate what the markup names — not what shares its prefix — or ADR-0023 passes on the wrong class.- The
sizeprop is one place the superset is not literal, stated rather than buried: the app's defaulted to 36px and Studio's has no default, falling through to the stylesheet's 52px account chip. All three call sites passsizeexplicitly so nothing moves, and adopting 36 would have resized Studio's own avatar under its existing consumers. A narrowing with a reason beats a superset with a surprise. - The parity gate is unchanged. It counts names because names are what it can read, and this ADR does not ask it to guess at contracts — it asks the reader of its output not to.
- Studio's
Avatardefault glyph changes from'S'to'?'. An avatar with no identity to show is an unknown person, not the design system;'S'was a demo artefact, and the one call site that can render without a name (AdminLayout, before its user query resolves) meant it on screen.
Source: docs/decisions/0026-a-shared-name-is-not-a-shared-contract.md