Skip to content

Fix authoring repo on bundle products - #4061

Open
lcawl wants to merge 2 commits into
mainfrom
changelog-bundle-repo
Open

Fix authoring repo on bundle products#4061
lcawl wants to merge 2 commits into
mainfrom
changelog-bundle-repo

Conversation

@lcawl

@lcawl lcawl commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #4060

Details

products[].repo is now the authoring GitHub repo (same resolution as the bundle filename), not products.yml repository:.

Code

  • BundleBuilder stamps the repo argument on every product. It no longer reads the product catalog.
  • ChangelogBundlingService fills that argument with --repo / profile / bundle.repo, then GITHUB_REPOSITORY / git origin.
  • Catalog lookup (GetProductsByRepositoryName, repository: cloud) is unchanged.

Tests and docs

  • Unit tests in BundleBuilderPerProductRepoTests now expect authoring repo (including cloud-serverless + elasticsearch).
  • End-to-end: BundleChangelogs_ServerlessProfile_WritesAuthoringRepoNotCatalogRepository uses a catalog with repository: cloud and asserts repo: elasticsearch.
  • Docs in cmd-bundle.md, configure-ref.md, changelog.example.yml, and the BundleProfile.Repo comment.

Tests

Related to elastic/elasticsearch#158728, I ran the following command:

docs-builder changelog bundle serverless-release 2026-09-08 "./docs/temp/Elasticsearch serverless Promotion Report.html"

Before this PR, it generated a bundle that contained the following:

products:
- product: cloud-serverless
  target: 2026-09-08
  repo: cloud
  owner: elastic

After this PR, it contains the correct repo name:

products:
- product: cloud-serverless
  target: 2026-09-08
  repo: elasticsearch
  owner: elastic

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: Cursor Grok 4.6

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

@theletterf

Copy link
Copy Markdown
Member

@copilot Investigate and fix the CI failures.

The authoring repo fallback now writes `repo:` into bundles and can switch amend tests to CDN sourcing in CI. The test expectations and local amend inputs must match that behavior to keep the suite deterministic.

Co-Authored-By: Claude <noreply@anthropic.com>

Copilot AI commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@copilot Investigate and fix the CI failures.

Fixed in c631a20. The failing ci run was stale test coverage around the new authoring-repo fallback: two bundle tests now expect the resolved repo: value, and the local amend tests now force local sourcing so they stay deterministic in CI.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Repo resolution is applied only when building the bundle products, leaving other repo-dependent logic in the same run still using the unresolved input.Repo, which can cause inconsistent behavior when repo is omitted from CLI/config.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR fixes changelog bundle output so products[].repo reflects the authoring GitHub repository (the checkout/bundle filename convention) rather than the docs catalog products.yml repository: value, preventing incorrect default PR/issue link resolution for bundled products.

Changes:

  • Stop resolving per-product repo from the product catalog; instead stamp the authoring repo onto every bundled product.
  • Resolve the authoring repo for bundling (via CLI/config/env/git origin) and update unit/e2e tests to validate the new behavior.
  • Update CLI/config documentation to clarify what bundle.repo and profile repo mean and how they affect output.
File summaries
File Description
tests/Elastic.Changelog.Tests/Changelogs/BundleChangelogsTests.cs Adds an end-to-end-style test asserting bundles write the authoring repo even when the catalog maps the product to a different repository.
tests/Elastic.Changelog.Tests/Bundling/BundleBuilderPerProductRepoTests.cs Updates unit tests to reflect stamping the authoring repo on all products and the new null behavior when repo can’t be resolved.
src/services/Elastic.Changelog/Bundling/ChangelogBundlingService.cs Passes a resolved authoring repo into BundleBuilder and removes catalog dependency from the bundle build call.
src/services/Elastic.Changelog/Bundling/BundleBuilder.cs Removes catalog-based per-product repo resolution and stamps the provided authoring repo on each bundled product.
src/Elastic.Documentation.Configuration/Changelog/BundleConfiguration.cs Updates BundleProfile.Repo docs/obsolete messaging to reflect new repo derivation behavior.
docs/data/release-notes/configure-ref.md Clarifies semantics and precedence of bundle.repo and profile repo, and that products[].repo is authored-repo based.
docs/cli/changelog/cmd-bundle.md Clarifies conventional output filename derivation and repo resolution precedence.
config/changelog.example.yml Updates example comments to align with new meaning of profile repo.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 531 to +535
var buildResult = bundleBuilder.BuildBundle(
collector,
filteredEntries,
input.OutputProducts,
input.Repo,
BundleOutputNaming.ResolveRepo(_fileSystem, input.Config, _env, input.Repo),
Comment on lines +129 to 133
/// GitHub repository name for link and file name generation.
/// <para>
/// <b>Deprecated.</b> Per-product repo is now resolved from <c>products.yml</c> via the
/// product's <c>repository:</c> field, making the bundle-level override redundant.
/// Remove from profile config; a mismatch with the running repository is a hard error.
/// <b>Deprecated.</b> Derived from <c>GITHUB_REPOSITORY</c> or git <c>origin</c> when omitted.
/// </para>
/// </summary>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bundles resolve incorrect product repo from products.yml

4 participants