Skip to content

Deprecate changelog rules.publish in favour of rules.bundle#2874

Open
lcawl wants to merge 33 commits intomainfrom
changelog-bundle-rules
Open

Deprecate changelog rules.publish in favour of rules.bundle#2874
lcawl wants to merge 33 commits intomainfrom
changelog-bundle-rules

Conversation

@lcawl
Copy link
Contributor

@lcawl lcawl commented Mar 10, 2026

Summary

This PR contains one enhancements and two related fixes...

Deprecate rules.publish

Extend rules.bundle with the full set of type/area/product-level filter capabilities from rules.publish, so the same filtering can occur at bundle time and the output bundle already contains only the intended entries.

Extended YAML shape:

rules:
  bundle:
    match_products: any        # Phase 2 (product primary filter)
    exclude_products:          # Phase 2
      - cloud-enterprise
    match_areas: any           # NEW — same as rules.publish.match_areas
    exclude_types:             # NEW — same as rules.publish.exclude_types
      - enhancement
    include_areas:             # NEW — same as rules.publish.include_areas
      - security
    products:                  # NEW — same as rules.publish.products
      elasticsearch:
        exclude_types: "enhancement"

Resolve the gh-release gap

The changelog gh-release command currently calls its own CreateBundleFile, which bypasses ChangelogBundlingService entirely. The fix is to replace that method with a call to ChangelogBundlingService.BundleChangelogs, passing a --prs filter populated from the PR URLs of the just-created changelog files. Since ChangelogBundlingService already loads config and applies rules.bundle, this makes gh-release automatically inherit all present and future rules.bundle behavior.

Fix multi-product rule resolution

There was a mismatch between how rules were being applied to changelogs with multiple products:

  • **changelog bundle** (GetBlockerForEntry): "first-match from the entry's own product list in YAML order" — ignores which product(s) the bundle is being assembled for; YAML order is arbitrary
  • **changelog render** (ShouldHideEntry): "any-blocks from the bundle's Products array" — too aggressive; one product's exclusion rules block the entry from a different product's output

This PR addresses the changelog bundle behaviour. The fix for render will be in a subsequent PR. The algorithm (identical for both bundle and render) is as follows:

  1. Determine context IDs (which products this bundle/output is for):
  • Bundle step: output_products product IDs (if set); else the entry's own product IDs
  • Render step: bundle's top-level Products product IDs (EntryToBundleProducts)
  1. Compute intersection of context IDs with the entry's own product IDs
  • This restricts rule lookup to products the entry actually claims to belong to
  • If the intersection is empty (unusual edge case: entry's products are disjoint from the bundle context), fall back to the context IDs unsorted as-is, then to the global blocker
  1. Sort the intersection alphabetically (case-insensitive, ascending) — this is the stable, deterministic ordering guarantee
  2. First-match: iterate the sorted intersection; return the byProduct rule for the first product ID found in the configuration; stop there
  3. Global fallback: if no intersection member has a per-product rule, return the global Blocker

Steps to test

  1. Create a changelog configuration file and generate changelogs. Alternatively, check out a PR like Kibana release notes test kibana#250840
  2. Add the new rules.bundle options to the config file. For example, copy the details that currently exist in the rules.publishing to the rules.bundle section:
    rules:
      bundle:
        products:
          'kibana':
            exclude_types:
              - docs
            # Exclude changelogs that have only one or more of the following areas:
            match_areas: all
            exclude_areas:
               - "AI for security"
               - "Cloud security"
               - "Detection rules and alerts"
               - "Endpoint security"
               - "Entity analytics"
               - "Elastic Observability solution"
               - "Elastic Security solution"
               - "Investigations"
  3. Test the effect on changelog bundles. For example:
    /path/to/GitHub/docs-builder/.artifacts/publish/docs-builder/release/docs-builder changelog bundle \
    --prs ./docs/9.3.0-kibana.txt \
    --output ./docs/releases/kibana/9.3.0.yaml \
    --output-products "kibana 9.3.0 *"
    
    /path/to/GitHub/docs-builder/.artifacts/publish/docs-builder/release/docs-builder changelog bundle \
    --prs ./docs/9.3.0-observability.txt \
    --output ./docs/releases/observability/9.3.0.yaml \
    --output-products "observability 9.3.0 *"
    
    /path/to/GitHub/docs-builder/.artifacts/publish/docs-builder/release/docs-builder changelog bundle \
    --prs ./docs/9.3.0-security.txt \
    --output ./docs/releases/observability/9.3.0.yaml \
    --output-products "security 9.3.0 *"
  4. Verify that the output is as expected. For example, confirm that the omitted changelogs align with your expectations. Messages are returned from the commands like this:
    Warning: [-bundle-type-area] Excluding '240819.yaml' from bundle (type/area filter).
    NOTE: docs/changelog/240819.yaml
    
  5. Test variations of the changelog bundle command (for example --input-products instead of --prs, or by using a profile). For example:
    1. Add more rules and profile settings to the changelog configuration file:
      rules:
        products:
            'security':
               match_products: any
               include_products: "security"
               exclude_types:
                  - docs
               match_areas: any
               exclude_areas:
                  - "Investigations"
      bundle:
        profiles:
          security-release:
            products: "security {version}"
            output: "security-{version}.yaml"
            output_products: "security {version}"
    2. Create a bundle using the profile:
      /path/to/GitHub/docs-builder/.artifacts/publish/docs-builder/release/docs-builder changelog bundle security-release 9.3.0
    3. Verify that the changelogs with Investigations area where omitted from the bundle, for example:
      Warning: [-bundle-type-area] Excluding '245857.yaml' from bundle (type/area filter).
      NOTE: docs/changelog/245857.yaml
  6. Test rule with a bundle created from a GitHub release. For example:
    1. Check out [DOCS] Changelog test apm-agent-dotnet#2714
    2. Add some bundle rules:
      rules:
        bundle:
          exclude_types: "docs"
    3. Create a bundle:
      /path/to/GitHub/docs-builder/.artifacts/publish/docs-builder/release/docs-builder changelog bundle  --release-version v1.34.0
    4. Verify that the changelog with docs type is omitted:
      Warning: [-bundle-type-area] Excluding '2647-docs-docs-replace-placeholder-urls.yaml' from bundle (type/area filter).
      NOTE: docs/changelog/2647-docs-docs-replace-placeholder-urls.yaml

lcawl and others added 22 commits March 10, 2026 18:37
…ariable'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…ariable'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Mar 11, 2026

@lcawl lcawl marked this pull request as ready for review March 11, 2026 16:36
@lcawl lcawl requested review from a team as code owners March 11, 2026 16:36
@lcawl lcawl requested a review from technige March 11, 2026 16:36
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
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