Skip to content

fix(release-pr): stop the changelog racing the API-pushed version bump - #265

Merged
Shinrai merged 2 commits into
nextfrom
fix/release-pr-commit-range-race
Sep 5, 2026
Merged

Shinrai merged 2 commits into
nextfrom
fix/release-pr-commit-range-race

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

No new features

🐛 Bug Fixes

No bug fixes

📦 Dependencies

No dependency updates

🔧 Other Changes

👥 Contributors

get-pr-commit-range re-read pr.head.sha from a live GET /pulls/{n} that raced
the ref update done by github/api/commit — which creates the `chore: bump
version` commit and moves refs/heads/<branch> through the REST API alone,
never fetching it into the job's local checkout. The range's head sha was
therefore absent locally, so `git log <base>..<head>` in "Compute commit types
in PR range" fataled (exit 128, failing the labels step) and
generate-comprehensive-changelog silently emitted an empty "successful"
changelog (reproduced on droidsock PR #19).

- get-pr-commit-range: use the local HEAD (the release branch's content tip and
  the bump commit's parent; the bump commit is filtered from the changelog/label
  steps regardless) as the range head, falling back to the API head only when
  HEAD can't be read. Always locally resolvable — no propagation race.
- generate-comprehensive-changelog: fail loud when a base..head range has an
  endpoint missing from the checkout instead of shipping an empty changelog.
- update-release-pr "Compute commit types": validate both range endpoints
  resolve before `git log`, erroring clearly instead of a bare fatal/exit 128.

Fixes #262
@cldmv-bot cldmv-bot Bot added ! fix → next v4 flow: fix contributor PR targeting the next integration branch area: core Touches core library / runtime source code labels Sep 3, 2026
@Shinrai
Shinrai requested a lite review from Copilot September 5, 2026 21:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes are targeted and reduce a concrete failure mode; the remaining feedback is limited to minor documentation/PR-metadata alignment.

Pull request overview

This PR hardens the release-PR automation against a race where a version-bump commit is pushed via the GitHub API (updating the remote ref) but is not present in the job’s local checkout, causing downstream git log <base>..<head> consumers to fail or generate an empty changelog.

Changes:

  • Prefer the locally checked-out HEAD when computing the PR commit range, falling back to the API-reported head SHA only when HEAD can’t be resolved.
  • Add explicit “fail loud” validation when a commit-range endpoint isn’t present locally (both in the changelog generator and in the commit-type labeling step).
  • Improve error messaging so the failure mode is actionable when the range can’t be computed from the local repo state.
File summaries
File Description
.github/actions/github/steps/get-pr-commit-range/action.mjs Switches commit-range head selection to prefer local HEAD to avoid missing API-pushed commits in local .git.
.github/actions/github/jobs/update-release-pr/action.yml Adds a guard that errors out if the computed commit range can’t be resolved in the local checkout before computing commit types.
.github/actions/git/steps/generate-comprehensive-changelog/action.mjs Adds a preflight check to avoid silently producing an empty changelog when the provided range can’t resolve locally.
Review details
  • Files reviewed: 3/3 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 thread .github/actions/github/steps/get-pr-commit-range/action.mjs
Comment thread .github/actions/github/steps/get-pr-commit-range/action.mjs Outdated
Addressing Copilot review on #265: the comment said the API-head fallback is for
'an edge/detached checkout', but git rev-parse HEAD resolves fine in a detached
HEAD. The fallback is really for when the workspace isn't a git checkout at all
(or git is unavailable). Reword accordingly.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes consistently address the local-checkout vs API-pushed-SHA mismatch and add appropriate fail-fast safeguards without introducing conflicting behavior in the updated workflow path.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Touches core library / runtime source code ! fix → next v4 flow: fix contributor PR targeting the next integration branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants