Skip to content

Require PR authors to claim the issues they reference - #5460

Open
rchen152 wants to merge 4 commits into
meta:mainfrom
rchen152:export-D128542616
Open

rchen152 wants to merge 4 commits into
meta:mainfrom
rchen152:export-D128542616

Conversation

@rchen152

Copy link
Copy Markdown
Contributor

Summary:
Updates the PR readiness check to check that the PR author has claimed the issue they are working on:

  • If the PR description references at least one open, unclaimed issue, claiming the issue is listed as a required action.
  • If the PR description references only issues claimed by other people, getting one of the issues reassigned to the PR author is listed as a required action.
  • If the PR description references no issues or only closed issues, referencing and claiming an issue is listed as an optional action.

It's maybe a little weird that we're stricter about referenced issues than not referencing an issue at all? My thinking is that we haven't really had problems with PRs not referencing issues, and it would be annoying if, say, someone who just wanted to fix a typo in our README got a comment saying that opening an issue first was required.

Examples of posted comments:

When the description references an open, unclaimed issue:

⚠️ Action needed: this PR is missing required items from our pull request checklist:

Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

When the description references an issue claimed by someone else:

⚠️ Action needed: this PR is missing required items from our pull request
checklist
:

Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

When the description does not reference an issue:

✅ This PR meets all requirements from our pull request checklist.

Optional recommendations:

  • If this PR addresses an open issue, please link the issue in the PR description and claim it.

Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

When the description references only closed issues:

✅ This PR meets all requirements from our pull request checklist.

Optional recommendations:

Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

Differential Revision: D128542616

…criptions (meta#5458)

Summary:

* Adds a check to the automation_pr_state workflow to require the checkbox.
* A PR that fails the check is left in the waiting-for-author state, and a bot-posted comment explains why. The comment is posted only when the check fails.
* The check runs when a PR has a cla-signed label added, when a draft PR is moved to non-draft, and when a PR with the bot comment is updated. This means that new PRs get the check, and the comment is kept up-to-date, but old PRs are left untouched.

Here are the comments that the check leaves on PRs:

When the description does not contain the "I am a human" declaration:

  <!-- pr-check -->

  ⚠️ **Action needed**: this PR is missing required items from our [pull request checklist](https://github.com/facebook/pyrefly/blob/main/CONTRIBUTING.md#making-a-pull-request):

  - Add this checkbox to the PR description and check it: `- [x] I am a human, and I fully understand the code I am submitting.` See our [AI policy](https://github.com/facebook/pyrefly/blob/main/AI_POLICY.md).

  Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

When the description contains the declaration but the box is not checked:

  <!-- pr-check -->

  ⚠️ **Action needed**: this PR is missing required items from our [pull request checklist](https://github.com/facebook/pyrefly/blob/main/CONTRIBUTING.md#making-a-pull-request):

  - Check the "I am a human" box in the PR description. See our [AI policy](https://github.com/facebook/pyrefly/blob/main/AI_POLICY.md).

  Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

When the description previously had an issue but now contains the declaration with the box checked:

  <!-- pr-check -->

  ✅ This PR follows our [pull request checklist](https://github.com/facebook/pyrefly/blob/main/CONTRIBUTING.md#making-a-pull-request).

  Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

Differential Revision: D128488447
Summary:

The automated readiness check on new PRs now prints an optional recommendation to split PRs that are large (150+ lines of non-test code) or extra-large (300+ lines of non-test code).

For large PRs, we include a gentle nudge to split into separate PRs if possible. For extra-large PRs, we include a stronger nudge to split into separate PRs or small commits.

Here's what the comment looks like:

If the PR passes all other checks but is large:

  <!-- pr-check -->

  ✅ This PR meets all requirements from our [pull request 
  checklist](https://github.com/facebook/pyrefly/blob/main/CONTRIBUTING.md#making-a-pull-request).
  
  **Optional recommendations**:

  - This PR is on the larger side. If parts of it could be merged on their own, consider [splitting it](https://github.com/facebook/pyrefly/blob/main/CONTRIBUTING.md#splitting-a-pull-request) into separate PRs for faster review. If you've already split it as far as is practical, no action is needed.

  Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

If it passes all other checks but is extra-large:

  <!-- pr-check -->
  
  ✅ This PR meets all requirements from our [pull request 
  checklist](https://github.com/facebook/pyrefly/blob/main/CONTRIBUTING.md#making-a-pull-request).
  
  **Optional recommendations**:

  - This PR is very large, which makes it slow and difficult to review. We strongly recommend [splitting it](https://github.com/facebook/pyrefly/blob/main/CONTRIBUTING.md#splitting-a-pull-request) into smaller PRs that can be merged independently. If that isn't possible, please structure it as a series of small commits. If you've already split it as far as is practical, no action is needed.

  Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

If the PR fails some other check and is also large:

  <!-- pr-check -->

  ⚠️  **Action needed**: this PR is missing required items from our [pull request 
  checklist](https://github.com/facebook/pyrefly/blob/main/CONTRIBUTING.md#making-a-pull-request):
  
  - Check the "I am a human" box in the PR description. See our [AI policy](https://github.com/facebook/pyrefly/blob/main/AI_POLICY.md).

  **Optional recommendations**:
  
  - This PR is on the larger side. If parts of it could be merged on their own, consider [splitting it](https://github.com/facebook/pyrefly/blob/main/CONTRIBUTING.md#splitting-a-pull-request) into separate PRs for faster review. If you've already split it as far as is practical, no action is needed.

  Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

Differential Revision: D128528925
Summary:
Updates the PR readiness check to check that the PR author has claimed the issue they are working on:
* If the PR description references at least one open, unclaimed issue, claiming the issue is listed as a required action.
* If the PR description references only issues claimed by other people, getting one of the issues reassigned to the PR author is listed as a required action.
* If the PR description references no issues or only closed issues, referencing and claiming an issue is listed as an optional action.

It's maybe a little weird that we're stricter about referenced issues than not referencing an issue at all? My thinking is that we haven't really had problems with PRs not referencing issues, and it would be annoying if, say, someone who just wanted to fix a typo in our README got a comment saying that opening an issue first was required.

Examples of posted comments:

When the description references an open, unclaimed issue:

  <!-- pr-check -->

  ⚠️  **Action needed**: this PR is missing required items from our [pull request checklist](https://github.com/meta/pyrefly/blob/main/CONTRIBUTING.md#making-a-pull-request):

  - [Claim](https://github.com/meta/pyrefly/blob/main/CONTRIBUTING.md#claiming-issues-claim--unclaim) the issue that this PR addresses by commenting `#claim` on it. Unclaimed issues referenced in the PR description: meta#101.

  Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

When the description references an issue claimed by someone else:

  <!-- pr-check -->

  ⚠️  **Action needed**: this PR is missing required items from our [pull request 
  checklist](https://github.com/meta/pyrefly/blob/main/CONTRIBUTING.md#making-a-pull-request):

  - Every open issue referenced in the PR description is already assigned to someone else: meta#101. If you're working on one of these issues, please [request](https://github.com/meta/pyrefly/blob/main/CONTRIBUTING.md#claiming-issues-claim--unclaim) that it be reassigned to you.

  Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

When the description does not reference an issue:

  <!-- pr-check -->

  ✅ This PR meets all requirements from our [pull request checklist](https://github.com/meta/pyrefly/blob/main/CONTRIBUTING.md#making-a-pull-request).

  **Optional recommendations**:

  - If this PR addresses an open issue, please link the issue in the PR description and [claim](https://github.com/meta/pyrefly/blob/main/CONTRIBUTING.md#claiming-issues-claim--unclaim) it.

  Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

When the description references only closed issues:

   <!-- pr-check -->

  ✅ This PR meets all requirements from our [pull request checklist](https://github.com/meta/pyrefly/blob/main/CONTRIBUTING.md#making-a-pull-request).

  **Optional recommendations**:

  - Every issue referenced in the PR description is already closed: meta#101. If this PR addresses an open issue, please link the issue in the PR description and [claim](https://github.com/meta/pyrefly/blob/main/CONTRIBUTING.md#claiming-issues-claim--unclaim) it.

  Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour.

Differential Revision: D128542616
@meta-cla meta-cla Bot added the cla signed label Oct 30, 2026
@meta-codesync

meta-codesync Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

@rchen152 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128542616.

@github-actions github-actions Bot added size/l and removed size/l labels Oct 30, 2026

@stroxler stroxler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

This branch has not been deployed

No deployments
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.

NamedTuple unpacking should exclude under methods

2 participants