Skip to content

Auto-detect blog post releases at build time - #1902

Merged
Andriy Knysh (aknysh) merged 5 commits into
mainfrom
osterman/changelog-unreleased-fix
Dec 21, 2025
Merged

Andriy Knysh (aknysh) merged 5 commits into
mainfrom
osterman/changelog-unreleased-fix

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Dec 20, 2025 •

Copy link
Copy Markdown
Member

what

  • Modified the blog-release-data Docusaurus plugin to compute release versions dynamically at build time using git
  • Blog posts without explicit release frontmatter now automatically resolve to their release version
  • Respects manual frontmatter overrides (highest precedence)

why

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

  • Fixes changelog showing released changes (v1.201.0, v1.202.0) as "Unreleased"

Summary by CodeRabbit

  • New Features

    • Blog posts gain automatic release detection (frontmatter override → VCS-derived stable tag → "unreleased" fallback).
    • Release associations are populated in a global release map and exposed to UI components for consistent version-aware grouping and filtering.
    • Changelog/timeline grouping now uses the global release map for more accurate release-based organization.
  • Chores

    • No public plugin API changes.

✏️ Tip: You can customize this high-level summary in your review settings.

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]>
@github-actions github-actions Bot added the size/m Medium size PR label Dec 20, 2025
@github-actions

github-actions Bot commented Dec 20, 2025 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@osterman Erik Osterman (Cloud Posse) (osterman) added the no-release Do not create a new release (wait for additional code changes) label Dec 20, 2025
@coderabbitai

coderabbitai Bot commented Dec 20, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Blog release detection system
website/plugins/blog-release-data/index.js
Adds release detection flow: getFileOriginCommit(), getFirstStableRelease(), determineRelease(), and addToReleaseMap(); refactors loadContent() to use determineRelease() and populate a releaseMap (multiple permalink variants). Adds debug summary log.
Changelog timeline UI integration
website/src/components/ChangelogTimeline/index.tsx
Reads releaseMap from Docusaurus global data (blog-release-data.default.releaseMap) and passes it to the grouping logic; adds releaseMap to memo deps.
Grouping logic update
website/src/components/ChangelogTimeline/utils.ts
groupBlogPostsByRelease signature updated to accept globalReleaseMap?: Record<string,string>; grouping now resolves release via frontMatter.release → globalReleaseMap[permalink

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review correctness of Git traversal and tag-stability detection in website/plugins/blog-release-data/index.js.
  • Verify permalink variant generation and completeness in addToReleaseMap().
  • Confirm groupBlogPostsByRelease changes correctly handle permalink lookups and fallbacks; ensure memoization deps are adequate.
  • Check integration surface: global data key naming and component consumption (index.tsx).

Possibly related PRs

Suggested reviewers

  • aknysh

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main change: auto-detecting blog post releases at build time using git-based detection, which is the primary objective of the PR.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch osterman/changelog-unreleased-fix

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Dec 20, 2025
@codecov

codecov Bot commented Dec 20, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.19%. Comparing base (f032f56) to head (8cc2830).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests 73.19% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in website/blog/, the implementation would miss any posts placed in subdirectories. Consider adding recursive: true option 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 --contains can 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 getFirstStableRelease results 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 417d60f and 8cc2830.

📒 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 the website/ 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 the website/ 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.tsx
  • website/plugins/blog-release-data/index.js
  • website/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?.releaseMap ensures graceful handling if the plugin data is unavailable. The fallback to undefined for releaseMap is correctly handled downstream in groupBlogPostsByRelease.

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 releaseMap ensures 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=A combination 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) and slugPart (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 (permalink and ${permalink}/) handles URL normalization edge cases well.


114-120: Grouping and sorting unchanged in behavior.

Variable rename to releaseGroups improves readability by distinguishing from the globalReleaseMap parameter.

@aknysh
Andriy Knysh (aknysh) merged commit 6749bfe into main Dec 21, 2025
@aknysh
Andriy Knysh (aknysh) deleted the osterman/changelog-unreleased-fix branch December 21, 2025 00:06
@github-actions

Copy link
Copy Markdown

These changes were released in v1.202.1.

This branch was successfully deployed

1 active deployment
preview — 8cc28307 Deployed Dec 20, 2025 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants