Repository navigation
ref(registry): fold changelogs.json into per-slug manifests - #72
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 47 minutes and 31 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThis PR implements ADR 0006 by migrating changelogs from a single global registry file into per-component manifest arrays. The schema is extended to require ChangesChangelog Folding into Component Manifests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
packages/registry-schema/src/index.test.ts (1)
105-114: ⚡ Quick winAssert the failure reason, not just
.ok.This test only checks
ok === false, so it would still pass if the manifest were rejected for an unrelated reason — masking a regression in the ordering refinement itself. The siblingChangelogstest (lines 394-405) pins the error to/newest-first/; mirror that here so the test fails only when the descending-semver rule does.💚 Proposed fix to pin the rejection reason
it("rejects out-of-order changelog entries on the manifest", () => { const bad = { ...goodManifest, changelog: [ { version: "1.0.0", date: "2026-05-20", changes: ["Initial release."] }, { version: "1.1.0", date: "2026-05-21", changes: ["Update."] }, ], }; - expect(validate(ComponentManifest, bad).ok).toBe(false); + const r = validate(ComponentManifest, bad); + expect(r.ok).toBe(false); + if (!r.ok) expect(r.errors.join("\n")).toMatch(/newest-first/); });As per coding guidelines: "Tests must encode WHY behavior matters, not just WHAT it does. A test that can't fail when business logic changes is wrong."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/registry-schema/src/index.test.ts` around lines 105 - 114, The test currently only checks validate(ComponentManifest, bad).ok is false which can mask unrelated failures; update the assertion to pin the rejection reason to the changelog ordering refinement by inspecting the validation error from validate(ComponentManifest, bad) and asserting the error path/message indicates the newest-first rule (e.g., reference to "/newest-first/" or equivalent) so the test fails only when the descending-semver changelog rule is violated; locate the test using the names validate, ComponentManifest and bad/goodManifest and replace the broad ok check with an assertion that the validation error contains the "/newest-first/" indication.scripts/migrate-changelogs-to-slug.mjs (1)
36-71: ⚡ Quick winValidate everything before writing any manifest (avoid partial migration on failure).
The loop writes each manifest in place (Line 58) while validation of slug/filename match (Lines 41-44), missing changelog keys (Lines 46-49), and stray
changelogs.jsonentries (Lines 62-71) is interleaved or deferred until after all writes. Any failure exits with a non-zero code only after some or all manifests have already been mutated, and withregistry/changelogs.jsonstill on disk — leaving the tree half-migrated and requiring a manualgit checkoutto recover.Split into a validate phase (including the stray-entry check) that collects the computed next-states, then a write phase plus
unlinkSynconly once all checks pass.♻️ Two-pass migration
let updated = 0; + const pending = []; for (const file of manifestFiles) { const slug = file.replace(/\.json$/, ""); const manifestPath = path.join(COMPONENTS_DIR, file); const manifest = readJson(manifestPath); if (manifest.slug !== slug) { console.error(`${file}: slug field "${manifest.slug}" does not match filename`); process.exit(1); } if (!(slug in changelogs)) { console.error(`changelogs.json: missing entry for "${slug}"`); process.exit(1); } const { motion, ...rest } = manifest; const next = { ...rest, changelog: changelogs[slug], ...(motion ? { motion } : {}), }; - - fs.writeFileSync(manifestPath, `${JSON.stringify(next, null, 2)}\n`); - updated++; + pending.push({ manifestPath, next }); } const changelogSlugs = new Set(Object.keys(changelogs)); for (const file of manifestFiles) { changelogSlugs.delete(file.replace(/\.json$/, "")); } if (changelogSlugs.size > 0) { console.error( `changelogs.json has stray entries: ${[...changelogSlugs].sort().join(", ")}`, ); process.exit(1); } + + for (const { manifestPath, next } of pending) { + fs.writeFileSync(manifestPath, `${JSON.stringify(next, null, 2)}\n`); + updated++; + }Based on learnings: "Scaffold/CLI scripts must validate collisions (manifest.json order, existing paths) before creating files, never write then throw."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/migrate-changelogs-to-slug.mjs` around lines 36 - 71, The script currently writes manifests in the first loop (fs.writeFileSync inside the for-of over manifestFiles) before all validations complete, causing partial migrations on failure; change to a two-pass process: first iterate manifestFiles, use readJson and the existing slug checks (manifest.slug vs slug) and changelogs membership checks to validate everything and build a Map (or object) of manifestPath -> computed next JSON string (the "next" value you already compute), also perform the stray-entry check using changelogSlugs; only if all validations pass, do a second pass that writes the precomputed values to disk with fs.writeFileSync (and perform any fs.unlinkSync removals once after validation if needed). Reference symbols: manifestFiles, readJson, manifest.slug, changelogs, changelogSlugs, next, manifestPath, fs.writeFileSync, fs.unlinkSync.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@registry/components/gradient-text-reveal.json`:
- Around line 108-110: The JSON entry sets motion.reducedMotion to "none" but
lacks the required justification; add a motion.performanceNotes property
alongside motion.reducedMotion in the gradient-text-reveal.json component
explaining why the OS reduced-motion preference is intentionally not honored
(e.g., necessary for core UX, accessibility tradeoff, or performance
constraints), referencing the motion.reducedMotion field in your message so
reviewers can see the rationale.
In `@registry/components/horizontal-scroll-gallery.json`:
- Around line 84-86: The manifest sets motion.reducedMotion to "none" but lacks
motion.performanceNotes; add a motion.performanceNotes string explaining why the
component intentionally does not honor the user's OS reduced-motion preference
(e.g., brief rationale and any mitigation) so the rule for registry components
is satisfied; update the JSON for the horizontal-scroll-gallery component by
adding the motion.performanceNotes property alongside motion.reducedMotion with
a concise explanation.
In `@registry/components/hover-reveal-card.json`:
- Around line 123-125: Add a new motion.performanceNotes field next to
motion.reducedMotion in the hover-reveal-card component JSON to document why the
OS reduced-motion preference is intentionally not honored; update the object
that contains motion.reducedMotion ("none") to include a concise explanation
(e.g., required for key interaction/animation fidelity, technical constraints,
or accessibility tradeoffs) so the entry reads motion.reducedMotion and
motion.performanceNotes, referencing the hover-reveal-card component and the
motion block to locate where to add the note.
---
Nitpick comments:
In `@packages/registry-schema/src/index.test.ts`:
- Around line 105-114: The test currently only checks
validate(ComponentManifest, bad).ok is false which can mask unrelated failures;
update the assertion to pin the rejection reason to the changelog ordering
refinement by inspecting the validation error from validate(ComponentManifest,
bad) and asserting the error path/message indicates the newest-first rule (e.g.,
reference to "/newest-first/" or equivalent) so the test fails only when the
descending-semver changelog rule is violated; locate the test using the names
validate, ComponentManifest and bad/goodManifest and replace the broad ok check
with an assertion that the validation error contains the "/newest-first/"
indication.
In `@scripts/migrate-changelogs-to-slug.mjs`:
- Around line 36-71: The script currently writes manifests in the first loop
(fs.writeFileSync inside the for-of over manifestFiles) before all validations
complete, causing partial migrations on failure; change to a two-pass process:
first iterate manifestFiles, use readJson and the existing slug checks
(manifest.slug vs slug) and changelogs membership checks to validate everything
and build a Map (or object) of manifestPath -> computed next JSON string (the
"next" value you already compute), also perform the stray-entry check using
changelogSlugs; only if all validations pass, do a second pass that writes the
precomputed values to disk with fs.writeFileSync (and perform any fs.unlinkSync
removals once after validation if needed). Reference symbols: manifestFiles,
readJson, manifest.slug, changelogs, changelogSlugs, next, manifestPath,
fs.writeFileSync, fs.unlinkSync.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f1d3bb15-464b-4b5f-b1d9-51a14cd4b5c9
📒 Files selected for processing (83)
.claude/skills/add-component/SKILL.md.cursor/rules/coderabbit-review-patterns.mdcCLAUDE.mdapps/www/app/changelog/page.tsxdocs/adr/0003-fold-metadata-into-slug-manifests.mddocs/adr/0006-fold-changelogs-into-slug-manifests.mdpackage.jsonpackages/registry-schema/src/index.test.tspackages/registry-schema/src/index.tsregistry/changelogs.jsonregistry/components/3d-tilt-card.jsonregistry/components/ambient-glow-card.jsonregistry/components/animated-glowing-text-outline.jsonregistry/components/animated-tabs.jsonregistry/components/animated-timeline.jsonregistry/components/aurora-background.jsonregistry/components/bento-grid.jsonregistry/components/blur-reveal.jsonregistry/components/border-beam.jsonregistry/components/caustic-light-card.jsonregistry/components/chromatic-aberration-reveal.jsonregistry/components/confetti-burst.jsonregistry/components/count-up.jsonregistry/components/cursor-trail.jsonregistry/components/data-table.jsonregistry/components/dot-grid-background.jsonregistry/components/drawer-slide.jsonregistry/components/dynamic-info.jsonregistry/components/flip-card.jsonregistry/components/floating-dock.jsonregistry/components/glow-hero-section.jsonregistry/components/gradient-text-reveal.jsonregistry/components/hero-iridescent-sweep.jsonregistry/components/hero-liquid-aurora-mesh.jsonregistry/components/hero-logo-marquee.jsonregistry/components/hero-magnetic-letters.jsonregistry/components/hero-noise-dot-field.jsonregistry/components/hero-reference-pulse.jsonregistry/components/hero-terminal.jsonregistry/components/horizontal-scroll-gallery.jsonregistry/components/hover-reveal-card.jsonregistry/components/infinite-marquee.jsonregistry/components/interactive-cursor.jsonregistry/components/iridescent-foil-button.jsonregistry/components/kinetic-variable-headline.jsonregistry/components/limelight-nav.jsonregistry/components/liquid-glass-panel.jsonregistry/components/macbook-mock.jsonregistry/components/magnetic-button.jsonregistry/components/magnetic-text.jsonregistry/components/meteors-card.jsonregistry/components/mini-mac-keyboard.jsonregistry/components/morphing-card-stack.jsonregistry/components/morphing-modal.jsonregistry/components/moving-border.jsonregistry/components/multi-step-auth-card.jsonregistry/components/nested-comments.jsonregistry/components/notification-stack.jsonregistry/components/outlined-mega-mark.jsonregistry/components/particle-field.jsonregistry/components/pen-cursor.jsonregistry/components/radial-menu.jsonregistry/components/refractive-cursor-lens.jsonregistry/components/ripple.jsonregistry/components/scramble-text.jsonregistry/components/scroll-reveal.jsonregistry/components/shader-mesh-gradient.jsonregistry/components/shiny-text.jsonregistry/components/shooting-stars-grid.jsonregistry/components/skeleton-shimmer.jsonregistry/components/spotlight-card.jsonregistry/components/typewriter-text.jsonregistry/components/word-rotate.jsonregistry/types.tsscripts/build-registry.tsscripts/changelogs-from-manifests.test.tsscripts/changelogs-from-manifests.tsscripts/check-agent-docs-drift.mjsscripts/check-agent-docs-drift.test.tsscripts/migrate-changelogs-to-slug.mjsscripts/scaffold-component.mjsscripts/scaffold-component.test.tsscripts/validate-registry.mjs
💤 Files with no reviewable changes (1)
- registry/changelogs.json
Type
Summary
Implements backlog A5b / ADR 0006: folds the global
registry/changelogs.jsonmonolith (~654 lines) into a requiredchangelogarray on eachregistry/components/<slug>.jsonmanifest — the last global slug-keyed merge-conflict file after ADR 0003–0005.Deleted
registry/changelogs.jsonManifest change
Each slug manifest now includes: