Conversation
Add sympy_bot/pr_template.py with a pure validate_pr_template(pr_desc) function (mirroring get_changelog) that checks a PR description against the SymPy pull request template. The checks are independent functions in a CHECKS list so more can be added later: - all required section headings are present verbatim, - every HTML comment from the template is kept verbatim (deleting or rewriting them is a signal of AI-generated text), and - the Brief description and AI Generation Disclosure sections are non-empty. The canonical template is embedded as PR_TEMPLATE (the single source of truth) and the required comment strings are derived from it so they can't drift. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add close_pr_if_bad_template, called from pull_request_edited only when a first-time contributor (author_association FIRST_TIME_CONTRIBUTOR or FIRST_TIMER) opens a PR. If the description doesn't follow the pull request template, the bot posts a comment explaining what's wrong and closes the PR, directing the author to open a new one with the same changes (a closed PR can't be reopened by the author). Compliant PRs and PRs from established contributors are untouched. Update the shared description fixtures in test_webapp.py to be template-compliant (derived from PR_TEMPLATE) so the existing release notes tests still pass, and add tests for the new handler and its gating. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
I've been thinking about it more and it's probably not a good idea to have the bot close people's PRs as that's annoying. And there actually aren't that many people that break the rules now that we're not in GSoC application season. (Here's a visualization claude made of how many PRs have lacked the AI disclosure statement or left it empty in 2026). It would probably be better to just have the bot leave a comment telling people to include it. |
|
I think we should reconsider this. People can reopen the PR once they fix the template. |
I don't think that's true. I believe if someone else closes their PR they can't reopen it (unless they're a maintainer). We probably should have the bot leave a comment though. Maybe the bot could flag such PRs with a label to make it easy to identify which PRs are violating the rules? |
Yes, that is correct. They have to make a new PR if they are not a maintainer. |
|
The bot could reopen the PR if it is fixed. I don't know if that works for checks (are checks run for closed PRs?), but it's easy for the PR description check. |
| # truth for this module. To update the checks when the upstream template | ||
| # changes, replace the text below with the new contents of | ||
| # https://github.com/sympy/sympy/blob/master/.github/PULL_REQUEST_TEMPLATE.md | ||
| PR_TEMPLATE = '''\ |
There was a problem hiding this comment.
I don't think we should duplicate the template here. That is just going to be annoying every time we update the template in SymPy. The bot should be able to pull in the template using the github file API pretty easily.
There was a problem hiding this comment.
(and indeed if we do merge this we'll want to add something to the top of the template stating that the headings are all required and the PR will be closed automatically if they aren't filled out)
References to other Issues or PRs
sympy/sympy#29289
https://groups.google.com/g/sympy/c/Tx_yg8NxP5U/m/gu_9mZhLCgAJ
Brief description of what is fixed or changed
Enforces the PR template for new contributors:
AI Generation Disclosure
All the code is AI written, but I have looked through it carefully and understand it. I have not tested to see if works yet though.