Conversation
🔍 Preview links for changed docs |
… combined' 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>
…ect' 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>
…ect' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
… use Select'" This reverts commit 5bc8b58.
Comment on lines
+294
to
+308
| foreach (var entryFileName in entryFileNames.Where(entryFileName => toRemoveNames.Contains(entryFileName))) | ||
| { | ||
| // bundle entry.File.Name is relative to the changelog directory (parent of bundles dir) | ||
| // Normalize to just the base filename for comparison | ||
|
|
||
| // Find the full path from filesToRemove that matches this entry | ||
| var matchingFile = filesToRemove | ||
| .FirstOrDefault(f => string.Equals( | ||
| _fileSystem.Path.GetFileName(f), | ||
| entryFileName, | ||
| StringComparison.OrdinalIgnoreCase)); | ||
|
|
||
| if (matchingFile is not null) | ||
| dependencies.Add(new BundleDependency(matchingFile, bundleFile)); | ||
| } |
This was referenced Feb 24, 2026
Mpdreamz
approved these changes
Feb 24, 2026
Member
Mpdreamz
left a comment
There was a problem hiding this comment.
LGTM i was picturing this more as:
docs-builder changelog remove <bundle_profile> <version>
to pair with the create-bundle command support for bundle profiles.
Contributor
Author
I can add that in a subsequent PR. I need to play with those profiles more anyway since I honestly haven't done a test scenario with them yet. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new
docs-builder changelog removecommand that enables teams to clean up changelog files using the same filtering semantics aschangelog bundle.This PR also fixes a silent-failure bug in the
{changelog}directive.Notes for reviewers
If you disagree with the change to the directive's handling of missing changelogs (i.e. you want to return to having warning instead of failure), lmk. I don't think it's required for this PR but accepted the recommendation as part of the AI plan.
Changes
New:
changelog removecommandA new
docs-builder changelog removecommand lets you clean up individual changelog YAML files from a directory using filter options consistent withchangelog bundle:--all— remove every changelog in the directory--products "product target lifecycle"— remove changelogs matching product/target/lifecycle (wildcards supported)--prs— remove changelogs referencing the specified pull requests--issues— remove changelogs referencing the specified issuesExactly one filter must be specified.
Bundle dependency checking: Before deleting, the command scans for bundles that still hold unresolved
file:references to the matched changelogs. If any are found, the command blocks and emits an error per dependency. This prevents the{changelog}directive from failing at build time with missing-file errors. Use--forceto override and emit warnings instead.Dry-run support:
--dry-runprints what would be removed (and any bundle dependency conflicts) without touching the filesystem.Additional options: all matching the conventions of
changelog bundle:--config— Path tochangelog.yml(default:docs/changelog.yml)--directory— Directory containing changelog YAML files (default: from configbundle.directoryor current directory)--owner— Required when PRs/issues are specified as bare numbers--dry-run— Print files that would be removed; do not delete--bundles-dir— Override for bundles folder used in dependency checkFix:
{changelog}directive now emits errors for missing file referencesPreviously, when a bundle contained an unresolved
file:reference pointing to a changelog that no longer existed on disk, the directive silently omitted those entries. The bundle loader callback was changed fromEmitWarningtoEmitError, causing the build to fail fast rather than producing incomplete release notes without any indication of the problem.Files changed
src/services/Elastic.Changelog/Bundling/ChangelogRemoveService.cssrc/tooling/docs-builder/Commands/ChangelogCommand.cs[Command("remove")]subcommand with full argument parsingsrc/Elastic.Markdown/Myst/Directives/Changelog/ChangelogBlock.csEmitWarning→EmitErrorfor missing bundle file referencestests/Elastic.Changelog.Tests/Changelogs/ChangelogRemoveTests.cs--force, and bundle-dir overridetests/Elastic.Markdown.Tests/Directives/ChangelogMissingFileTests.csdocs/cli/release/changelog-remove.mddocs/contribute/changelog.mddocs/syntax/changelog.mdchangelog-removeto the Related listdocs/_docset.ymlchangelog-remove.mdto thereleasefolder TOCImplementation details
Reuse strategy
The pipeline is identical to
changelog bundleup to the point of writing output. Instead ofBundleBuilderproducing a YAML file, the matchedMatchedChangelogFilepaths are deleted:New components
ChangelogRemoveServiceinsrc/services/Elastic.Changelog/Bundling/ChangelogRemoveService.cs:ChangelogRemoveArgumentsrecord defined at top of this file (consistent withBundleChangelogsArguments)RemoveChangelogs(collector, args, ctx)ApplyConfigDefaults)BundleDependencyChecker, blocks if dependencies found (unless--force)--dry-run: logs file list, returns without deletingBundleDependencyChecker(private helper inChangelogRemoveService.cs):bundle.output_directory, (2){directory}/bundles, (3){directory}/../bundles--bundles-diroverrides this discoveryentry.File.Namevalues (unresolved file-reference entries only; inline/resolved entries are safe to remove)IReadOnlyList<(string changelogFile, string bundleFile)>dependency pairsBundle Dependency Check — Detail
Discovery order (automatic)
--bundles-direxplicit overridebundle.output_directoryif set{directory}/bundlesif that directory exists{directory}/../bundlesif that directory existsWhat is checked
Only
entry.File?.Namereferences matter. Entries with inlinetitle/typedata (created with--resolve) embed content in the bundle and do not depend on the external files at build time.Path comparison: normalize both sides to use the same separator. Bundle-relative paths are treated as relative to the changelog directory (parent of the bundles folder), consistent with how BundleLoader.cs lines 82–84 resolves them.
Behavior
Without
--force: any file referenced by an unresolved bundle causes an error and the command aborts before deleting anything.With
--force: emit a warning per affected file and proceed.With
--dry-run: run the dependency check and print conflicts, but do not delete.Error message format
Directive Error Messages for Missing Changelogs (independent fix)
Current behavior
BundleLoader.ResolveEntriesaccepts anAction<string> emitWarningcallback. When a file reference is missing, it callsemitWarning(...)and skips the entry. The directive passes a warning callback; the render command usesBundleValidationServicewhich errors.Fix (one line in ChangelogBlock)
In
ChangelogBlock.cs LoadAndCacheBundles, change the callback passed toBundleLoader:No changes to
BundleLoaderitself are needed — the callback is already the right extension point.Running tests
Steps to test
I tested this PR against files in elastic/kibana#250840
--no-resolvewas ignored so I worked around it by settingbundle.resolve: falsein the configuration file. Will pursue in separate PR: Fix changelog bundle --no-resolve #2774--prsoption:--forceoption, it correctly returns the warning but deletes the file:--issuesoption. For example:--productsand--dry-runoptions. For example:--alland--dry-runoptions. For example:--prsoption and a newline delimited text file. For example:--repoand--owneroptions and gives a warning when my list of PRs has some that don't exist in the changelogs. For example:Generative AI disclosure
Tool(s) and model(s) used: composer-1.5, claude-4.6-sonnet-medium