Skip to content

fix(release): next-reset reads the released PR + fails safe to preserve next (#278) - #279

Merged
Shinrai merged 2 commits into
nextfrom
fix/next-reset-preserves-next-on-hotfix
Sep 6, 2026
Merged

Shinrai merged 2 commits into
nextfrom
fix/next-reset-preserves-next-on-hotfix

Conversation

@cldmv-bot

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

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

No new features

🐛 Bug Fixes

📦 Dependencies

No dependency updates

🔧 Other Changes

👥 Contributors

…ve next (#278)

workflow-next-reset.yml decides whether a release was a normal (next → master)
or hotfix (hotfixes → master) release by reading the merged PR's head ref with
`gh pr view`. Two defects made every hotfix release force-reset `next` and drop
its queued commits:

1. The app-token step requested only contents + workflows. create-app-token
   switches to fine-grained mode as soon as any permission flag is set, granting
   ONLY the requested scopes — so the token had no pull-requests permission,
   `gh pr view` was silently denied (error swallowed by 2>/dev/null), the lane
   resolved to "other" for every hotfix, and next was force-reset. The merge
   path was dead code. Proven on CLDMV/gh-broker run 34014340050, which logged
   "released PR #46 head ref: <unknown>" then reset next to 6902569.

2. The detection failed OPEN to the destructive path: an unreadable/unknown head
   defaulted to lane=other (reset).

Fixes:
- Grant permission_pull_requests on the token so the lane can be read.
- Fail SAFE: run the reset only when the head ref is positively a non-hotfixes
  branch; an unknown/unreadable head falls through to the hotfix/preserve (merge)
  path, never the reset. Surface the gh error instead of swallowing it.

Version-collision (concurrent hotfix + next resolving to the same X.Y.Z) and a
redundant release-PR auto-close guard remain as separate follow-ups.

Fixes #278
@cldmv-bot cldmv-bot Bot added ! fix → next v4 flow: fix contributor PR targeting the next integration branch type: ci Changes to CI workflows, actions, or build pipelines labels Sep 6, 2026
@Shinrai
Shinrai requested a lite review from Copilot September 6, 2026 07:11

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.

🔵 Needs a closer look

It changes release automation that can force-update long-lived branches, so a human should sanity-check the new permissioning and lane fallback behavior before approval.

Pull request overview

Updates the v4 reusable workflow-next-reset workflow to correctly detect whether a release: commit came from the hotfixes → master lane versus a normal release lane, so next is preserved on hotfix releases (avoiding silent data loss described in #278).

Changes:

  • Request pull-requests permission on the minted App token so gh pr view can read the released PR’s headRefName during lane detection.
  • Make lane detection surface gh pr view errors and default to the “preserve next” path when the released PR head ref can’t be determined.
File summaries
File Description
.github/workflows/workflow-next-reset.yml Adds PR permission + safer lane detection to prevent force-resetting next after hotfix releases.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Shinrai
Shinrai previously approved these changes Sep 6, 2026
…set lane detection

create-app-token gains a permission_pull_requests_read flag that requests the
fine-grained pull-requests READ scope (write still available via
permission_pull_requests, which wins when both are set). workflow-next-reset
switches to it: the lane detection only reads the released PR's head ref via
`gh pr view`, so read is sufficient — the bot token no longer needs
pull-requests write. (#278)
@cldmv-bot cldmv-bot Bot added the area: core Touches core library / runtime source code label Sep 6, 2026
@Shinrai
Shinrai merged commit 78b7a0a into next Sep 6, 2026
14 checks passed
@cldmv-bot
cldmv-bot Bot deleted the fix/next-reset-preserves-next-on-hotfix branch September 6, 2026 15:25
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 type: ci Changes to CI workflows, actions, or build pipelines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants