Skip to main content

0019 — Global search with a generated settings index

Status: Accepted · Date: 2026-11-19

Context​

The portal's settings are spread over Settings, Account, Devices and Help, and its data over five list pages. Coaches asked for one search. Pages and data already have one source each (the sidebar, the stores). Settings do not: they are hand-written JSX, and about 70 rows carry data-find anchors that were meant for a settings search that was never built.

A hand-written settings index goes stale with the first changed row. The products that keep a settings search current derive it from the settings themselves:

  • VS Code builds its Settings editor from the configuration registry (preferencesModels.ts), so the list and its search share one source.
  • Android Settings lets every page provide its own search index from the preference XML that renders it (SEARCH_INDEX_DATA_PROVIDER).
  • Chrome for Android tests settings search both ways: every visible preference is in the index, and every indexed entry is visible (settings search testing guide).

Decision​

  1. One global search in the portal sidebar and on ⌘K / Ctrl+K, over pages, tasks, settings, people, exercises, workout templates and tags (docs/global-search.md).
  2. Pages and data are never indexed. Pages come from useSidebarNav(), shared with the sidebar; data comes from the live stores.
  3. The settings index is generated by rendering the real settings pages (scripts/search-index), not maintained. The harvest records every t(...) call, the only path every displayed string takes. Visibility is measured per role and per privilege; rows are grouped by their data-find anchors; the i18n catalogue catches what a server render cannot show.
  4. It stays current without anyone thinking of it: the shared pre-commit hook regenerates the index and adds it to the commit; it never blocks.
  5. Results that land in one place are one result, and a result offers the same thing on other pages through the addresses those pages already read (ADR 0017).

Consequences​

  • A new setting, tab or account room is searchable when it renders; no developer step exists to forget.
  • Commits that touch portal, shared-UI or core source take about five seconds longer.
  • A page that cannot render in the generator fails the run loudly instead of dropping out of the search.
  • Settings loaded only in an effect are found through the catalogue net with unknown visibility, until the generator renders with a DOM environment.
  • The pre-commit hook can be skipped (--no-verify); the next commit that regenerates heals the index. Without CI, search:index:check is not enforced on the server.