Skip to content

ci: require a whole-change check in pull requests that change docs or code - #959

Merged
eizedev merged 2 commits into
mainfrom
ci/whole-change-check
Nov 25, 2026
Merged

eizedev merged 2 commits into
mainfrom
ci/whole-change-check

Conversation

@eizedev

@eizedev eizedev commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Summary

The growth guards count lines, and a number cannot judge sense. Pages and functions grew by appending, and a failing guard was passed by squeezing lines or cutting words. The guard stays an alarm. A pull request that changes docs or code now carries a written whole-change check, and the review judges it.

  • Template: a "Whole-change check" section. Its prompts sit in a comment, so the untouched template does not pass.
  • CI: whole-change-check.yml runs scripts/whole-change-check.js on opened, synchronize, reopened and edited. It fails when the pull request changes docs/**/*.md, a README, root Markdown, packages/*/src or scripts/ and the description has no ## Whole-change check with text under it. Editing the description re-runs it.
  • Security: pull_request, never pull_request_target; contents: read; persist-credentials: false. The body, title and author reach the script only through env; no ${{ }} inside run (asserted in tests/workflows.test.js).
  • Exempt: Dependabot (author dependabot[bot]) and release pull requests (title chore(release): … x.y.z or chore(<scope>): release … x.y.z). The title is the author's word; the review sees it.
  • Growth guard: a function or page that grew now says: stop and check the whole, then reshape for real or raise the baseline with the reason in the whole-change check and the maintainer's approval; never merge lines or cut words to pass.
  • Rules: the AGENTS.md growth line, CONTRIBUTING.md's growth and pull request sections, and PRODUCT.md's deliverables say the same.

Whole-change check

Docs, each read whole:

  • .github/PULL_REQUEST_TEMPLATE.md (a contributor opening a pull request; task: know what to write). The new section sits after the Summary. Its prompts are one comment, so the page people see stays as short as before. The growth line of the test plan now points to the check instead of the Summary. Nothing removed.
  • AGENTS.md, Commands: I rewrote the second growth line instead of adding one.
  • CONTRIBUTING.md: I rewrote the known-entry bullet (summary to whole-change check, "fixes" to "decides"). "Pull request" gets one bullet between the issue and the tests, where a contributor reads it before opening.
  • PRODUCT.md, "What a contribution delivers": the check is a deliverable, so it is one bullet in that list. The growth sentence there now says "decides", as CONTRIBUTING does.

Code, each read whole:

  • scripts/whole-change-check.js: new, one job: the verdict on a pull request's description. Pure functions (inScope, sectionText, exemption, check) and a thin main that reads only process.env.
  • scripts/growth.js: I rewrote ADVICE for functions and docs. The shared wording is extracted into STOP and OR_RAISE. unused and duplication stay as they are: an unused export is deleted, and duplication has a fixed threshold with no baseline to raise.
  • Tests: a new unit test file for the script. tests/workflows.test.js gets one test for the new workflow, as each workflow concern has its own test there.

Neutral review

A separate read-only session reviewed the commit against the whole repository. Security found nothing: pull_request only, contents: read, and the body only through env. I fixed:

  • The release exemption matched any chore(release): title. It now needs a version at the end (test: "chore(release): fold the unreleased entries ..." is not exempt).
  • A # line inside a code fence counted as a heading. Fences are now tracked (two tests).
  • The changed files are listed with --no-renames, so a file moved out of scope still counts.
  • PRODUCT.md and CONTRIBUTING.md disagreed on "fix" and "decide". Both now say "decides".
  • The script header named the other repository; removed.

Left as is: any text with a letter passes ("n/a" too), because the check asks for the judgement and the review judges it. A pull request with merge conflicts has no merge ref, so the check does not run until the conflict is resolved.

Test plan

  • npm test: all workspaces and tests/*.test.js pass, 0 failures.
  • npm run growth: functions, unused, duplication, docs ok.
  • npm run lint, npm run types: clean.
  • actionlint .github/workflows/whole-change-check.yml: clean.
  • Mutation check: an expression put into the step's run, and edited removed from the types, each make tests/workflows.test.js fail.
  • This pull request changes scripts/ and root Markdown, so the new job runs on it.

🤖 Generated with Claude Code

eizedev and others added 2 commits November 25, 2026 23:12
… code

The growth guards count lines, and a number cannot judge sense: pages and
functions grew by appending, and a failing guard was passed by squeezing
lines or cutting words. The guard stays an alarm. A pull request that
changes docs or code now says in its description what its author read
whole and how the change reshaped it, and the review judges that.

- PULL_REQUEST_TEMPLATE.md: a "Whole-change check" section with its prompts
  in a comment, so the untouched template does not pass
- scripts/whole-change-check.js and whole-change-check.yml: fail a pull
  request that changes docs/, a README, root Markdown, packages/*/src or
  scripts/ without text in that section; runs again on an edited
  description; the description reaches the script only through env;
  Dependabot and release pull requests are exempt
- growth.js: a function or page that grew says to stop and check the
  whole, then reshape or raise the baseline with a reason
- AGENTS.md, CONTRIBUTING.md, PRODUCT.md: the raised baseline's reason and
  the check as a deliverable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- a release pull request's title ends in its version, so a
  "chore(release): ..." clean-up is no longer exempt
- a "#" line inside a code fence of the description is no heading
- the changed files are listed without rename detection, so a file moved
  out of scope still counts by its old path
- the script names no other repository; wording aligned where the review
  found two texts disagreeing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eizedev
eizedev merged commit 92a0cef into main Nov 25, 2026
25 checks passed
@eizedev
eizedev deleted the ci/whole-change-check branch November 25, 2026 22:32
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