Skip to content

[fix] Add release notes summary to a file when it is too big#65

Merged
tdcmeehan merged 1 commit intoprestodb:masterfrom
unidevel:publish-fix
Mar 31, 2026
Merged

[fix] Add release notes summary to a file when it is too big#65
tdcmeehan merged 1 commit intoprestodb:masterfrom
unidevel:publish-fix

Conversation

@unidevel
Copy link
Copy Markdown
Contributor

@unidevel unidevel commented Mar 31, 2026

This PR fixed the error when geneating release notes by adding the summary to a file with name release-notes-missing-<version>.md under presto root folder, release owner need to remove this file before the release notes PR is meges.

2026-03-31T15:32:30.556Z	INFO	main	com.facebook.presto.release.AbstractCommands	Finished running command: git remote get-url origin
2026-03-31T15:32:30.556Z	INFO	main	com.facebook.presto.release.tasks.GenerateReleaseNotesTask	origin url: https://github.com/unix280/presto, repo: unix280/presto
2026-03-31T15:32:31.214Z	INFO	main	com.facebook.airlift.bootstrap.LifeCycleManager	Life cycle stopping...
2026-03-31T15:32:31.219Z	INFO	main	com.facebook.airlift.bootstrap.LifeCycleManager	Life cycle stopped.
2026-03-31T15:32:31.219Z	ERROR	main	Bootstrap	Uncaught exception in thread main
java.lang.RuntimeException: GraphQL error: [{type=UNPROCESSABLE, path=[createPullRequest], locations=[{line=2, column=5}], message=Body is too long (maximum is 65536 characters)}]
	at com.facebook.presto.release.git.GithubGraphQlAction.githubApi(GithubGraphQlAction.java:236)
	at com.facebook.presto.release.git.GithubGraphQlAction.createPullRequest(GithubGraphQlAction.java:205)
	at com.facebook.presto.release.tasks.GenerateReleaseNotesTask.run(GenerateReleaseNotesTask.java:203)
	at com.facebook.presto.release.tasks.AbstractReleaseCommand.run(AbstractReleaseCommand.java:50)
	at com.facebook.presto.release.PrestoReleaseService.main(PrestoReleaseService.java:43)

Tested with:

  1. Release action in presto-release-tools => https://github.com/unix280/presto-release-tools/actions/runs/23812204200/job/69401985641
  2. Prepare release action in presto => https://github.com/unix280/presto/actions/runs/23812844511
  3. Release notes PR => docs: Add release notes for 0.297 unix280/presto#52
  4. Release notes missing list file => https://github.com/unix280/presto/blob/release-notes-0.297/release-notes-missing-0.297.md

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 31, 2026

Reviewer's Guide

Implements logic to handle GitHub PR body length limits for generated release notes by optionally writing the full summary to a versioned file and using a truncated body in the PR, and updates the release workflow to support mock publishing without failing the job.

Sequence diagram for generating release notes PR with summary file fallback

sequenceDiagram
    participant ReleaseService as PrestoReleaseService
    participant Task as GenerateReleaseNotesTask
    participant Git as GitClient
    participant FS as FileSystem
    participant GH as GithubGraphQlAction

    ReleaseService->>Task: run()
    Task->>Git: createBranch(release-notes-{version})
    Task->>Task: build releaseNotes
    Task->>Task: build releaseNotesSummary
    Task->>Task: fullSummary = releaseNotesSummary + RELEASE_NOTES_FOOTER

    alt fullSummary length > githubPrBodyLimit
        Task->>Task: build truncationMessage
        Task->>Task: compute availableSpace
        Task->>Task: truncatedSummary = releaseNotesSummary.substring(...)
        Task->>Task: prBody = truncatedSummary + RELEASE_NOTES_FOOTER + truncationMessage
        Note over Task,FS: summaryFileCreated = true
    else fullSummary within limit
        Task->>Task: prBody = fullSummary
        Note over Task,FS: summaryFileCreated = false
    end

    Task->>Git: checkout(branch release-notes-{version})
    Task->>FS: update RELEASE_NOTES_LIST_FILE

    alt summaryFileCreated is true
        Task->>FS: write release-notes-missing-{version}.md with fullSummary
    end

    Task->>Git: commit release notes changes
    Task->>Git: push origin release-notes-{version}

    Task->>GH: createPullRequest(base=master, head=origin:release-notes-{version}, title=docs: Add release notes for {version}, body=prBody)
    GH-->>Task: releaseNotesPullRequest URL
    Task-->>ReleaseService: done
Loading

Class diagram for updated GenerateReleaseNotesTask

classDiagram
    class GenerateReleaseNotesTask {
        - String releaseNotesSummary
        - String RELEASE_NOTES_FOOTER
        - GitClient git
        - Repository repository
        - String RELEASE_NOTES_LIST_FILE
        + void run()
        - void createReleaseNotesCommit(String version, String branch, String releaseNotes, Optional~String~ fullSummary)
    }

    class GitClient {
        + void checkout(Optional~String~ remote, Optional~String~ branch)
        + void push(String remote, String branch, boolean force)
    }

    class Repository {
        + String getOriginName()
    }

    class Optional~String~ {
        + boolean isPresent()
        + String get()
        + static Optional~String~ of(String value)
        + static Optional~String~ empty()
    }

    GenerateReleaseNotesTask --> GitClient : uses
    GenerateReleaseNotesTask --> Repository : uses
    GenerateReleaseNotesTask --> Optional~String~ : uses
Loading

File-Level Changes

Change Details Files
Handle oversized release notes by truncating the PR body and persisting the full summary to a versioned file when it exceeds GitHub limits.
  • Build a full release notes summary including the existing footer and compute its length against a conservative GitHub PR body limit.
  • If the full summary exceeds the limit, construct a truncated PR body that fits within the limit and append an explanatory note with a link to the full summary file and deletion instructions.
  • Introduce a boolean flag and Optional parameter to indicate when a full summary file should be created and pass this into the release notes commit creation method.
  • Extend the release notes commit creation method to optionally write the full summary into a file named release-notes-missing-<version>.md at the repo root and log its creation.
presto-release-tools/src/main/java/com/facebook/presto/release/tasks/GenerateReleaseNotesTask.java
Update the release GitHub Actions workflow to allow mock publishing runs without failing the job on Maven deploy errors.
  • Wrap the Maven deploy step in a conditional that checks a MOCK_PUBLISHING GitHub Actions variable.
  • When mock publishing is enabled, allow the Maven deploy command to fail while logging a message and continuing the workflow; otherwise, retain the original strict behavior.
.github/workflows/release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@unidevel unidevel marked this pull request as ready for review March 31, 2026 18:32
@unidevel unidevel requested review from a team as code owners March 31, 2026 18:32
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The availableSpace calculation for the truncated summary can go negative if the truncation message + footer + buffer exceed githubPrBodyLimit, which would cause substring to throw; consider wrapping it in Math.max(0, ...) before using it.
  • The relative link in truncationMessage (../blob/release-notes-%s/release-notes-missing-%s.md) may not resolve correctly from the PR body; it would be more robust to use an absolute GitHub URL built from the origin repo/branch or a simple filename reference without a relative path.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `availableSpace` calculation for the truncated summary can go negative if the truncation message + footer + buffer exceed `githubPrBodyLimit`, which would cause `substring` to throw; consider wrapping it in `Math.max(0, ...)` before using it.
- The relative link in `truncationMessage` (`../blob/release-notes-%s/release-notes-missing-%s.md`) may not resolve correctly from the PR body; it would be more robust to use an absolute GitHub URL built from the origin repo/branch or a simple filename reference without a relative path.

## Individual Comments

### Comment 1
<location path="presto-release-tools/src/main/java/com/facebook/presto/release/tasks/GenerateReleaseNotesTask.java" line_range="204-213" />
<code_context>
+        if (fullSummary.length() > githubPrBodyLimit) {
</code_context>
<issue_to_address>
**issue:** Guard against negative `availableSpace` when truncating the summary

If `truncationMessage.length() + RELEASE_NOTES_FOOTER.length() + 100` is greater than `githubPrBodyLimit`, `availableSpace` becomes negative, causing `substring(0, availableSpace)` to throw. Please clamp `availableSpace` at 0 (e.g., `Math.max(0, availableSpace)`) or short‑circuit to a minimal fallback body when `availableSpace <= 0`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@unidevel
Copy link
Copy Markdown
Contributor Author

@sourcery-ai review

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The Markdown link in the truncation notice (../blob/release-notes-%s/release-notes-missing-%s.md) is unlikely to resolve correctly from a PR description; consider using a repo-relative path (e.g. /blob/release-notes-%s/...) or just referencing the filename without a link so users can reliably locate the file.
  • When truncating releaseNotesSummary to fit the PR body limit, the substring is cut at an arbitrary character boundary; consider trimming at the last newline or word boundary within availableSpace to avoid broken Markdown and mid-word truncation in the rendered PR description.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The Markdown link in the truncation notice (`../blob/release-notes-%s/release-notes-missing-%s.md`) is unlikely to resolve correctly from a PR description; consider using a repo-relative path (e.g. `/blob/release-notes-%s/...`) or just referencing the filename without a link so users can reliably locate the file.
- When truncating `releaseNotesSummary` to fit the PR body limit, the substring is cut at an arbitrary character boundary; consider trimming at the last newline or word boundary within `availableSpace` to avoid broken Markdown and mid-word truncation in the rendered PR description.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM!

Makes sense.

Note for the future, if relevant:
The summary states that the release owner must remove the release-notes-missing-<version>.md file before the release notes PR is merged. If we plan to keep this workaround for the future, suggest automating the file deletion as part of the release process.

@tdcmeehan tdcmeehan merged commit e3035d9 into prestodb:master Mar 31, 2026
2 checks passed
unidevel added a commit to prestodb/presto that referenced this pull request Mar 31, 2026
#27466)

## Description
1. presto-release-tools can not be fetched due to maven central
publishing limitation
2. check maven central publishing requirements
3. add required `<name>` field to presto-lance 

## Motivation and Context
Depends on PRs:
- prestodb/presto-release-tools#65
- prestodb/presto-release-tools#64
- prestodb/presto-release-tools#63
- prestodb/presto-release-tools#62

## Impact
CI

## Test Plan
Tested with:
1. release note check action:
https://github.com/prestodb/presto/actions/runs/23815800338/job/69414865062?pr=27466
2. maven central publishing requirements check:
https://github.com/unix280/presto/actions/runs/23812452401/job/69402863222#step:8:76
3. Prepare release action in presto =>
https://github.com/unix280/presto/actions/runs/23812844511
4. Release notes PR => unix280#52
5. Release notes missing list file =>
https://github.com/unix280/presto/blob/release-notes-0.297/release-notes-missing-0.297.md

## Contributor checklist

- [ ] Please make sure your submission complies with our [contributing
guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md),
in particular [code
style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style)
and [commit
standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards).
- [ ] PR description addresses the issue accurately and concisely. If
the change is non-trivial, a GitHub Issue is referenced.
- [ ] Documented new properties (with its default value), SQL syntax,
functions, or other functionality.
- [ ] If release notes are required, they follow the [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines).
- [ ] Adequate tests were added if applicable.
- [ ] CI passed.
- [ ] If adding new dependencies, verified they have an [OpenSSF
Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or
higher (or obtained explicit TSC approval for lower scores).

## Release Notes
Please follow [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines)
and fill in the release notes below.

```
== NO RELEASE NOTE ==
```

## Summary by Sourcery

Update CI and release scripts to retrieve presto-release-tools from
GitHub releases using a configurable version instead of Maven Central.

CI:
- Change release-notes-check workflow to download the
presto-release-tools executable directly from GitHub releases and run it
from a temporary path.
- Make the release-notes-check workflow use a configurable
RELEASE_TOOLS_VERSION with a default of 0.13.

Deployment:
- Update release preparation workflow and release-notes script to use a
configurable RELEASE_TOOLS_VERSION (default 0.13) and fetch
presto-release-tools from GitHub releases instead of Maven.

Chores:
- Align release tooling version and retrieval method across CI workflows
and release scripts.
bibith4 pushed a commit to bibith4/presto that referenced this pull request Apr 1, 2026
prestodb#27466)

## Description
1. presto-release-tools can not be fetched due to maven central
publishing limitation
2. check maven central publishing requirements
3. add required `<name>` field to presto-lance 

## Motivation and Context
Depends on PRs:
- prestodb/presto-release-tools#65
- prestodb/presto-release-tools#64
- prestodb/presto-release-tools#63
- prestodb/presto-release-tools#62

## Impact
CI

## Test Plan
Tested with:
1. release note check action:
https://github.com/prestodb/presto/actions/runs/23815800338/job/69414865062?pr=27466
2. maven central publishing requirements check:
https://github.com/unix280/presto/actions/runs/23812452401/job/69402863222#step:8:76
3. Prepare release action in presto =>
https://github.com/unix280/presto/actions/runs/23812844511
4. Release notes PR => unix280#52
5. Release notes missing list file =>
https://github.com/unix280/presto/blob/release-notes-0.297/release-notes-missing-0.297.md

## Contributor checklist

- [ ] Please make sure your submission complies with our [contributing
guide](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md),
in particular [code
style](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#code-style)
and [commit
standards](https://github.com/prestodb/presto/blob/master/CONTRIBUTING.md#commit-standards).
- [ ] PR description addresses the issue accurately and concisely. If
the change is non-trivial, a GitHub Issue is referenced.
- [ ] Documented new properties (with its default value), SQL syntax,
functions, or other functionality.
- [ ] If release notes are required, they follow the [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines).
- [ ] Adequate tests were added if applicable.
- [ ] CI passed.
- [ ] If adding new dependencies, verified they have an [OpenSSF
Scorecard](https://securityscorecards.dev/#the-checks) score of 5.0 or
higher (or obtained explicit TSC approval for lower scores).

## Release Notes
Please follow [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines)
and fill in the release notes below.

```
== NO RELEASE NOTE ==
```

## Summary by Sourcery

Update CI and release scripts to retrieve presto-release-tools from
GitHub releases using a configurable version instead of Maven Central.

CI:
- Change release-notes-check workflow to download the
presto-release-tools executable directly from GitHub releases and run it
from a temporary path.
- Make the release-notes-check workflow use a configurable
RELEASE_TOOLS_VERSION with a default of 0.13.

Deployment:
- Update release preparation workflow and release-notes script to use a
configurable RELEASE_TOOLS_VERSION (default 0.13) and fetch
presto-release-tools from GitHub releases instead of Maven.

Chores:
- Align release tooling version and retrieval method across CI workflows
and release scripts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants