Skip to content

ci: drop the PR Hygiene commit-count check - #38997

Merged
bolichen97 merged 5 commits into
mainfrom
crew/LinuxFlackyGuard/drop-commit-count
Nov 18, 2026
Merged

bolichen97 merged 5 commits into
mainfrom
crew/LinuxFlackyGuard/drop-commit-count

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A PR is never failed, or told to rebase and force-push, because of how many commits its branch carries.

PR Hygiene's "Enforce commit count" step fails any PR with more than two commits. PRs here are squash-merged by default (auto-merge and the prepare-pr skill use --squash), so the branch's commit count does not reach main. The step catches no bug; it only makes authors rebase and force-push.

It also counts wrong. It runs git rev-list --count "$BASE".."$HEAD", and $BASE is the event's pull_request.base.sha: where main was when the event fired, not where the branch forked. Josh Kiepert traced one case: base.sha was 758622b385, the branch's real fork point was bddefa36fb, so the step counted 61 main commits plus the PR's 1 and reported 62. A re-run reuses the same event, so it reported 62 again. Merging main into a branch (or the Update branch button) trips it the same way.

Why it matters

Every author whose branch picks up a merge commit, or whose event base is stale, gets a red required check that no edit to the code can fix. The remedy (rebase, squash, force-push) costs a CI round and can drop a co-author's commits, for a property main never sees.

Not a goal

  • Making the count correct, for example by counting from the merge-base or with --first-parent as #38678 did for the diff-scoped gates. A correct count still protects nothing under squash merge.
  • Changing the prepare-pr skill's own local squash or push_guard.py's --max-ahead guard. Those guard against squashing someone else's commits or a stale base, which is unrelated to this CI step.
  • Touching any other PR Hygiene step.
  • Changing the repository's allowed merge methods. The main ruleset still allows merge and rebase merges (8 merge-commit PRs landed in the last 60 days); limiting it to squash is a settings change for a maintainer.

What changed (motivation → approach → change)

Squash merge makes the per-PR commit count meaningless, so the step is removed rather than repaired.

  • .github/workflows/pr-hygiene.yml: the "Enforce commit count" step and its MAX_COMMITS are gone. The checkout stays at fetch-depth: 2 and the diff-base step stays, because the reader-list, app-repo, Proof line and Sibling sweep steps still read the merge-base and the base tip.
  • .github/workflows/pr-readiness.yml, .github/scripts/code-review-history.sh: comments no longer mention a commit count. Readiness only listed PR Hygiene as a lane; it never read the step's result.
  • Tests: the tests that ran or read the removed step are dropped (test/test_pr_hygiene_guidance.py keeps its annotation checks; test/test_code_review_history_fetch.py drops the rev-list --count read; test/test_push_guard_record.py stops reading the removed remedy text).
  • Docs: the PR template checklist, CONTRIBUTING.md, AGENTS.md, docs/ci/ci-and-reviews.md, two .kiro/specs design notes, one RFC line, and the prepare-pr skill's SKILL.md and references/ci.md no longer state a one-or-two-commit limit or a rebase-only rule.
  • push_guard.py is unchanged. Its --max-ahead ceiling refuses a branch that picked up foreign history before a local squash, and --squash builds the skill's one reviewed commit; neither exists only for this gate.

Backwards compatibility

Compatible: the change only removes a failure; every PR that passed PR Hygiene still passes. A PR merged with a merge commit instead of a squash can now bring more than two commits into main.

Reader: .github/workflows/pr-readiness.yml:PR Hygiene lane -- release -- reads the job's conclusion, not the step; the job still runs and reports
Reader: .github/workflows/pr-hygiene.yml:Resolve diff base (merge-base) -- release -- still feeds the reader-list and app-repo steps; fetch depth unchanged
Reader: src/kiro_crew/builtin_skills/kirocrew-dev/kirocrew-prepare-pr/scripts/push_guard.py:--max-ahead -- subagent -- its own pre-squash guard; never read the CI step
Reader: test/test_pr_hygiene_guidance.py:TestTheCommitCountRemedy -- release -- removed with the step it read
Reader: test/test_push_guard_record.py:test_the_ci_squash_remedy_vouches_only_after_the_refusal_lists -- release -- removed with the remedy text it read

Tests

  • pytest test/test_pr_hygiene_guidance.py test/test_code_review_history_fetch.py test/test_push_guard_record.py test/test_sweep_check.py test/test_review_repair_routing_skill.py: all pass.
  • The scoped backend run (scripts/run_scoped_tests.py --surface backend) passes everything this diff touches; its only local failures are in test_design_tweak_* and test_ci_file_shards/test_ci_pytest_progress (missing pytest_split on this host), which this diff does not reach.

Manual verification

  • actionlint (actionlint-py) on .github/workflows/pr-hygiene.yml and .github/workflows/pr-readiness.yml: no findings.
  • This PR itself carries five commits: three of its own and two merges of main (3c57a086ef, 5f1b4e333d, the second resolving a CONTRIBUTING.md conflict). The removed step would have counted 5 and failed. PR Hygiene was green on 3c57a086ef with the title, template-section and Reader-line steps still running.
  • Local gates: scripts/check_comment_history.py, scripts/docs-lint.sh, flake8, isort and black on the changed tests all pass.

Related Issues

Related: #3632 (the single-commit rule against GitHub's Update branch button), #38678 (the same stale base.sha problem in the diff-scoped gates). Josh Kiepert's analysis of the 62-commit count is the trigger.

Checklist

  • A Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); the PR is squash-merged, so it may carry any number of commits
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

The repository squash-merges every PR, so a branch's commit count never
reaches main. The check counted base.sha..head, and base.sha is the base
tip at event time, not the fork point, so it also counted main commits.
PR Hygiene no longer counts commits, so the template, CONTRIBUTING,
AGENTS.md, the CI doc and the prepare-pr skill stop stating the limit and
the rebase-only rule that protected it.
The repository also allows merge and rebase merges, so the docs state
squash as the default instead of a guarantee.
@bolichen97
bolichen97 marked this pull request as ready for review November 18, 2026 05:11
@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 18, 2026 05:11
@bolichen97
bolichen97 enabled auto-merge (squash) November 18, 2026 05:11
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 5f1b4e333d02c800e4c55c6cdfedf6c4f4e3470f touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 5f1b4e333d02c800e4c55c6cdfedf6c4f4e3470f — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: under squash merge the branch commit count never reaches main, and the removed step's only readers are the tests this PR drops with it.

Notes

  • The pipeline-conductor's max_commits and --max-ahead {max_commits} (builtin_skills/pipeline-conductor/SKILL.md:183,951-971) explain the pin by pointing to "most repositories' own PR commit-count gate". That still works for target repos, but it no longer describes this repo's CI.

[DESIGN-REVIEWED] 5f1b4e3

Description read

[DESCRIPTION-READ] 77e1f4457ddb4573379243a340cb9b0415550733f1f3f2f96efed77674308a52

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 5f1b4e333d02c800e4c55c6cdfedf6c4f4e3470f — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. The removed step's only job was counting branch commits, and with squash merge as the default that count never reaches main. Its bad base.sha count is the cited defect.

What this change ships

Inventory (8 items) — 8 justified

Intent: authors stop getting a red required check, or a push to rebase and force-push, because of their branch's commit count. This is a FIX.

  1. PR Hygiene no longer fails a PR with more than two commits, or with zero — justified
  2. PR Hygiene's rebase/squash remedy text and its push_guard.py hint are no longer printed — justified
  3. The PR template checklist drops the two-commit limit and the warning against Update branch — justified
  4. CONTRIBUTING now says Update branch, a merge or a rebase all work, and review feedback may come as new commits — justified
  5. AGENTS.md, ci-and-reviews.md, prepare-pr SKILL.md and ci.md no longer state the limit — justified
  6. One RFC line and two .kiro/specs design notes drop the limit — justified
  7. The tests that ran or read the removed step and its remedy text are deleted (declared in Reader lines) — justified
  8. A PR merged with a merge commit can now bring more than two commits into main (declared) — justified

[FIRST-PRINCIPLES-REVIEWED] 5f1b4e3

Description read

[DESCRIPTION-READ] 49dbe541db08c39796a726e02e0e5d606733241aa918bb1301dfbd72d073f7a2

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 5f1b4e333d02c800e4c55c6cdfedf6c4f4e3470f and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5f1b4e3

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5f1b4e333d02c800e4c55c6cdfedf6c4f4e3470f false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 5f1b4e333d02c800e4c55c6cdfedf6c4f4e3470f — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 5f1b4e3

Verdict parsed from the review's SHA-scoped output markers for commit 5f1b4e333d02c800e4c55c6cdfedf6c4f4e3470f.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5f1b4e333d02c800e4c55c6cdfedf6c4f4e3470f false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 18, 2026
…/drop-commit-count

# Conflicts:
#	CONTRIBUTING.md
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 18, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates a 6% chance that this change introduces a defect, within the 12% limit for approving on its own, but it is held at tier 2: reviewer-lanes-untrusted.

This PR removes the "Enforce commit count" step and its MAX_COMMITS setting from PR Hygiene. It also updates the docs, the PR template and the tests that ran or read that step. Nothing else in the workflows or scripts read the step: I found no other use of MAX_COMMITS, the step name, or the remedy text. PR Readiness only looks at the job's overall result. The diff-base step and the fetch-depth: 2 checkout are kept, and the reader-list, Proof line and Sibling sweep steps still use them. The tests left in test_code_review_history_fetch.py still cover the git reads that remain, and the annotation checks in test_pr_hygiene_guidance.py still cover the steps that can fail. The change only takes away a failure path. It does not touch any security boundary or stored data, and the PR states openly that merge-commit merges can now bring more than two commits into main. Deleting the tests for a step that no longer exists is fine, and the repository's test rules don't call for a new one. All CI checks and every AI review lane are green on this head.

Tier: 2, held for a person: reviewer-lanes-untrusted.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 5f1b4e333d · 354 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I reviewed head 5f1b4e3. It removes the PR Hygiene commit-count step and updates every doc and test that described or exercised it. Nothing in the repository reads the removed step, its env or its remedy text anymore. The diff-base step stays, and the other hygiene steps that depend on it are unchanged. The changed test files and the other suites that read the hygiene workflow, the PR template and CONTRIBUTING.md all pass on this head, and I found no code error or vacuous test.

@bolichen97
bolichen97 merged commit ad42cda into main Nov 18, 2026
107 of 117 checks passed
@bolichen97
bolichen97 deleted the crew/LinuxFlackyGuard/drop-commit-count branch November 18, 2026 18:55
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 18, 2026
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.

2 participants