ADR-0015: Navigation renders from one registry, and a route nothing links to fails the build
- Status: Accepted
- Date: 2026-08-14
- Deciders: Cardsite platform team (workstream
001-renaissance, audit 03-D2)
Context
Audit 03's finding 03-D2 counted navigation: 85 routes, 33 sidebar items, 35 topbar breadcrumb labels and 37 command-palette entries, maintained by hand, with nothing checking any of them against the others or against the router.
Three corrections to that count, from counting the tree rather than the
finding. The palette holds 35 entries, not 37 — the finding is two ahead,
and this ADR uses the number that is there. App.tsx defines 84 route
patterns, not 85; the finding's extra is the catch-all. And there is a
fourth list the finding did not count at all: AppLayout's floating
mobile tab pill, four hand-written {label, path, icon} entries that no
desktop reviewer ever sees, which is precisely the list most likely to be
forgotten in a rename.
The drift was exactly what an unchecked duplication produces:
- Nine labels were spelled two ways. The sidebar said "QR codes", "Data records", "Activity logs", "Admin panel", "AI chat", "AI images", "AI text", "AI speech", "AI transcribe"; the palette said "QR Codes", "Data Records", "Activity Logs", "Admin Panel", "AI Chat", "AI Images", "AI Text", "AI Speech", "AI Transcribe". A user searching the palette for the thing the sidebar had just named them found it only because the filter lower-cases.
- Membership disagreed. PWAs were in the sidebar and the breadcrumbs and not the palette. Preferences was in the sidebar and the breadcrumbs and not the palette. The TwiML generator, the PWA splash generator and the Chrome extension were in the palette and in neither of the other two, so all three rendered their breadcrumb pill as the fallback, "Cardsite" — three pages inside the app shell whose chrome could not say what page you were on.
/checkouthad a breadcrumb label and no route, and had had neither for as long as the file's history goes back./payment-processorshad a route and no entry anywhere — a full CRUD page inside the signed-in shell reachable only by typing the URL. That is the same defect as the admin Feature Flags page (shipped routed and unlisted, fixed in ADR-0011) and the admin Plugins page (the same, ADR-0014). Three occurrences is a pattern, not an accident.- Icons disagreed. Referrals carried a heart in the sidebar and a credit
card in the palette. Six of the eight registered resource types carried a
sidebar icon that was not the one
linkTypeIcons.tsmaps for them — bio pages, vCards, payment links, splash pages, static pages and file links — in a module whose entire purpose is to be the single type→icon crossing point (AGENTS.md non-negotiable #4). - The
Gjump keys were declared twice — asshortcuthints on palette rows and as aGOmap inAppLayout. These two agreed, and the agreement was luck: nothing checked them, and a key added to either alone would have shipped as a hint for an unbound key or a binding no surface mentions. Both look exactly like working software from the outside.
None of this was reachable by a gate. scripts/check-navigation-parity.mjs
already held the vocabulary rules from ADR-0012 (no retired word; a nav entry
on a registered type's listPath carries that type's registry label), and its
own header said so: the plan's rules 1 and 2 — route coverage, and navigation
surfaces free of hardcoded path/label pairs — "belong to phase 01 tasks 2 and
3, which build the registry-driven navigation those rules describe".
This is that work: phase 01 task 3 and phase 04 task 2, which the plans require to be run once rather than twice.
Decision
One registry, apps/web/src/lib/navigation.ts, and every navigation surface
renders from it. NAV_DESTINATIONS declares each destination once — label,
path, icon, group, the surfaces it appears on, its optional short label for
the mobile pill and its optional G jump key. Sidebar, Topbar,
CommandPalette and AppLayout decide only how to draw what they are
given: at what size, under which heading, and whether the viewer's role
permits it.
Three properties follow, and each is enforced rather than asserted:
The eight registered resource types are not declared in the registry; they are derived from it.
fromRegistry('vcard', …)reads@cardsite/link-modelfor the label, the list path and the icon name, andlinkTypeIcons.tsfor the lucide component. A renamed product renames itself in all four surfaces with no edit to this file. The nav label is the registry's singular pluralised, because a nav entry names a list.A route inside the signed-in shell that no surface links to fails the build. Rule 1 of the gate reads
App.tsx, flattens its nested<Route>patterns, and checks coverage in both directions: every path the registry names must resolve to a route, and every static route under theAppLayoutparent must be either a destination or named inUNLISTED_ROUTESwith a reason. Parameterised routes are exempt structurally — a detail page is reached from its list and has no single path to link.The layout components hold no route literal. Rule 2 fails on a string literal that looks like a route, on a path assembled from a bare
'/', and on a{path,label}object or['/path','Label']tuple, anywhere inapps/web/src/components/layout/. The scope is the directory, discovered at run time, not four filenames: an adversarial pass beat the four-filename version by adding a fifth list in a new file beside them, which is exactly how a fifth list would really arrive. One-off destinations (the brand link, the compose button, the workspace switcher, sign-out) live in the registry'sROUTESmap; destinations built from data (/b/${slug}) live there as functions, because a path assembled from a variable is beyond what a source-reading check can follow — the boundary is stated in the gate's own header rather than papered over.
UNLISTED_ROUTES is a map from path to reason, not a list of paths. Three
routes are in it today: /payment-processors, /qr-codes/create and
/teams. The exemption is checked in the other direction too — a key whose
route no longer exists fails, because an exemption that outlives its subject
turns the list into fiction, which is how every stale allowlist begins.
/payment-processors stays unlisted, deliberately. The page's CRUD works,
but the blocks that would spend a connected processor render a price with no
control on it and nothing in the tree writes a guest_payments row (ROADMAP
LATER, ADR-0014). Listing it would advertise a checkout that does not exist —
non-negotiable #7 read from the navigation side. Whether to build the checkout
or retire the blocks is a product call, and this slice records the question
rather than pre-empting it with a sidebar row.
Consequences
What becomes easier. Adding a page is one entry. Renaming a product is one
edit in packages/link-model. A page that is routed and unlisted cannot ship
again — the failure mode that produced Feature Flags, Plugins and
/payment-processors is now a red build, and it is caught on the route, not
on someone noticing. The three tools pages have breadcrumbs for the first
time; the palette has PWAs and Preferences; the mobile nav sheet's admin entry
has an icon, which as an inline special case it never had.
What changes on screen, and is accepted. Six of the eight resource types
change their sidebar and palette icon to the one the registry maps — a bio
page is a LayoutGrid rather than a Globe, a vCard a Contact rather than
a CreditCard. That is the point: the dashboard's "Recently edited" rows have
drawn the registry icons since ADR-0009, so the sidebar was the surface that
disagreed. Payments moves from a credit card to a receipt, because the credit
card is now Payment links' registry icon two groups above it and two identical
icons in one sidebar is worse than either choice alone. Twelve labels change
casing to sentence case, which is the Studio voice and the casing the registry
uses: the nine that were spelled two ways adopt the sidebar's spelling, and
the three tools pages — "TwiML Generator", "PWA Splash Generator", "Chrome
Extension" — follow, because they existed only in the palette and were the
only Title Case left once the divergences were settled.
What the gate gave up, which is not nothing. Rule B — "a navigation entry
pointing at a registered type's listPath carries that type's registry label",
the rule ADR-0012 leaned on — checked 29 entries before this change and
checks 3 after. That is not a regression in behaviour but it is a real loss
of this gate's coverage, and it happens for the reason the slice exists: the
26 entries it used to read were literals in the four surfaces, and there are no
literals there any more. What replaced them is stronger where it applies and
weaker where it does not. Stronger: those 26 entries can no longer disagree
with the registry at all, because they are the registry, and
navigation.test.ts asserts the derivation by executing it — a source-reading
gate cannot evaluate fromRegistry(). Weaker: the check that proves it now
lives in the unit suite (the frontend CI job) rather than in the parity gate
(the design-system job), so the two are no longer redundant. The success line
says all of this out loud rather than reporting a smaller number in silence.
What becomes harder. A destination cannot be added to one surface in
isolation any more; it is declared once and its on list says where it
appears. That is the intended cost. A one-off route string in a layout file
now fails CI, so a genuinely non-navigational path in one of those four files
must be added to ROUTES — a small ceremony, and the alternative is an
exception list that grows until the rule means nothing.
Two more things that change on screen, neither of them a regression and
both consequences of one grouping replacing three. In the palette, Statistics
moves from the Navigation section to Account and Directory from
Navigation to Tools, because the sidebar's grouping is now the
grouping — and since the palette matches the query against the section name as
well as the label, typing "navigation" no longer surfaces those two. And three
icons change in the palette alone, where it disagreed with the sidebar or with
nothing: Directory Globe → Compass, Chrome extension File → Puzzle, and
Referrals CreditCard → Heart, the sidebar's side of the disagreement this
ADR opens by naming. The mobile pill's Bio pages icon follows the registry too:
Globe → LayoutGrid.
One thing that does not change, and should have. /payment-processors is
in UNLISTED_ROUTES, so it contributes no crumb prefix and its breadcrumb pill
still reads "Cardsite" — exactly the defect this ADR opens by naming for the
three tools pages. UNLISTED_ROUTES maps a path to a reason and has nowhere to
put a name; giving it one is a shape change to the map, the gate and the test,
for a page whose own section here argues it should stay unlisted. It is on the
ROADMAP under LATER instead of folded in silently.
What the gate cannot see, stated rather than implied. It reads source, so
it cannot evaluate fromRegistry(); that the derived label really is the
registry's label pluralised, that the derived icon really is the mapped one,
and that no two destinations collide are checked by navigation.test.ts,
where the module is executed. It cannot read template literals, which is why
data-built paths are registry functions. It does not read the admin portal,
which has its own 33-item nav and is out of scope for phase 01
(plans/01-library.md); the exempted file count is printed on success rather
than hidden.
The i18n ratchet moved for a relocation, not an extraction, and
scripts/i18n-baseline.json says so in as many words: 1911 → 1904, because
seven labels moved out of counted .tsx positions into a .ts module the
counting method deliberately does not read. Zero strings were translated. The
remaining ~35 nav labels never counted — they were object-literal label:
properties, which the method has never read — so nothing was hidden from the
ratchet that it had been counting. They are in one file now instead of four,
which is where an extraction will want them.
Alternatives considered
- Extend
packages/link-modelto cover all ~24 products and drive navigation from it — rejected for now, not on merit: that is phase 01 task 2, and it is blocked on decisions 002 (is a QR code a resource or a representation?) and 003 (should PWAs reference a bio page?). Navigation cannot wait for those, and it does not need to: the eight registered types are derived today, and the other ~30 destinations are declared here until the product registry can hold them. When task 2 lands, entries move from literal to derived one at a time and rule 1b tightens with each. - A second script for the route rules — rejected.
SESSION.mdnamed this file as their home before the work started, and it is the right one: a navigation entry naming a retired word and a navigation entry naming nothing are the same class of defect, and one script means one place to look when the build goes red. - Allow each surface its own labels and check only that they agree —
rejected. A cross-surface equality check is a gate that tells you two lists
disagree, which is a worse version of knowing there is one list. It would
also have had nothing to say about
/payment-processors, which no list named at all. - Generate the registry from
App.tsx— rejected. The router knows what exists, not what a user should be offered or what to call it;/teamsis a compatibility redirect and/qr-codes/createis a builder reached from its list. Deriving navigation from routes would have listed both. - Move
/payment-processorsinto the sidebar while we were here — rejected as the wrong end of the decision. Discoverability for a subsystem whose checkout does not exist is the shipped-but-dead pattern in a new costume; the reason is recorded inUNLISTED_ROUTESwhere the next reader will find it.
Source: docs/decisions/0015-navigation-renders-from-one-registry.md