-
Notifications
You must be signed in to change notification settings - Fork 34
Fix changelog render empty sections #2569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lcawl
wants to merge
8
commits into
main
Choose a base branch
from
changelog-render-cleanup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+1,001
−37
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ect' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
🔍 Preview links for changed docs |
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
As noted in #2568, there is an outstanding issue in the
docs-builder changelog rendercommand output where we ought to handle empty sections better.That is to say, if certain areas are blocked from the output, their section titles should not appear in the output.
Likewise if all content on a page is commented out, a default phrase should be added to avoid blank pages.
I've also merged #2570 into this PR, which improves the render command messages.
Screenshots
Before
When testing with files from elastic/elasticsearch#140795, if changelogs were blocked due to their areas, the area sections still appeared in the output, for example:
Likewise empty sections appeared in the
index.mdfile, for example:After
With this fix, when all content on a page is blocked, a default phrase is added (and the empty sections' titles are commented out), for example:
... and the empty sections' titles are likewise hidden in the
index.mdfile:Changes Made
1. Fixed Block Configuration Regression
Problem: Changelog entries were not being commented out based on
block>publishconfiguration inchangelog.yml.Solution:
ChangelogConfigurationtoChangelogRenderContextto pass configuration through the rendering pipelineChangelogRenderUtilities.ShouldHideEntryto check block configuration rulesShouldHideEntrymethodFiles Modified:
src/services/Elastic.Changelog/Rendering/ChangelogRenderContext.cs- AddedConfigurationpropertysrc/services/Elastic.Changelog/Rendering/ChangelogRenderingService.cs- Pass configuration to contextsrc/services/Elastic.Changelog/Rendering/ChangelogRenderUtilities.cs- Implemented block checking logicShouldHideEntry2. Empty Subsection Header Commenting
Feature: When using
--subsectionsoption, subsection headers are commented out if all entries within that subsection are blocked.Implementation:
%prefix for regular entries,<!-- -->HTML comments for breaking changes/deprecations/known issues//prefix for all subsection headersFiles Modified:
src/services/Elastic.Changelog/Rendering/Markdown/IndexMarkdownRenderer.cssrc/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cssrc/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cssrc/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cssrc/services/Elastic.Changelog/Rendering/Asciidoc/EntriesByAreaAsciidocRenderer.cssrc/services/Elastic.Changelog/Rendering/Asciidoc/BreakingChangesAsciidocRenderer.cssrc/services/Elastic.Changelog/Rendering/Asciidoc/DeprecationsAsciidocRenderer.cssrc/services/Elastic.Changelog/Rendering/Asciidoc/KnownIssuesAsciidocRenderer.cs3. "No Items" Messages for Empty Pages
Feature: When all entries in a changelog file are blocked, display a descriptive message while keeping the commented-out content.
Behavior:
Updated Messages:
_There are no breaking changes associated with this release.__There are no deprecations associated with this release.__There are no known issues associated with this release.__There are no new features, enhancements, or fixes associated with this release._Files Modified:
src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cssrc/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cssrc/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cssrc/services/Elastic.Changelog/Rendering/Markdown/IndexMarkdownRenderer.cs4. Comprehensive Test Coverage
Added Tests: Created
BlockConfigurationTests.cswith 12 test cases covering:RenderChangelogs_WithBlockedArea_CommentsOutMatchingEntries- Basic blocking by areaRenderChangelogs_WithBlockedType_CommentsOutMatchingEntries- Blocking by typeRenderChangelogs_WithGlobalBlockedArea_CommentsOutMatchingEntries- Global block configurationRenderChangelogs_WithProductSpecificOverride_OverridesGlobalBlock- Product-specific overridesRenderChangelogs_WithMultipleBlockedAreas_CommentsOutAllMatchingEntries- Multiple blocked areasRenderChangelogs_WithBlockedArea_BreakingChange_UsesBlockComments- Breaking changes use HTML commentsRenderChangelogs_WithBlockedArea_KnownIssue_UsesBlockComments- Known issues use HTML commentsRenderChangelogs_WithSubsections_CommentsOutEmptySubsectionHeaders- Empty subsection headers are commentedRenderChangelogs_WithAllEntriesBlocked_ShowsNoItemsMessage- "No items" message for index.mdRenderChangelogs_WithAllBreakingChangesBlocked_ShowsNoBreakingChangesMessage- "No items" message for breaking changesRenderChangelogs_WithAllDeprecationsBlocked_ShowsNoDeprecationsMessage- "No items" message for deprecationsRenderChangelogs_WithAllKnownIssuesBlocked_ShowsNoKnownIssuesMessage- "No items" message for known issuesFile Created:
tests/Elastic.Changelog.Tests/Changelogs/Render/BlockConfigurationTests.csTechnical Details
Block Configuration Logic
The
ShouldHideEntrymethod checks entries in this order:feature-idin the hide list)block.product.{productId}.publish)block.publish)Blocking rules use OR logic:
typesis specified and entry type matches → blockareasis specified and entry has matching area → blockCommenting Syntax
%prefix for each line<!-- -->HTML comment blocks//prefix for headers and contentTesting
Impact
changelog.ymlconfigurationGenerative AI disclosure
Tool(s) and model(s) used: composer-1