Skip to content

Retire rules.publish from changelog render command#2919

Merged
cotti merged 4 commits intomainfrom
render-rules
Mar 20, 2026
Merged

Retire rules.publish from changelog render command#2919
cotti merged 4 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

Base automatically changed from directive-rules to main March 18, 2026 23:14
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

github-actions bot commented Mar 18, 2026

@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
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 99169553-027f-4492-bc11-3680ba20e798

📥 Commits

Reviewing files that changed from the base of the PR and between c916e15 and 7fe944a.

📒 Files selected for processing (11)
  • config/changelog.example.yml
  • docs/cli/release/changelog-render.md
  • docs/contribute/changelog.md
  • docs/syntax/changelog.md
  • src/Elastic.Documentation.Configuration/ReleaseNotes/ReleaseNotesSerialization.cs
  • src/services/Elastic.Changelog/Configuration/ChangelogConfigurationLoader.cs
  • src/services/Elastic.Changelog/Rendering/ChangelogRenderUtilities.cs
  • src/services/Elastic.Changelog/Rendering/ChangelogRenderingService.cs
  • tests/Elastic.Changelog.Tests/Changelogs/ChangelogConfigurationTests.cs
  • tests/Elastic.Changelog.Tests/Changelogs/Render/BlockConfigurationTests.cs
  • tests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/LoadPublishBlockerTests.cs
💤 Files with no reviewable changes (3)
  • src/Elastic.Documentation.Configuration/ReleaseNotes/ReleaseNotesSerialization.cs
  • tests/Elastic.Changelog.Tests/Changelogs/Render/BlockConfigurationTests.cs
  • tests/Elastic.Documentation.Configuration.Tests/ReleaseNotes/LoadPublishBlockerTests.cs

📝 Walkthrough

Walkthrough

This pull request deprecates the rules.publish configuration section by removing its enforcement from the changelog render command and related services. Filtering now occurs exclusively at bundle time via rules.bundle. Changes include updating documentation to reflect the new behavior, modifying configuration loading to set RulesConfiguration.Publish to null while emitting deprecation warnings, removing publish-rule-based filtering logic from rendering utilities, eliminating the public LoadPublishBlocker method, and deleting test suites that validated publish-blocking behavior.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch render-rules
  • 🛠️ Update Documentation: Commit on current branch
  • 🛠️ Update Documentation: Create PR

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.

Tip

CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.

OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required.

@cotti cotti merged commit fe22b19 into main Mar 20, 2026
31 checks passed
@cotti cotti deleted the render-rules branch March 20, 2026 17:24
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.

2 participants