Repository navigation
Auto-detect blog post releases at build time - #1902
Conversation
The blog-release-data Docusaurus plugin now determines release versions dynamically during the build process instead of relying solely on frontmatter. Release detection priority: 1. Frontmatter `release` field (for manual overrides) 2. Git-based detection: finds the first stable release tag containing the commit that introduced the blog post 3. Falls back to 'unreleased' if neither method succeeds This fixes the changelog displaying recently released features as "Unreleased" by enabling automatic release detection for posts without explicit frontmatter entries. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <[email protected]>
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
📝 WalkthroughWalkthroughAdds end-to-end release detection for blog posts: frontmatter override → Git-based first stable tag containing the file’s origin commit → 'unreleased'. Exposes helper functions for commit/tag lookup, integrates releaseMap into global data, and updates changelog grouping to use the global release map. Changes
Sequence Diagram(s)sequenceDiagram
participant Repo as Git Repo
participant Plugin as Blog Release Plugin
participant GD as Docusaurus GlobalData
participant UI as ChangelogTimeline
Repo->>Plugin: provide file history (origin commit, tags)
Plugin->>Repo: getFileOriginCommit(filePath)
Plugin->>Repo: getFirstStableRelease(commitSha)
Plugin-->>Plugin: determineRelease(frontMatter, commit-based tag or 'unreleased')
Plugin-->>GD: expose releaseMap (permalink variants -> release)
UI->>GD: read releaseMap
UI->>UI: groupBlogPostsByRelease(items, globalReleaseMap)
UI-->>User: render grouped changelog by release
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1902 +/- ##
==========================================
+ Coverage 73.17% 73.19% +0.01%
==========================================
Files 609 609
Lines 56933 56933
==========================================
+ Hits 41662 41671 +9
+ Misses 12331 12325 -6
+ Partials 2940 2937 -3
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
The ChangelogTimeline component was reading release info directly from frontMatter, ignoring the releaseMap generated by the blog-release-data plugin. Now it uses useGlobalData() to access the plugin's git-computed release mappings, falling back to frontMatter and then 'unreleased'. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
website/plugins/blog-release-data/index.js (1)
128-131: Code doesn't handle nested blog posts, though current structure doesn't require it.
fs.readdirSync(blogDir)only reads the top-level directory. While there are currently no nested blog posts inwebsite/blog/, the implementation would miss any posts placed in subdirectories. Consider addingrecursive: trueoption or documenting the flat-file requirement to prevent future issues if structure changes.
🧹 Nitpick comments (1)
website/plugins/blog-release-data/index.js (1)
43-60: Consider caching tag lookups for build performance.
git tag --containscan be expensive for commits that exist in many tags. For a large blog with many posts sharing commits, the same SHA might be queried multiple times.If build times become a concern, consider memoizing
getFirstStableReleaseresults by SHA.🔎 Optional memoization approach
+const stableReleaseCache = new Map(); + function getFirstStableRelease(sha) { + if (stableReleaseCache.has(sha)) { + return stableReleaseCache.get(sha); + } try { const tags = execSync( `git tag --contains ${sha} --sort=version:refname`, // ... ).trim().split('\n').filter(Boolean); const stableRelease = tags.find((t) => /^v\d+\.\d+\.\d+$/.test(t)) || null; + stableReleaseCache.set(sha, stableRelease); return stableRelease; } catch (e) { + stableReleaseCache.set(sha, null); // ... } }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
website/plugins/blog-release-data/index.js(2 hunks)website/src/components/ChangelogTimeline/index.tsx(3 hunks)website/src/components/ChangelogTimeline/utils.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
website/**
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
website/**: Update website documentation in thewebsite/directory when adding new features, ensure consistency between CLI help text and website documentation, and follow the website's documentation structure and style
Keep website code in thewebsite/directory, follow the existing website architecture and style, and test website changes locally before committing
Keep CLI documentation and website documentation in sync and document new features on the website with examples and use cases
Files:
website/src/components/ChangelogTimeline/index.tsxwebsite/plugins/blog-release-data/index.jswebsite/src/components/ChangelogTimeline/utils.ts
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to CHANGELOG.md : Follow semantic versioning, update CHANGELOG.md with each release, and create GitHub releases with detailed release notes
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to website/blog/**/*.mdx : Follow PR template (what/why/references); PRs labeled minor/major MUST include blog post at website/blog/YYYY-MM-DD-feature-name.mdx with YAML front matter, <!--truncate--> after intro, and only tags from website/blog/tags.yml
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to website/blog/**/*.mdx : Follow PR template (what/why/references); PRs labeled minor/major MUST include blog post at website/blog/YYYY-MM-DD-feature-name.mdx with YAML front matter, <!--truncate--> after intro, and only tags from website/blog/tags.yml
Applied to files:
website/plugins/blog-release-data/index.js
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to CHANGELOG.md : Follow semantic versioning, update CHANGELOG.md with each release, and create GitHub releases with detailed release notes
Applied to files:
website/plugins/blog-release-data/index.js
📚 Learning: 2025-12-16T18:20:55.630Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-16T18:20:55.630Z
Learning: Applies to website/blog/**/*.mdx : Blog posts MUST use only tags defined in website/blog/tags.yml and authors defined in website/blog/authors.yml; valid tags are: feature, enhancement, bugfix, dx, breaking-change, security, documentation, deprecation, core; never invent new tags
Applied to files:
website/plugins/blog-release-data/index.js
🧬 Code graph analysis (2)
website/src/components/ChangelogTimeline/index.tsx (2)
website/plugins/blog-release-data/index.js (1)
releaseMap(126-126)website/src/components/ChangelogTimeline/utils.ts (1)
groupBlogPostsByRelease(93-121)
website/src/components/ChangelogTimeline/utils.ts (2)
website/src/components/ChangelogTimeline/index.tsx (1)
BlogPostItem(95-95)website/plugins/blog-release-data/index.js (2)
release(77-77)release(138-138)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Summary
🔇 Additional comments (10)
website/src/components/ChangelogTimeline/index.tsx (3)
2-2: LGTM on the import.Clean addition of the Docusaurus hook.
24-29: Type assertion is reasonable here.The optional chaining on
releaseData?.releaseMapensures graceful handling if the plugin data is unavailable. The fallback toundefinedforreleaseMapis correctly handled downstream ingroupBlogPostsByRelease.One minor consideration: if the plugin name changes, this lookup silently fails. You might consider a defensive log or comment noting the dependency on the plugin name
'blog-release-data'.
41-43: Memoization dependency array is correct.Including
releaseMapensures the grouped items recompute when the release data changes. Solid integration.website/plugins/blog-release-data/index.js (4)
21-35: Git command looks correct.The
--follow --diff-filter=Acombination correctly traces renames and finds the original commit. Good error handling with the try-catch and warning.One note: if the repository is in a detached HEAD state or shallow clone (common in CI), this might return null. The fallback to 'unreleased' handles this gracefully.
68-85: Clean orchestration logic.The priority order (frontmatter → git → unreleased) is well-documented and implemented correctly.
94-118: Permalink format handling is thorough.Covering both slug-only and date-based paths with trailing slash variants ensures robust lookup. The distinction between
slug(from frontmatter) andslugPart(from filename) on line 106 is correct—date-based permalinks use the filename slug, not the frontmatter override.
142-146: Helpful debug logging.The summary output aids debugging without being overly verbose. Note that it counts permalink entries, not unique files (each file generates multiple permalinks).
website/src/components/ChangelogTimeline/utils.ts (3)
88-96: Clean function signature update.Optional parameter maintains backward compatibility. JSDoc is clear.
99-111: Release resolution logic is solid.The priority chain (frontMatter → globalReleaseMap with trailing slash fallback → 'unreleased') mirrors the plugin's detection order. The dual permalink lookup (
permalinkand${permalink}/) handles URL normalization edge cases well.
114-120: Grouping and sorting unchanged in behavior.Variable rename to
releaseGroupsimproves readability by distinguishing from theglobalReleaseMapparameter.
|
These changes were released in v1.202.1. |
what
blog-release-dataDocusaurus plugin to compute release versions dynamically at build time using gitreleasefrontmatter now automatically resolve to their release versionwhy
The changelog was displaying recently released features as "Unreleased" because the plugin only read from blog post frontmatter. By detecting releases during the build process, we eliminate timing issues and ensure the website always shows accurate release information.
references
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.