Skip to content

Add --report option for changelog add command#3227

Merged
cotti merged 3 commits into
mainfrom
changelog-report
May 4, 2026
Merged

Add --report option for changelog add command#3227
cotti merged 3 commits into
mainfrom
changelog-report

Conversation

@lcawl
Copy link
Copy Markdown
Contributor

@lcawl lcawl commented May 2, 2026

This PR updates the "docs-builder changelog add" command to support a "--report" option that matches what exists in the "changelog bundle" command.

This serves as a stop-gap for teams that are not yet generating their changelogs on a PR-by-PR basis--they can be generated as needed at the time of the release instead.

AI implementation details

CLI (changelog add --report)

In src/tooling/docs-builder/Commands/ChangelogCommand.cs:

  • New option --report: resolves promotion HTML (URL or normalized file path) via PromotionReportParser.ParseReportToPrUrlsAsync, then runs the normal ChangelogCreationService path with the resulting PR URLs (same idea as --prs).
  • Mutually exclusive with --prs, --issues, and --release-version (with explicit error messages).
  • Local reports: normalize path with NormalizePath; https:///http:// sources are passed through unchanged (same pattern as elsewhere).
  • --use-pr-number validation now allows --report as a source of PRs; XML docs updated for --strip-title-prefix, title/type requirements, and related options.

Tests

New file tests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs:

  • End-to-end: HTML report → parsed URLs → two changelog files with --use-pr-number.
  • Parser: missing report file → errors on the collector.

dotnet test tests/Elastic.Changelog.Tests/ passes (including these tests).

Documentation

docs/cli/changelog/add.md now documents --report, mutual exclusivity, parity with changelog bundle --report, host/network notes, and an example that runs changelog add --report then changelog bundle --report with the same file.

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-2, claude-4-sonnet-thinking

@lcawl lcawl marked this pull request as ready for review May 2, 2026 01:30
@lcawl lcawl requested review from a team as code owners May 2, 2026 01:30
@lcawl lcawl requested a review from cotti May 2, 2026 01:30
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 22fcfa4a-9174-4755-9425-e8970f13e954

📥 Commits

Reviewing files that changed from the base of the PR and between 0984c02 and 79704ce.

📒 Files selected for processing (2)
  • docs/cli/changelog/add.md
  • tests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs
  • docs/cli/changelog/add.md

📝 Walkthrough

Walkthrough

Adds a new --report option to changelog add that accepts a path or URL to an HTML promotion report, extracts PR URLs via PromotionReportParser, and drives changelog creation producing one YAML file per PR. The CLI enforces mutual exclusivity between --report and --prs, --issues, and --release-version. Parsing supports local files or fetching over HTTPS; parsed PRs are normalized and passed to the existing PR-handling flow. Docs and validations (including --use-pr-number and title/type requirements) were updated to include --report.

Sequence Diagram

sequenceDiagram
    actor User
    participant CLI as ChangelogCommand
    participant Parser as PromotionReportParser
    participant FS as FileSystem
    participant HTTP as HTTPFetcher
    participant GitHub as GitHubService
    participant Service as ChangelogCreationService

    User->>CLI: run `changelog add --report <path|url>`
    CLI->>Parser: ParseReportToPrUrlsAsync(report)
    alt local file
        Parser->>FS: read HTML file
    else http(s) URL
        Parser->>HTTP: fetch HTML
        HTTP-->>Parser: HTML content
    end
    Parser-->>CLI: list of PR URLs
    loop per PR URL
        CLI->>GitHub: FetchPrInfoAsync(prNumber)
        GitHub-->>CLI: PR metadata (title, url, etc.)
    end
    CLI->>Service: CreateChangelog with parsed PRs
    Service->>Service: generate YAML per PR
    Service->>FS: write <prNumber>.yaml files
    FS-->>User: changelog YAML files created
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a --report option to the changelog add command.
Description check ✅ Passed The description is well-detailed and directly related to the changeset, explaining the feature addition, implementation details, tests, and documentation updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch changelog-report

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/cli/changelog/add.md`:
- Around line 86-90: The docs for the CLI flag `--report` only mention
`https://` but the command accepts both `http://` and `https://`; update the
`--report <string?>` description and the sentence about network access/host
restrictions (and the reference to `changelog bundle --report`) to explicitly
state that both http:// and https:// report URLs are accepted, and clarify that
network access is required and only allowed hosts (e.g., github.com,
buildkite.com) are supported for either scheme.

In `@tests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs`:
- Around line 91-94: The test only asserts the first generated changelog (yaml1)
so add a second read/assert for the second file (e.g., read files[1] into a new
variable like yaml2 using FileSystem.File.ReadAllTextAsync with
TestContext.Current.CancellationToken) and assert that yaml2 contains the
expected title and PR link for the second changelog (for example "title: Second
from report" and "https://github.com/elastic/elasticsearch/pull/7002") to fully
cover the --report path; use the same FluentAssertions style as
yaml1.Should().Contain(...) so the new assertions mirror the existing checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 681b3164-f00c-46aa-92a8-34e375eafb6f

📥 Commits

Reviewing files that changed from the base of the PR and between a3b9491 and 0984c02.

📒 Files selected for processing (3)
  • docs/cli/changelog/add.md
  • src/tooling/docs-builder/Commands/ChangelogCommand.cs
  • tests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs

Comment thread docs/cli/changelog/add.md
…nTests.cs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	docs/cli/changelog/add.md
@cotti cotti merged commit 705bde8 into main May 4, 2026
24 checks passed
@cotti cotti deleted the changelog-report branch May 4, 2026 16:24
Mpdreamz pushed a commit that referenced this pull request May 11, 2026
* Add --report option for changelog add command

* Update tests/Elastic.Changelog.Tests/Changelogs/Create/AddReportOptionTests.cs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Felipe Cotti <felipe.cotti@elastic.co>
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