Skip to content

Add changelog render --dropdowns#3244

Open
lcawl wants to merge 8 commits intomainfrom
changelog-render-dropdowns
Open

Add changelog render --dropdowns#3244
lcawl wants to merge 8 commits intomainfrom
changelog-render-dropdowns

Conversation

@lcawl
Copy link
Copy Markdown
Contributor

@lcawl lcawl commented May 4, 2026

This PR relates to #3228

In particular, it adds the ability to turn off dropdowns in the "changelog render" output, same as in the changelog directive.

Summary

Users can now use --dropdowns to render separated types (breaking changes, deprecations, known issues, highlights) as MyST dropdowns, or omit the flag for the new default flattened bulleted list format.

Reviewer notes

AI implementation details

All functionality has been successfully implemented according to the plan:

🔹 CLI Command: Added --dropdowns parameter with false default
🔹 Service Layer: Extended with Dropdowns property throughout the rendering pipeline
🔹 All Renderers: Updated to support both dropdown and flattened modes
🔹 Documentation: Added comprehensive CLI documentation
🔹 Tests: Created full test coverage for both rendering modes

There was also an issue with the way content was rendered in the non-dropdown mode when the bulleted item spanned multiple paragraphs. The output is now fixed to work as described in https://elastic.github.io/docs-builder/syntax/lists/#content-within-a-list-item:

Before (broken):

* Show callout for deprecated (in-use) ILM policies.
  The logs, metrics, and synthetics ILM policies have been deprecated...

For more information, check [#243416](https://github.com/elastic/kibana/pull/243416).

After (fixed):

* Show callout for deprecated (in-use) ILM policies.
  The logs, metrics, and synthetics ILM policies have been deprecated...
   
  For more information, check [#243416](https://github.com/elastic/kibana/pull/243416).

Tests

I tested with some made-up changelogs in the kibana repo as follows:

  1. Create some breaking change and deprecation changelogs with some description, impact, and action fields.
  2. Create a bundle.
  3. Run the "changelog render" command with the new --dropdowns option, for example:
    docs-builder changelog render \
    --input ./docs/releases/kibana/changelog-bundle.yaml \
    --file-type markdown \
    --output ./docs/release-notes/_snippets \
    --dropdowns
  4. Preview the output and confirm that the dropdowns look good. For example:
    image
  5. Re-run the command but omit the --dropdowns command option. Preview and verify that it's properly formatted:
    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, claude-4-sonnet-thinking

@lcawl lcawl marked this pull request as ready for review May 6, 2026 21:52
@lcawl lcawl requested review from a team as code owners May 6, 2026 21:52
@lcawl lcawl requested a review from cotti May 6, 2026 21:52
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a new --dropdowns CLI option and a Dropdowns flag propagated through RenderChangelogsArguments -> ChangelogRenderingService -> ChangelogRenderContext. Markdown renderers (BreakingChanges, Deprecations, Highlights, KnownIssues) now branch on context.Dropdowns to emit either MyST dropdown blocks or flattened bullet/list output. MarkdownRendererBase introduces PrIssueLinkOptions to support indentation for list-style PR/issue rendering. AsciiDoc renderers were adjusted for list-continuation, invariant-culture headers, and conditional subsection grouping; docs and tests were added/updated.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as ChangelogCommand
    participant Service as ChangelogRenderingService
    participant Context as ChangelogRenderContext
    participant Renderers as MarkdownRenderers
    participant Output

    User->>CLI: run changelog render --dropdowns
    CLI->>Service: RenderChangelogsArguments(dropdowns)
    Service->>Service: SetupOutput() (title/slug)
    Service->>Context: initialize (Dropdowns = input.Dropdowns)
    Service->>Renderers: render each section with Context

    alt Dropdowns = true
        Renderers->>Output: emit MyST dropdown blocks
    else Dropdowns = false
        Renderers->>Output: emit flattened bullet lists (indented links)
    end

    Output->>User: rendered files (md or asciidoc)
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.11% 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 'Add changelog render --dropdowns' directly summarizes the main change: adding a new CLI flag for dropdown rendering control.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description clearly describes adding a --dropdowns flag to control changelog render output format between dropdown and flattened modes, with documented testing and implementation details.

✏️ 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-render-dropdowns

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

🧹 Nitpick comments (1)
src/services/Elastic.Changelog/Rendering/Markdown/MarkdownRendererBase.cs (1)

42-48: ⚡ Quick win

Consider folding the parameters into a small record.

Both overloads now exceed the 4-parameter cap, and call sites pass entryHideLinks positionally next to a second bool indentForListItem. A small PrIssueLinkOptions(ChangelogEntry Entry, string Repo, string Owner, bool HideLinks, bool IndentForListItem) would collapse this to RenderPrIssueLinks(sb, options) and remove the bool-adjacency at call sites.

As per coding guidelines: "Method parameters should not exceed 4 in count. Use a record or options object for methods that require more than 4 parameters. Boolean parameters must be named at call sites."

🤖 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 `@src/services/Elastic.Changelog/Rendering/Markdown/MarkdownRendererBase.cs`
around lines 42 - 48, The RenderPrIssueLinks overloads exceed the 4-parameter
guideline and pass two adjacent bools positionally; create a small record (e.g.,
PrIssueLinkOptions with properties ChangelogEntry Entry, string Repo, string
Owner, bool HideLinks, bool IndentForListItem) and change both method signatures
to RenderPrIssueLinks(StringBuilder sb, PrIssueLinkOptions options); update
internal references inside MarkdownRendererBase to use options.* and update all
call sites to pass a named PrIssueLinkOptions instance (ensuring bools are named
via properties) so callers become RenderPrIssueLinks(sb, new PrIssueLinkOptions
{ Entry = entry, Repo = entryRepo, Owner = entryOwner, HideLinks =
entryHideLinks, IndentForListItem = indentForListItem }); ensure overload
forwarding is removed or adjusted accordingly.
🤖 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 `@tests/Elastic.Changelog.Tests/Changelogs/Render/DropdownRenderTests.cs`:
- Around line 419-422: The test asserts AsciiDoc uses unconstrained strong
markers (“**Impact:**”, “**Action:**”) which is non-idiomatic; update the
DropdownRenderTests.cs assertions to expect idiomatic constrained strong markers
("*Impact:*", "*Action:*") or make the assertions tolerant (e.g., regex or
alternatives) to accept either single- or double-asterisk forms so the test
stays valid if AsciidocRendererBase.cs (where the renderer currently emits
"**Impact:**" / "**Action:**" around lines 91 and 97) is changed to emit the
idiomatic single-asterisk format.

---

Nitpick comments:
In `@src/services/Elastic.Changelog/Rendering/Markdown/MarkdownRendererBase.cs`:
- Around line 42-48: The RenderPrIssueLinks overloads exceed the 4-parameter
guideline and pass two adjacent bools positionally; create a small record (e.g.,
PrIssueLinkOptions with properties ChangelogEntry Entry, string Repo, string
Owner, bool HideLinks, bool IndentForListItem) and change both method signatures
to RenderPrIssueLinks(StringBuilder sb, PrIssueLinkOptions options); update
internal references inside MarkdownRendererBase to use options.* and update all
call sites to pass a named PrIssueLinkOptions instance (ensuring bools are named
via properties) so callers become RenderPrIssueLinks(sb, new PrIssueLinkOptions
{ Entry = entry, Repo = entryRepo, Owner = entryOwner, HideLinks =
entryHideLinks, IndentForListItem = indentForListItem }); ensure overload
forwarding is removed or adjusted accordingly.
🪄 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: 0d9d1f38-3e96-48e5-a1c5-c0755a97fcaa

📥 Commits

Reviewing files that changed from the base of the PR and between 9e5d1f3 and e3268b2.

📒 Files selected for processing (11)
  • docs/cli/changelog/render.md
  • src/services/Elastic.Changelog/Rendering/ChangelogRenderContext.cs
  • src/services/Elastic.Changelog/Rendering/ChangelogRenderingService.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/HighlightsMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/MarkdownRendererBase.cs
  • src/tooling/docs-builder/Commands/ChangelogCommand.cs
  • tests/Elastic.Changelog.Tests/Changelogs/Render/DropdownRenderTests.cs
  • tests/Elastic.Changelog.Tests/Changelogs/Render/TitleTargetTests.cs

Comment thread tests/Elastic.Changelog.Tests/Changelogs/Render/DropdownRenderTests.cs Outdated
@lcawl lcawl mentioned this pull request May 7, 2026
2 tasks
* Improve changelog render asciidoc output

* Remove definition lists in favour of subsections
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

🧹 Nitpick comments (1)
src/services/Elastic.Changelog/Rendering/Asciidoc/DeprecationsAsciidocRenderer.cs (1)

31-34: 💤 Low value

Unreachable "General" fallback — dead code.

The ternary on line 33 is inside if (context.Subsections && !string.IsNullOrWhiteSpace(group.Key)), so group.Key is already guaranteed to be non-empty; the "General" branch can never execute. Same dead code appears in EntriesByAreaAsciidocRenderer.cs, HighlightsAsciidocRenderer.cs, and KnownIssuesAsciidocRenderer.cs.

🔧 Proposed fix
-			var componentName = group.Key != string.Empty ? group.Key : "General";
+			var componentName = group.Key;
🤖 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
`@src/services/Elastic.Changelog/Rendering/Asciidoc/DeprecationsAsciidocRenderer.cs`
around lines 31 - 34, The ternary that assigns componentName is dead because the
surrounding if already ensures !string.IsNullOrWhiteSpace(group.Key); update the
code in DeprecationsAsciidocRenderer (and the same pattern in
EntriesByAreaAsciidocRenderer, HighlightsAsciidocRenderer,
KnownIssuesAsciidocRenderer) to remove the unreachable branch and simply use
group.Key (or assign var componentName = group.Key) when calling
ChangelogTextUtilities.FormatAreaHeader; keep the existing null/whitespace guard
(context.Subsections && !string.IsNullOrWhiteSpace(group.Key)) intact.
🤖 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/services/Elastic.Changelog/Rendering/Asciidoc/DeprecationsAsciidocRenderer.cs`:
- Around line 20-22: The code uses entries.GroupBy(...).First() when
context.Subsections is false which throws if entries is empty; update the logic
in DeprecationsAsciidocRenderer (and the same pattern in
EntriesByAreaAsciidocRenderer, HighlightsAsciidocRenderer,
KnownIssuesAsciidocRenderer) so that when context.Subsections is false you
return a single grouping with Key = string.Empty and an empty sequence instead
of calling First(); specifically replace the ternary branch that uses
entries.GroupBy(_ => string.Empty).First() with a safe alternative that
constructs/returns one empty IGrouping<string, T> (or a one-element list
containing an empty group) when entries has no elements, keeping the
groupedEntries variable type unchanged. Ensure you reference the groupedEntries
variable and the context.Subsections branch when making the change.

---

Nitpick comments:
In
`@src/services/Elastic.Changelog/Rendering/Asciidoc/DeprecationsAsciidocRenderer.cs`:
- Around line 31-34: The ternary that assigns componentName is dead because the
surrounding if already ensures !string.IsNullOrWhiteSpace(group.Key); update the
code in DeprecationsAsciidocRenderer (and the same pattern in
EntriesByAreaAsciidocRenderer, HighlightsAsciidocRenderer,
KnownIssuesAsciidocRenderer) to remove the unreachable branch and simply use
group.Key (or assign var componentName = group.Key) when calling
ChangelogTextUtilities.FormatAreaHeader; keep the existing null/whitespace guard
(context.Subsections && !string.IsNullOrWhiteSpace(group.Key)) intact.
🪄 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: b8a791ce-5800-4d0f-93df-69da4440ad32

📥 Commits

Reviewing files that changed from the base of the PR and between e3268b2 and aa32ca1.

📒 Files selected for processing (13)
  • docs/cli/changelog/render.md
  • src/services/Elastic.Changelog/Rendering/Asciidoc/AsciidocRendererBase.cs
  • src/services/Elastic.Changelog/Rendering/Asciidoc/BreakingChangesAsciidocRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Asciidoc/DeprecationsAsciidocRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Asciidoc/EntriesByAreaAsciidocRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Asciidoc/HighlightsAsciidocRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Asciidoc/KnownIssuesAsciidocRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/HighlightsMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/MarkdownRendererBase.cs
  • tests/Elastic.Changelog.Tests/Changelogs/Render/DropdownRenderTests.cs
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/services/Elastic.Changelog/Rendering/Markdown/HighlightsMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cs
  • docs/cli/changelog/render.md
  • tests/Elastic.Changelog.Tests/Changelogs/Render/DropdownRenderTests.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cs

…AsciidocRenderer.cs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

1 participant