Skip to content

Retire rules.publish from changelog render command#2919

Open
lcawl wants to merge 3 commits intomainfrom
render-rules
Open

Retire rules.publish from changelog render command#2919
lcawl wants to merge 3 commits intomainfrom
render-rules

Conversation

@lcawl
Copy link
Contributor

@lcawl lcawl commented Mar 18, 2026

Summary

Relates to #2917

Retires rules.publish from the changelog render command.
The retirement is backward-compatible and includes clear user communication through deprecation warnings.

Scope

  • In scope: Remove rules.publish usage from the changelog render CLI path
  • Out of scope: Removal from config schema (separate deprecation effort). The YAML may still be parsed for backward compatibility but treated as unused.
  • Includes: Remove ReleaseNotesSerialization.LoadPublishBlocker() (dead code after retirement)

Implementation

1. ChangelogRenderUtilities

  • ShouldHideEntry: Remove the rules.publish block entirely. Keep only feature-id check. When context?.Configuration?.Rules?.Publish is present, it is no longer applied; ShouldHide is determined solely by featureIdsToHide.
  • GetComponent: Stop using GetPublishBlockerForEntry. Always use entry.Areas?[0] ?? string.Empty for subsection grouping (align with directive behavior).
  • Remove: GetPublishBlockerForEntry and GetPublishBlockerForProduct (both private).

2. ChangelogRenderingService

  • EmitBlockedEntryWarnings: Remove the entire method body's rules.publish logic. Simplest: remove the call to EmitBlockedEntryWarnings and delete the method.
  • Remove: GetPublishBlockerForProduct and GetBlockReasons (only used for publish-rule warnings).
  • Keep: GetEntryIdentifier if it has other uses; verify it's only for publish warnings before removing.

3. ChangelogConfigurationLoader

When rulesYaml.Publish != null, emit a deprecation warning: "rules.publish is deprecated and no longer used by the changelog render command. Move type/area filtering to rules.bundle, which applies at bundle time instead of render time.". Parse and load normally but set Rules.Publish = null so render command never sees it.

This approach:

  • Is backward-compatible (configs don't break)
  • Clearly notifies users the feature is ignored (warning message)
  • Prepares for eventual removal (error can come in a future major version)

4. Test updates — BlockConfigurationTests (tests/Elastic.Changelog.Tests/Changelogs/Render/BlockConfigurationTests.cs)

All tests in this file exercise rules.publish behavior. With rules.publish retired:

  • Rewrite tests to assert that rules.publish is ignored:
    • Configs that previously blocked entries (e.g. exclude_areas: [Allocation]) should now produce visible entries.
    • Remove or rewrite tests that assert "blocked entry is commented out" — they should assert "entry is visible (no blocking)".
  • Remove tests that are purely about publish-rule semantics or convert them to verify non-blocking.
  • Add explicit test: "Config with rules.publish emits deprecation warning and does not apply filtering."
  • Add subsections test: "With --subsections enabled, entries are grouped by their first area (not filtered by rules.publish)."

5. Remove dead code

6. Other test updates

Key Changes Summary

Code Removals:

  • 1,681 lines deleted from BlockConfigurationTests.cs (all rules.publish render tests)
  • 382 lines deleted from LoadPublishBlockerTests.cs (dead code)
  • 109 lines removed from ChangelogRenderingService.cs (render blocking logic)
  • 46 lines removed from ReleaseNotesSerialization.cs (dead code)
  • 66 lines modified in ChangelogRenderUtilities.cs (simplified filtering)

Code Additions/Updates:

  • Deprecation warning added in ChangelogConfigurationLoader.cs
  • Test updates in ChangelogConfigurationTests.cs to verify Publish = null behavior
  • Documentation updates in 4 files to reflect the retirement

Net Result: 2,325 lines deleted, 50 lines added = cleaner, simpler codebase

Impact

  • Rules.bundle remains unchanged: Bundle-time filtering continues to work independently
  • Users are warned: Deprecation warning guides users to migrate from rules.publish to rules.bundle

The implementation is production-ready and aligns the changelog render command with the {changelog} directive, which already doesn't use rules.publish.

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.5, claude-4.5-haiku

lcawl added 2 commits March 18, 2026 16:17
- Remove rules.publish filtering logic from render command (ShouldHideEntry, GetComponent)
- Delete EmitBlockedEntryWarnings and related blocking methods
- Add deprecation warning when rules.publish is present in config
- Set Rules.Publish to null so render never applies it
- Delete dead code: LoadPublishBlocker() and related tests
- Update all render-related tests to reflect the retirement
- Update documentation to note render command does not use rules.publish
- Use pragma directives to suppress unused parameter warnings

This fully retires rules.publish from changelog render, making PR #2889
(multi-product rule resolution fix) unnecessary since that code path is removed.

Bundle-side rules.bundle continues to work independently for filtering at bundle time.
@github-actions
Copy link

@lcawl lcawl marked this pull request as ready for review March 18, 2026 23:26
@lcawl lcawl requested review from a team as code owners March 18, 2026 23:26
@lcawl lcawl requested a review from technige March 18, 2026 23:26
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