Repository navigation
chore(gates): check the pull request body sections and word limit - #4841
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on b96b4d8. The verdict and the full list are in the summary comment.
`docs/agents/pull-requests.md` stated body rules nothing checked: an agent that skipped `## Before / after`, or left a body naming a commit a rebase had dropped, opened a PR that passed. This adds the missing check, so the prose can shrink to what no check can say. `scripts/pr-body/model.ts` holds the decision as one pure function: required sections, the `No observable change` escape with a stated reason, a 250-word budget outside code blocks, tables, and bot footers, and a tested SHA that is still an ancestor of the head. `scripts/pr-body/check.ts` answers only the question the model cannot: whether a SHA resolves, from the checkout. It reads the title and body from the event payload the runner writes, so a fork cannot steer the check by editing its own body. Bot authors and drafts are exempt. A SHA the checkout cannot look up is printed as a note, not as a stale body.
A run of digits the repository has no commit for is not an object id, so it neither satisfies the Validation SHA rule nor reports a stale body.
0349f65 to
b89876b
Compare
Size Report
Startup median (7 runs, lower is better):
|
This comment has been minimized.
This comment has been minimized.
|
The change at b89876b is ready, and the checks pass: Body rules passes for this head (an earlier cancelled run was superseded by a later event) and the diff is the route that job exercises. No conflicts. Nothing blocks merge. Not blocking, and each can be taken or left: docs/agents/pull-requests.md now gives a type-only rule, so the old "when a caller can observe the change, output and errors included" sentence could return as an "also add it for any other type" line. scripts/pr-body/check.ts and pr-body.yml say the fork contributes nothing the check runs, but under pull_request the merge ref supplies the scripts too, so the comment could say the payload supplies title and body. pr-body.yml runs a full checkout, install and the pr-body-model tests on every body edit, and those tests do not depend on the body. model.ts applies the 8-word floor to "no observable change" even when the section also has fenced output, so the floor could apply only when the section has no fenced or table content. model.ts treats any 7-40 character hex token as a commit, so words like "defaced" or session-id segments get a misleading "not a commit this repository has" message, and a plain "name the tested commit SHA" message could be used unless the token has 10 or more characters or mixes digits and letters. model.ts has the typo "spellyings". The open inline thread on digit-run tokens is fixed at this head and can be resolved: #4841 (comment) Not verified here: fork-PR and rebased-PR runs, the tests locally, and the numbers on earlier merged PRs. |
Drop the tested-SHA ancestry rule, its git plumbing and full-history checkout, the Markdown table handling, and the unit tests. One script reads the event payload and checks the required sections by title type and the word limit.
CodeQL reads the regex replace as incomplete HTML sanitization. The text is only counted, never rendered, but a split-based strip avoids the pattern and also handles an unclosed comment.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 3 new findings on b99ee73. The verdict and the full list are in the summary comment.
…rs inside fences A fenced block is replaced by a bare fence before sections and comments are read. The template no longer says table words are free.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 4 new findings on a54a777. The verdict and the full list are in the summary comment.
… text, anchor the bot footer An indented fence inside a list item is a code block. A `<!--` in an inline code span opens no comment. A footer marker quoted mid-line is not a footer.
Apex Sentinel · ✅ Approve · review of
|
| Where | Finding |
|---|---|
scripts/check-pr-body.ts:10 |
Any line-initial <!-- before the last required section reports that section as missing |
🔵 Nit (2)
| Where | Finding |
|---|---|
scripts/check-pr-body.ts:64 |
Indented code blocks are still read as prose, so a fake heading inside one passes the gate |
scripts/check-pr-body.ts:52 |
Text between an inline <!-- and a later --> is erased, so real sections read as missing |
Reviewed with this repository's own Sentinel configuration (357e0d4a7513).
💬 Talking to Sentinel
In a finding's thread, reply with:
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
This PR is ready at 2863af2. It fixes the unclosed Not blocking, and fine to take or leave: withoutComments() still pairs a Of the earlier inline threads, these no longer apply and can be resolved: #4841 (comment) (the SHA-token parsing was deleted), #4841 (comment) (no regex replace is left in the comment strip), #4841 (comment) (a section with only a fenced block now counts as empty), #4841 (comment) (the template text now matches the script), #4841 (comment) (fences are replaced before the comment strip), #4841 (comment) (an indented heading only makes the gate accept more), #4841 (comment) (the footer cut is intended and the failure names the section), and #4841 (comment) (indented fences no longer count toward the limit). One lower-priority thread still applies, #4841 (comment), and it matches the first note above. Not verified here: lint, typecheck, format:check, check:gate-manifest, check:agent-guidance and check:fallow were not re-run locally. They rely on the checks listing. The head script was run on this PR's title and body in the event shape and printed |
Summary
Adds a CI check for the pull request body rule in
docs/agents/pull-requests.md, plus a template with the headings. Nothing verified the rule before, so bodies omitted## Before / afteror## Value.The check is one 111-line script that reads the title and body from the event payload:
## Summaryand## Validationare required.featandfixtitles need## Before / after.No observable changewith a reason satisfies it.refactortitles need## Value.An earlier revision also checked the tested SHA against the head and shipped 499 lines of unit tests. Both are removed: the diff went from 1,179 lines to 183.
Validation
Tested at
2863af2cb9.## Valueand has 591 words; the rest pass.lint,typecheck,format:check,check:gate-manifest,check:agent-guidanceandcheck:fallowpass.check:affectedreceipt: hosted CI is the validation.