Repository navigation
Add a deterministic light or full review classifier for docs PRs - #378
Closed
theletterf wants to merge 2 commits into
Closed
theletterf wants to merge 2 commits into
theletterf wants to merge 2 commits into
Conversation
Reviewers have no shared signal for when a docs PR needs the full review checklist. The classifier applies the rules from elastic/docs-content-internal#1943 to the diff, posts one comment with the matching checklist, and sets a review label that people can override. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rules lived in workflow inputs, so every threshold change needed a docs-actions release and two callers had to repeat labels and links. The caller repo now keeps them in .github/review-classifier.yml, read from the default branch so a PR cannot change the rules that classify it. The file can also turn off triggers and add custom path rules. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
|
Replaced by #382. The branch name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docs repositories can now label each pull request as light review or full review, and post one comment that links to the matching review checklist. Each repository keeps its rules in its own
.github/review-classifier.yml. The rules use only the diff, file paths, and GitHub metadata. The caller templates start in a manual dry-run mode, so nothing is posted until a maintainer asks for it.Prompt summary: Implement the classifier that elastic/docs-content-internal#1943 specifies, with the Google Doc spec as its source. Put it in docs-actions as reusable workflows with caller templates. Include Vale by default, apply review labels with human overrides, and start with a dry-run mode that targets one PR. Keep the rules in the caller repository, so teams can maintain them without a docs-actions release.
Why
Reviewers in docs-content have no shared, visible signal for when a PR needs the full review checklist instead of the light one. elastic/docs-content-internal#1943 defines nine deterministic triggers for that decision. The team also wants to check the trigger rates on real PRs, and to tune the rules, before the classifier comments on every PR.
What
Nine full review triggers
classify.pychecks for new or deleted pages, new redirects, more than 5 changed files, 3 or more changed images, and snippets that pages in more than one folder include. It also checks for heading changes or a size-based share of changed lines, changed or removedapplies_tovalues, and new external links. It reads base versions of files from git through a blobless checkout, so it makes no API call per file. It ignores whitespace-only and rewrapped lines, code blocks, and frontmatter.Rules in the caller repository
The caller repository keeps its rules in
.github/review-classifier.yml. The file can change each value, turn off any trigger, and add custom rules that ask for a full review when a changed file matches a path. It also sets the label names, the checklist links, and the Vale settings. Both phases read the file from the default branch, never from the PR head, so a PR cannot change the rules that classify it. A dispatch run reads the file from its own branch, so maintainers can test a rule change in a dry run. The loader rejects unknown keys and wrong types with a clear error.review-classifier/config.ymlis an example file with the defaults, and a test keeps it equal to the built-in defaults.Two phases that are safe for fork PRs
review-classifier.ymlruns with read-only permissions and uploads a decision artifact that holds data only.review-classifier-comment.ymlruns onworkflow_run, validates the artifact against a strict schema and the config, and builds the comment from fixed templates. It skips the run if the PR head changed. It trusts the PR number in the artifact only forworkflow_dispatchruns.Labels, overrides, dry run, and Vale
The comment workflow sets
review: lightorreview: fullto show the final tier. A person who applies the other label overrides the rules, and the comment says so. The caller template starts withworkflow_dispatchonly, withpr-numberanddry-run: trueinputs. A dry run writes a preview to the job summary and posts nothing. By default, the classification job also runsvale/lint, and the comment shows counts and the first 10 findings on changed lines.Backtest
backtest.pyruns the rules from a config file on recently merged PRs in a local clone, and prints the rate of each trigger. On 185 recent docs-content PRs, 53% get a full review with the rules from the issue. Withsubstantial-change.headings: false, 42% get a full review. I will share the numbers on elastic/docs-content-internal#1943 before the team chooses values.Risk: The comment workflow has
pull-requests: writeand reads an artifact that a fork PR can influence. It inserts only validated trigger IDs, numbers, sanitized paths, and text from the trusted config into the comment. It changes only the two configured labels. The Vale file list includes only paths with safe characters, becausevale/lintputs that list into a shell script.Out of scope: The no-review tier from elastic/docs-content-internal#1940. The docs-content callers and config are in elastic/docs-content#8604.
Verify
The workflows have not run on GitHub yet. The next step is to test them in
elastic/docs-actions-sandbox, including a fork PR.🤖 Generated with Claude Code
Related to #402