Skip to content

Add product-based filtering to changelog bundle#2873

Draft
lcawl wants to merge 8 commits intochangelog-product-labelsfrom
changelog-product-rules
Draft

Add product-based filtering to changelog bundle#2873
lcawl wants to merge 8 commits intochangelog-product-labelsfrom
changelog-product-rules

Conversation

@lcawl
Copy link
Contributor

@lcawl lcawl commented Mar 10, 2026

Summary

This PR builds on #2857 and must be merged after it.

Teams need control over which changelogs appear in the output, based on the changelog's products field, even when the primary bundle filter is --prs, --issues, --report, or --all (that is to say, not a product-based filter).
For example: a PR appears in multiple release lists but the changelog correctly indicates that it's only applicable / notable in a subset of those products.

Mutual exclusivity rule (applies to all options): The new product filter must NOT apply when the primary bundle filter is already product-based. bundle.profiles.products and --input-products are equivalent: both are already a complete product-based primary filter, and overlaying a secondary product filter would be redundant and confusing.

This PR adds new rules.bundle subsection that is applied during the changelog bundle command. Changelogs that fail the product filter are excluded from the bundle file entirely.
For example:

rules:
  bundle:
    match_products: any      # inherits from rules.match if not set
    exclude_products:        # cannot mix with include_products
      - cloud-enterprise
    # OR:
    include_products:
      - cloud-serverless
      - cloud-hosted

What was implemented

Config modelBlockConfiguration.cs & ChangelogConfigurationYaml.cs

  • Added BundleRules record with ExcludeProducts, IncludeProducts, and MatchProducts fields
  • Added BundleRulesYaml DTO and Bundle property to RulesConfigurationYaml
  • Registered BundleRulesYaml in the static YAML context (ChangelogYamlStaticContext.cs)

Config loaderChangelogConfigurationLoader.cs

  • Added ParseBundleRules with mutual-exclusivity validation (exclude_products + include_products together → error), product ID normalization (_-) and validation against known product IDs, and match_products parsing

Bundling serviceChangelogBundlingService.cs

  • Added secondary filter step after matchResult and before BuildBundle
  • Skipped entirely when primary filter is --input-products
  • ApplyBundleProductFilter emits [-bundle-exclude] / [-bundle-include] warnings for each excluded entry
  • Emits a clear error if all entries are filtered out

Documentation

  • config/changelog.example.yml — commented rules.bundle example
  • docs/contribute/changelog.md — new rules.bundle section, updated match inheritance diagram and validation table
  • docs/cli/release/changelog-bundle.md — new "Bundle-time product filtering" section
  • docs/cli/release/changelog-remove.mdrules.bundle row in the ignored fields table
  • docs/syntax/changelog.md — new "Filtering entries at bundle time" section

Tests — 7 new tests across BundleChangelogsTests.cs and ChangelogConfigurationTests.cs

  • Exclude filter removes matched products from bundle
  • Include filter keeps only matched products
  • --all primary filter still respects rules.bundle
  • --input-products primary filter bypasses rules.bundle
  • Config load/validation: valid config parses correctly, mutual exclusivity error, unknown product ID error

Steps for testing

  1. Create a changelog configuration file and a handful of changelogs that use multiple product values. For example, use Kibana release notes test kibana#250840
  2. Try to create a bundle from a PR list. For example, run this command from the kibana repo:
    /path/to/GitHub/docs-builder/.artifacts/publish/docs-builder/release/docs-builder changelog bundle \
    --config ./docs/changelog.yml \
    --directory ./docs/changelog \
    --output ./docs/releases/security/test.yaml \
    --output-products "security 9.3.0 *" --resolve \
    --prs ./docs/9.3.0-security.txt --repo kibana --owner elastic
    Verify that the bundle contains over a hundred changelogs.
  3. Add the new bundle filters to the changelog configuration file. For example:
    rules:
      bundle:
        match_products: all     
        exclude_products:
          - kibana
        # include_products:
        #  - cloud-serverless
        # - cloud-hosted
  4. Re-run the bundle command to test the new functionality...

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: claude-4.6-sonnet-medium

@lcawl lcawl marked this pull request as ready for review March 10, 2026 00:17
@lcawl lcawl requested review from a team as code owners March 10, 2026 00:17
@lcawl lcawl requested a review from reakaleek March 10, 2026 00:17
@lcawl lcawl marked this pull request as draft March 10, 2026 02:28
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