Skip to content

fix(skill): Detect stacked PR context from branch#5223

Open
adinauer wants to merge 1 commit intomainfrom
feat/create-java-pr-stack-detection
Open

fix(skill): Detect stacked PR context from branch#5223
adinauer wants to merge 1 commit intomainfrom
feat/create-java-pr-stack-detection

Conversation

@adinauer
Copy link
Member

📜 Description

Improve the local create-java-pr skill so it determines whether to run in standalone or stacked PR mode from git context.

The skill now checks the current branch and existing PR relationships to infer stack context, instead of relying on manual prompting.

💡 Motivation and Context

When the workflow starts on main, it should default to a normal PR against main and not accidentally assume stacked PR behavior.

This change makes that default explicit and still allows stacked mode when the user asks for it.

💚 How did you test it?

  • Ran ./gradlew spotlessApply apiDump successfully (using JDK 17 locally)
  • Verified the updated skill content and git diff

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

  • Use the updated skill in future PR prep flows and refine heuristics if new branch patterns appear.

#skip-changelog

Update the create-java-pr skill to infer standalone vs stacked PR mode\nfrom git branch and existing PR relationships.\n\nWhen running on main/master, default to standalone PR mode and only\nenter stack mode when explicitly requested by the user.\n\nCo-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@sentry
Copy link

sentry bot commented Mar 23, 2026

Sentry Build Distribution

App Name App ID Version Configuration Install Page
SDK Size io.sentry.tests.size 8.36.0 (1) release Install Build

@adinauer adinauer marked this pull request as ready for review March 23, 2026 15:23
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

```bash
gh pr list --base "$(git branch --show-current)" --json number,headRefName,title
```
If there are downstream PRs, treat this as a stack base context.
Copy link

Choose a reason for hiding this comment

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

Collection branch misclassified as standalone PR context

Medium Severity

The decision tree classifies any branch whose PR targets main/master as standalone, then only checks for downstream PRs when no PR exists for the current branch. A stacked-PR collection branch has a PR targeting main and has downstream stack PRs — but the downstream check is never reached, so the collection branch is incorrectly treated as standalone. The downstream-PR check needs to also run when a PR exists with baseRefName equal to main/master to correctly detect a stack base.

Fix in Cursor Fix in Web

```bash
gh pr list --base "$(git branch --show-current)" --json number,headRefName,title
```
If there are downstream PRs, treat this as a stack base context.
Copy link

Choose a reason for hiding this comment

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

Undefined "stack base context" PR type mapping

Low Severity

The downstream-PR check concludes with "treat this as a stack base context," but the three defined PR types below (standalone, first PR of new stack, next PR in existing stack) don't include a "stack base context" option. The classification result doesn't map to any actionable PR workflow, leaving behavior ambiguous.

Additional Locations (1)
Fix in Cursor Fix in Web

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.

1 participant