Fix and enhance changelog add command filename options#2837
Merged
lcawl merged 3 commits intoprofile-parity-p3from Mar 3, 2026
Merged
Fix and enhance changelog add command filename options#2837lcawl merged 3 commits intoprofile-parity-p3from
lcawl merged 3 commits intoprofile-parity-p3from
Conversation
2 tasks
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
While testing #2808, which affects the "changelog bundle" and "remove" commands, I also found some areas for improvement in the "changelog add" command.
1. Prevent "path too long" messages
changelog add --use-pr-numberwith many PRs builds a filename by joining all PR numbers with hyphens, e.g.:224552-226849-228875-...-250532.yamlWith hundreds of PRs this can exceed filesystem limits and cause "path too long" or "component of the specified path is too long" errors.
Fix
ChangelogFileWriter.GenerateFilenamenow caps the filename length at 200 characters. If the hyphen‑separated list would exceed that, it uses a shorter form instead:224552-226849-228875-...-250532.yaml224552-to-250532-300-prs.yaml(first PR, last PR, count, fixed suffix)The same logic is applied for
--use-issue-numberwhen there are many issues.2. Prevent creation of a single changelog when I run --prs with multiple values
This seems to be a regression, since it worked before in elastic/kibana#250840 but with new tests was creating a single changelog with hundreds of PRs in its array.
For multiple PRs with
--use-pr-number, the service was callingCreateAggregatedChangelogAsync, which wrote a single changelog containing every PR. That was not the intended behavior.Fix
--use-pr-number) always go throughCreateChangelogsForMultiplePrsAsync, so you get one changelog per PR.--use-pr-number– When creating one file per PR, each file is named by its PR number (e.g.224552.yaml,226849.yaml, …).CreateAggregatedChangelogAsync– That path only did the wrong behavior and is no longer used.Behavior summary
137431-137432.yaml.{first}-to-{last}-{count}-prs.yaml.3. Support
--use-pr-numberor--use-issue-numberin all casesRelax validation and updating docs so
--use-issue-numberworks with--prswhen issues are extracted from the PR body. And likewise there's no reason we shouldn't allow--use-pr-numberwhen--issuesis specified.Summary of changes:
Validation (
ChangelogCommand.cs)--use-issue-numberand--use-pr-numbernow work with both--prsor--issuesChangelogCommandparamchangelog-add.mdandcontribute/changelog.md--use-issue-number.--prswith--use-issue-number.--prsor--issues” instead of only requiring--issues.Testing
To test these changes, I ran the following commands:
System.IO.PathTooLongException: The path '/path/to/GitHub/kibana/docs/changelog/233289-234793-236051-236110-236318-236756-236906-236992-237038-23...9032-249500-249891.yaml' is too long, or a component of the specified path is too long.--use-issue-number, and--use-pr-numberwork. For example:--use-issue-number, the filename is11085-14116.yaml.--use-pr-number, the filename is240272.yaml.1772482097-[telemetry]-create-cloud-connector-usage-collector.yaml--prsand--issuesare specified, with either--use-pr-numberor--use-issue-number. For example:Generative AI disclosure
Tool(s) and model(s) used: composer-1.5