Skip to content

fix(registry): derive component count from registry, drop hardcoded 225#450

Merged
bntvllnt merged 2 commits into
mainfrom
worktree-fix+component-count-drift
Jun 25, 2026
Merged

fix(registry): derive component count from registry, drop hardcoded 225#450
bntvllnt merged 2 commits into
mainfrom
worktree-fix+component-count-drift

Conversation

@bntvllnt

Copy link
Copy Markdown
Collaborator

Why

The site reported two different component counts:

Surface Count Source
Homepage hero/stats, page metadata, /ai, /vs/shadcn, llms.txt, llms-full.txt 309 live — getComponentCount() = registry.items.length
Changelog [Unreleased], PWA manifest, MCP server instructions, home/{en,fr}.mdx 225 hardcoded literal, last accurate ~PR #386

Root cause: two sources of truth. The live count auto-updates from registry.json; the hardcoded 225 is copy-pasted prose that drifted as ~84 components were added.

What changed

  • app/manifest.ts, app/mcp/route.ts — derive the count from the registry (getComponentCount() / REGISTRY.items.length). These can no longer drift.
  • CHANGELOG.md [Unreleased], home/{en,fr}.mdx — bump 225309. The changelog snapshot is intentionally a release-time value (parsed by lib/changelog.ts as a "up from N" stat), so it stays a literal but is now guarded.
  • apps/registry/lib/component-count.test.ts — regression guard: fails when the changelog [Unreleased] count, either home MDX, or the manifest description diverges from registry.items.length. Verified it goes red on the stale 225 and green on 309.

Notes / out of scope

  • content/pages/home/{en,fr}.mdx appear orphaned — the locale homepage renders <Landing/> (React), not this MDX, and /llms-full.txt reads a non-existent content/pages/home.mdx. Updated in place rather than deleted (Chesterton's fence); orphan cleanup can be a follow-up.
  • The pre-existing (up from 140) delta in the changelog is left untouched.

Validation

  • vitest run — 34/34 pass (incl. new guard); RED proof confirmed on stale value
  • tsc --noEmit — clean
  • eslint (changed files) — clean

Closes #449

The homepage reads the live count (getComponentCount = registry.items.length
= 309), while the PWA manifest, MCP server instructions, the changelog
[Unreleased] snapshot, and home/{en,fr}.mdx hardcoded a stale 225 — last
accurate around PR #386 and never bumped as ~84 components were added.

- manifest.ts, mcp/route.ts: derive the count from the registry (no literal)
- CHANGELOG [Unreleased] + home/{en,fr}.mdx: bump 225 -> 309
- add component-count.test.ts: fails when any human-maintained count diverges
  from registry.items.length, so the next added component forces a copy update

Closes #449

Claude-Session: https://claude.ai/code/session_01CbnP4KD8kio2hozz54h9zV
@vllnt-pilot

vllnt-pilot Bot commented Jun 25, 2026

Copy link
Copy Markdown

ntk preview

App Status Preview
ui-registry Ready https://pr-450-ui-registry.preview.vllnt.ai
storybook Skipped (preview cell not configured)

Built from 1ecd7f7b · public + no-index (ADR-082) · torn down on close

#443 (ce98eca) made the prompt-input `ref` prop optional in the canonical
packages/ui source but did not run `registry:build`, so the generated shadcn
shim still shipped the old `ref: ... | undefined` type. This regenerates it,
clearing the pre-existing `registry:check` drift that blocks Quality Gates on
every PR.

Claude-Session: https://claude.ai/code/session_01CbnP4KD8kio2hozz54h9zV
@bntvllnt

Copy link
Copy Markdown
Collaborator Author

Bundled a second commit (1ecd7f7) regenerating the prompt-input shadcn shim. Quality Gates' registry:check was failing on pre-existing drift from #443 (ce98eca changed the canonical packages/ui source's ref prop to optional but never ran registry:build, leaving the generated shim stale at ref: ... | undefined). One-line generated-artifact sync; unrelated to the count fix but required to clear the gate on this branch.

@bntvllnt bntvllnt merged commit 5dae6af into main Jun 25, 2026
8 checks passed
@bntvllnt bntvllnt deleted the worktree-fix+component-count-drift branch June 25, 2026 23:02
bntvllnt added a commit that referenced this pull request Jun 25, 2026
Regenerate registry.json via `registry:build` so the committed
artifacts match the canonical component sources picked up from main
(#443 prompt-input optional ref, #450 component-count). Clears the
Quality Gates registry-drift check.

Claude-Session: https://claude.ai/code/session_01Mx9zT1QTSPnBFFxErJ2UrW
bntvllnt added a commit that referenced this pull request Jun 26, 2026
…309)

Resolves the CHANGELOG conflict and brings the release-prep branch up to
date with everything that landed on main since it was authored (React 19
migration, core/forms/charts/motion families, count-derivation #450).

- Component count corrected everywhere to the registry-derived 309 (was
  225/295 across CHANGELOGs, READMEs, package.json, ARCHITECTURE, ROADMAP).
- ROADMAP headline counts recomputed (+169 net from the 140 baseline);
  curated list relabeled as a highlight subset.
- 0.3.0 changelog dates refreshed to 2026-06-26.
- component-count.test.ts: assert the *newest* CHANGELOG count snapshot
  (not strictly [Unreleased]) so the drift guard survives a release cut —
  after this PR the count lives in [0.3.0] and [Unreleased] is empty.

Claude-Session: https://claude.ai/code/session_01KB2yTDBo7Knydqvz1VvFdF
bntvllnt added a commit that referenced this pull request Jun 27, 2026
Closes #432

Makes `main` ready to cut **stable 0.3.0** (per `docs/RELEASING.md`).
**Docs + one test-guard tweak — this PR does not release.** Merge →
dispatch Publish is the separate next step.

> **Refreshed 2026-06-26:** rebuilt on top of current `main` (was 9 days
stale / conflicting). Reconciled with everything that landed since it
was authored — React 19 migration (#441), the core/forms/charts/motion
families, and the count-derivation fix (#450).

## Changes
- **Changelogs** (`CHANGELOG.md` + `packages/ui/CHANGELOG.md`):
`[Unreleased]` → dated **`[0.3.0] - 2026-06-26`** (the publish
workflow's release gate greps `## [0.3.0]`), dropped the now-satisfied
pre-release notes, added the granular 0.3.0-train families (form
primitives, charts/dataviz, AI/core primitives, motion/effects), a
**Fixed** entry (theme-adaptive `CandlestickChart`/`SparklineGrid`
colors), the `v0.3.0` link reference, and a fresh empty `[Unreleased]`.
- **Component count → 309 everywhere.** The single source of truth is
`registry.items.length` (= 309 after #450). Synced every prose surface
that drifted: `README.md` (×3), `packages/ui/README.md`,
`packages/ui/package.json` `"description"`, `docs/ARCHITECTURE.md`, and
the ROADMAP. (The earlier 144→225 / 295 numbers are superseded.)
- **ROADMAP**: status `planning` → `release prep`; `milestone TBD` →
real 0.3.0 milestone; headline counts recomputed to **+169** net (140 →
309); the curated component list is relabeled as a highlight subset (it
enumerates the first ~85, not all 169).
- **RELEASING.md**: documents the `apps/registry` version bump, the full
doc-sync step (now incl. `packages/ui/package.json` description + the
count-guard test), and the **post-publish** `PUBLISHED_VERSION` flip.
- **`apps/registry/lib/component-count.test.ts`** (added on `main` by
#450): the guard asserted the count lives in `[Unreleased]`. Cutting the
release moves it into `[0.3.0]` and empties `[Unreleased]`, which would
break that guard. Retargeted it to assert the **newest** count snapshot
in the changelog (first match, file is newest-first) — works both
between releases and immediately after a cut. Still pins to
`registry.items.length`.

## Deliberately NOT here
- **No `PUBLISHED_VERSION` flip.** It stays `^0.2.1` until 0.3.0 is live
on npm `latest`; flipping before publish would make the deployed
registry advertise an unpublished version and break `npx shadcn add`.
Documented post-publish follow-up.
- No version bump — `packages/ui` and `apps/registry` are already
`0.3.0`.

## Verification
Count guard simulated against the real files (no local `node_modules` in
the branch worktree; CI runs the real suite):
- newest `CHANGELOG.md` count snapshot = **309** ==
`registry.items.length`
- `home/{en,fr}.mdx` count claims all = **309**
- PWA manifest derives from the registry (unchanged on `main`)

## Release sequence after this merges
1. Merge this PR (canary republishes `0.3.0-canary.<sha>`).
2. **Actions → Publish → Run workflow** on `main` → tags `v0.3.0`,
publishes `--tag latest`, GitHub Release.
3. Post-publish PR: flip `PUBLISHED_VERSION` → `0.3.0` + regenerate
registry (drift/integrity guards verify it).

---------

Co-authored-by: bntvllnt <bntvllnt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Component count drifts: homepage shows live 309, copy/changelog hardcode stale 225

1 participant