Skip to content

Conversation

@lcawl
Copy link
Contributor

@lcawl lcawl commented Dec 5, 2025

Per #2298 (comment) "We should make https://github.com/elastic/docs-builder/blob/main/config/products.yml the sole source of truth for allowed products."

Summary of Changes

  1. Product validation against products.yml: Updated ChangelogService.CreateChangelog to always validate products from the --products option against config/products.yml via IConfigurationContext.ProductsConfiguration. This runs regardless of whether AvailableProducts is set in changelog.yml.
  2. Validation of changelog.yml values: Updated LoadChangelogConfiguration to validate that all values in changelog.yml conform to the defaults in ChangelogConfiguration.cs:
    available_types must be a subset of the default types
    available_subtypes must be a subset of the default subtypes
    available_lifecycles must be a subset of the default lifecycles
    available_products (if specified) must all exist in config/products.yml
  3. Error handling: All validation errors prevent file generation by returning false or null, ensuring invalid values cannot be written.

The code compiles successfully and follows existing patterns. Products are normalized (underscores converted to hyphens) for comparison, matching the existing product handling in the codebase.

Error handling

If I provide a configuration file that contains an invalid value, the command returns an error and fails to generate a changelog. For example:

./docs-builder changelog add --pr 138879 --type bug-fix --products "cloud-enterprise 4.0.0, cloud-hosted 2025-11-11" --title "Fixes cached errors during upgrade" --config blah/changelog.yml

Returns the following error when my changelog.yml contains an invalid product value:

The following errors and warnings were found in the documentation

Error: Product 'cocoa' in changelog.yml is not in the list of available products from config/products.yml. Available products: apm, apm-agent, ...
 
Error: Failed to load changelog configuration

Likewise if I don't use a changelog.yml configuration but use a value that's not in the list of global values:

./docs-builder changelog add --pr 138879 --type magic --products "cloud-enterprise 4.0.0" --title "Fixes cached errors during upgrade"

...I get an error and the changelog isn't created:

Error: Type 'magic' is not in the list of available types. Available types: feature, enhancement, bug-fix, known-issue, breaking-change, deprecation, docs, regression, security, other


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 agent

@lcawl lcawl marked this pull request as ready for review December 5, 2025 18:09
@lcawl lcawl requested a review from a team as a code owner December 5, 2025 18:10
@lcawl lcawl requested a review from reakaleek December 5, 2025 18:10
@lcawl lcawl mentioned this pull request Dec 5, 2025
2 tasks
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