Skip to content

Conversation

@lcawl
Copy link
Contributor

@lcawl lcawl commented Jan 26, 2026

Fixes #2544

Overview

Fixed a regression where changelog entries weren't commented out based on block > publish configuration in changelog.yml, and added tests to prevent regressions.

NOTE: There is an outstanding enhancement to remove the area sections when they're empty. However, that behaviour existed before this regression so we can fix it in a subsequent PR IMO.

Changes Made

1. Fixed Block Configuration Regression

Modified Files

src/services/Elastic.Changelog/Rendering/ChangelogRenderContext.cs

  • Added Configuration property to pass ChangelogConfiguration through the rendering pipeline

src/services/Elastic.Changelog/Rendering/ChangelogRenderUtilities.cs

  • Updated ShouldHideEntry to check block configuration in addition to feature IDs
  • Added GetPublishBlockerForProduct helper to resolve product-specific blockers (with fallback to global blockers)
  • Checks each product ID associated with an entry and blocks if any product's configuration matches

src/services/Elastic.Changelog/Rendering/ChangelogRenderingService.cs

  • Modified BuildRenderContext to accept and pass the configuration to the render context
  • Updated RenderChangelogs to pass configuration to BuildRenderContext

Renderer Updates (all markdown and asciidoc renderers):

  • src/services/Elastic.Changelog/Rendering/Markdown/IndexMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/BreakingChangesMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/DeprecationsMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Markdown/KnownIssuesMarkdownRenderer.cs
  • src/services/Elastic.Changelog/Rendering/Asciidoc/AsciidocRendererBase.cs
  • All updated to pass the context to ShouldHideEntry for block configuration checking

2. Added Comprehensive Tests

New File: tests/Elastic.Changelog.Tests/Changelogs/Render/BlockConfigurationTests.cs

Added 7 test cases covering:

  1. Product-specific area blocking — Verifies entries with blocked areas are commented out
  2. Type blocking — Verifies entries with blocked types are commented out
  3. Global area blocking — Verifies global block configuration works
  4. Product-specific override — Verifies product-specific blockers override global blockers
  5. Breaking changes formatting — Verifies breaking changes use HTML block comments (<!-- -->)
  6. Known issues formatting — Verifies known issues use HTML block comments
  7. Multiple blocked areas — Verifies multiple blocked areas work correctly

How It Works

When rendering changelog entries:

  1. For each entry, the system checks its associated product IDs (BundleProductIds)
  2. For each product ID, it looks up the publish blocker configuration:
    • First checks product-specific blockers (block.product['product-id'].publish)
    • Falls back to global blockers (block.publish) if no product-specific blocker exists
  3. If a blocker is found, it checks if the entry's type or areas match the blocked types/areas
  4. If a match is found, the entry is commented out in the output:
    • Regular entries: using % prefix for markdown
    • Breaking changes/deprecations/known issues: using <!-- --> HTML block comments

Testing

All tests pass:

  • ✅ 7 new block configuration tests
  • ✅ All existing tests continue to pass
  • ✅ No linting errors

Impact

  • Fixed: Entries matching blocked areas (like "Allocation" in the example) or types are now properly commented out in rendered output files
  • Prevented: Future regressions through comprehensive test coverage
  • Maintained: Backward compatibility with existing functionality (feature ID hiding still works)

Example Use Case

For a configuration like:

block:
  product:
    'cloud-serverless':
      publish:
        areas:
          - Allocation

Entries with the "Allocation" area for the cloud-serverless product are now correctly commented out in the rendered markdown files, preventing them from appearing in the published documentation.

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

@lcawl lcawl added the bug label Jan 26, 2026
@lcawl lcawl changed the title Fix changelog render with blocks Fix changelog render with publishing blocks Jan 26, 2026
@lcawl lcawl marked this pull request as ready for review January 26, 2026 22:41
@lcawl lcawl requested a review from a team as a code owner January 26, 2026 22:41
@lcawl lcawl requested a review from cotti January 26, 2026 22:41
@lcawl lcawl merged commit f537bb2 into main Jan 26, 2026
31 checks passed
@lcawl lcawl deleted the changelog-render-bug branch January 26, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changelog block publish clause is not heeded by render command

3 participants