Skip to content

Remove empty sections from changelog directive#3369

Open
lcawl wants to merge 4 commits into
mainfrom
changelog-directive-empty-sections
Open

Remove empty sections from changelog directive#3369
lcawl wants to merge 4 commits into
mainfrom
changelog-directive-empty-sections

Conversation

@lcawl
Copy link
Copy Markdown
Contributor

@lcawl lcawl commented May 21, 2026

Fixes #3368

AI Summary

Improves {changelog} rendering for dedicated release-notes pages and removes low-value empty output on general release-notes pages. Release note pages such as known issues, deprecations, and breaking changes no longer show redundant section headings, empty dated releases, or “there are no … associated with this release” placeholders.

Problem

On pages that already have an H1 and use :type: to narrow entries (for example :type: known-issue on a known-issues page), the directive was still emitting:

  • Redundant ### Deprecations / ### Breaking changes / ### Known issues under each ## {version}
  • ## {version} blocks with no matching entries, often with italic placeholder text
  • Matching TOC entries and anchors for those empty releases

Behavior changes

Dedicated type pages (:type: breaking-change, deprecation, known-issue, highlight):

Aspect Before After
Section H3 (### Deprecations, etc.) Shown under each version Omitted; entries render under ## {version}
:subsections: N/A for separated types in practice Area grouping preserved (no redundant type-level H3)
Empty release (no matching entries) Version + placeholder message Entire version block omitted (including bundle description)
TOC / anchors Version + type subsection Version only when entries exist; no type subsection

General release notes (default or :type: all):

Aspect Before After
Section H3s Shown when type has entries Unchanged
Empty release Version + _There are no …_ / _No new features…_ Omitted entirely
Empty release with bundle description N/A (still showed placeholder) ## {version} + description only (e.g. pulled release)
Empty release with release-date only Would show version + _Released: …_ Omitted (release-date does not preserve an empty release)
All entries hidden via hide-features Version still in TOC/output Omitted from TOC, output, and anchors

Breaking change: Empty placeholder messages are removed with no opt-out flag.

Out of scope: changelog render CLI (static file output) is unchanged.

Implementation notes

  • Shared helpers on ChangelogInlineRenderer: IsDedicatedSeparatedTypePage, GetFilteredEntries, BundleHasRenderableEntries, ShouldRenderEmptyBundleMetadata (description only)
  • RenderChangelogMarkdown skips whitespace-only bundle output; returns null when nothing renders
  • ChangelogBlock TOC and anchors use the same filtering logic via BundleContributesToNavigation
  • RenderSeparatedTypeEntries uses area grouping when :subsections: is set on dedicated pages

Files changed

File Change
src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs Dedicated-page layout, empty-bundle omission, removed GetEmptyMessage
src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs TOC/anchor parity with renderer
tests/Elastic.Markdown.Tests/Directives/ChangelogTypeFilterTests.cs Updated assertions; new tests (mixed bundles, description, release-date-only, subsections, dedicated page ignores description)
tests/Elastic.Markdown.Tests/Directives/ChangelogTocFilteringTests.cs All entries hidden → omit version from TOC/output
tests/Elastic.Markdown.Tests/Directives/ChangelogBasicTests.cs Empty bundle test updated
docs/syntax/changelog.md Documents empty-release and description-only preservation

Screenshots

Before

Per elastic/docs-content#6599

Unnecessary deprecation headings:

image

Empty breaking change sections:

image

After

No more unnecessary deprecation headings:

image

No more empty breaking change sections:

image

Generative AI disclosure

  1. Did you use a generative AI (GenAI) tool to assist in creating this contribution?
  • Yes
  • No
  1. If you answered "Yes" to the previous question, please specify the tool(s) and model(s) used (e.g., Google Gemini, OpenAI ChatGPT-4, etc.).

Tool(s) and model(s) used: composer-2.5, claude-4-sonnet-thinking

@lcawl lcawl temporarily deployed to integration-tests May 21, 2026 03:20 — with GitHub Actions Inactive
@lcawl lcawl marked this pull request as ready for review May 21, 2026 03:27
@lcawl lcawl requested review from a team as code owners May 21, 2026 03:27
@lcawl lcawl requested review from cotti and technige May 21, 2026 03:27
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates changelog rendering so headings, TOC anchors, and version blocks are produced only when bundles contain entries after publish-blocker, hide-features, and :type: filtering. ChangelogInlineRenderer adds helpers to classify page types, compute filtered entries, and decide when to render empty bundle metadata; it skips blank bundle outputs and returns null when nothing renders. ChangelogBlock uses filtered counts to emit anchors/TOC and respects dedicated-page semantics. Tests were updated and extended to validate omission and description-preserving rules.

Sequence Diagram(s)

sequenceDiagram
  participant ChangelogBlock
  participant ChangelogInlineRenderer
  participant LoadedBundle
  participant TOC
  participant Output

  ChangelogBlock->>ChangelogInlineRenderer: GetFilteredEntries(bundle, publishBlocker, hideFeatures, typeFilter)
  ChangelogInlineRenderer->>LoadedBundle: filter entries (publishBlocker, hideFeatures, typeFilter)
  LoadedBundle-->>ChangelogInlineRenderer: filtered entries list
  ChangelogInlineRenderer-->>ChangelogBlock: filtered counts / renderable flag
  ChangelogBlock->>TOC: ComputeTableOfContent(filtered counts, dedicatedPage)
  ChangelogBlock->>ChangelogInlineRenderer: GenerateMarkdown(for each bundle)
  ChangelogInlineRenderer->>Output: Render bundle markdown or skip / render metadata
  ChangelogBlock->>Output: Assemble TOC + bundle sections (only non-empty)
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.07% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: removing empty sections from the changelog directive rendering.
Description check ✅ Passed The description comprehensively explains the problem, behavior changes, implementation details, and provides visual examples demonstrating the improvements.
Linked Issues check ✅ Passed The PR fully addresses issue #3368 by implementing omission of empty sections, redundant headings, and placeholder messages across dedicated and general release-notes pages.
Out of Scope Changes check ✅ Passed All changes are within scope: renderer refactoring, TOC/anchor parity, comprehensive test updates, and documentation updates directly support the empty-section omission objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch changelog-directive-empty-sections

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs`:
- Around line 735-745: The current branch uses RenderDetailedEntries (dropdown
rendering) whenever subsections is true, causing dropdowns even if
dropdownsEnabled is false; change the conditional so that when subsections is
true AND dropdownsEnabled is false you call a flattened-by-area renderer
(implement the proposed RenderDetailedEntriesFlattenedByArea or similar) instead
of RenderDetailedEntries; update the call sites to pass the same parameters
(entries, repo, owner, hideLinks, hideEntryDescriptions, publishBlocker) and
ensure RenderDetailedEntryFlattened is used to render each entry, leaving the
existing RenderDetailedEntries and RenderDetailedEntriesFlattened behavior
unchanged for other cases, and keep the original branch for dropdownsEnabled ==
true to call RenderDetailedEntries.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 63165254-262f-48af-8921-9e27b9d741a7

📥 Commits

Reviewing files that changed from the base of the PR and between 3b959cd and b3a0062.

📒 Files selected for processing (6)
  • docs/syntax/changelog.md
  • src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.cs
  • src/Elastic.Markdown/Myst/Directives/Changelog/ChangelogInlineRenderer.cs
  • tests/Elastic.Markdown.Tests/Directives/ChangelogBasicTests.cs
  • tests/Elastic.Markdown.Tests/Directives/ChangelogTocFilteringTests.cs
  • tests/Elastic.Markdown.Tests/Directives/ChangelogTypeFilterTests.cs

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/Elastic.Markdown.Tests/Directives/ChangelogTypeFilterTests.cs (1)

207-225: ⚡ Quick win

Rename new tests to Method_Scenario_Expected format.

The two new test names don’t follow the test naming convention required for tests/**/*.cs. Please rename them to the Method_Scenario_Expected pattern for consistency.

As per coding guidelines, "Test method naming convention: Method_Scenario_Expected."

🤖 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 `@tests/Elastic.Markdown.Tests/Directives/ChangelogTypeFilterTests.cs` around
lines 207 - 225, The two test methods
TableOfContentsIncludesSeparatedTypeSections and
SeparatedTypeTocSlugsMatchHtmlIds must be renamed to follow the
Method_Scenario_Expected convention; update
TableOfContentsIncludesSeparatedTypeSections to a name like
GenerateTableOfContents_SeparatedTypes_IncludesSections and rename
SeparatedTypeTocSlugsMatchHtmlIds to something like
GenerateTableOfContents_SeparatedTypes_SlugsMatchHtmlIds (or equivalent
Method_Scenario_Expected names) so the tests in
Directives/ChangelogTypeFilterTests.cs conform to the project naming standard.
🤖 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.

Nitpick comments:
In `@tests/Elastic.Markdown.Tests/Directives/ChangelogTypeFilterTests.cs`:
- Around line 207-225: The two test methods
TableOfContentsIncludesSeparatedTypeSections and
SeparatedTypeTocSlugsMatchHtmlIds must be renamed to follow the
Method_Scenario_Expected convention; update
TableOfContentsIncludesSeparatedTypeSections to a name like
GenerateTableOfContents_SeparatedTypes_IncludesSections and rename
SeparatedTypeTocSlugsMatchHtmlIds to something like
GenerateTableOfContents_SeparatedTypes_SlugsMatchHtmlIds (or equivalent
Method_Scenario_Expected names) so the tests in
Directives/ChangelogTypeFilterTests.cs conform to the project naming standard.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 768a26a5-05b3-4e1d-b43c-f447df7904ec

📥 Commits

Reviewing files that changed from the base of the PR and between e290914 and 94b761c.

📒 Files selected for processing (2)
  • tests/Elastic.Markdown.Tests/Directives/ChangelogIndexPageTocTests.cs
  • tests/Elastic.Markdown.Tests/Directives/ChangelogTypeFilterTests.cs
✅ Files skipped from review due to trivial changes (1)
  • tests/Elastic.Markdown.Tests/Directives/ChangelogIndexPageTocTests.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Omit empty sections in generated release notes

1 participant