Pre-publish check uses the repo's one set of change-type rules - #534
Open
EdbertChan wants to merge 1 commit into
Conversation
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_077ba8b6-04a6-4d7a-81f2-1e0e46088afc) |
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
preflight.py kept its own hand-copied version of drafter.config.json's path rules, and the copy drifted: it counted every file outside engine/, scripts/, .github/ and the skill folders as neutral. PR #506 mixed a hook with a root README.md row; preflight passed it while validate-pr-body.mjs rejected it as engine-runtime mixed with docs. preflight now reads drafter.config.json and matches its path globs in Python, so it stays one standalone file that the pre-push hook can run as a temp copy. With no config beside the script it reads origin/main's copy. A test compares its answer with drafter-core's for every tracked path. Rules that cannot be read exit 3 as unchecked, never a pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014uqkMWYjsKGenUSA1CqBVv Change-Id: I4dc0ae8c981e7025ee6cbe37fca579ec9dee7b6d
EdbertChan
force-pushed
the
stack/EdbertChan/EdbertChan/preflight-real-unit-rules/make-pr-preflight-read-review-unit-rules-instead--4dc0ae8c
branch
from
September 13, 2026 06:41
e798753 to
9261699
Compare
Owner
Author
Revision history
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_096877f3-af6f-4fb0-8e71-b6b58e1254c6) |
Owner
Author
|
Mergify repair stopped: GitHub reports merge conflict. The retry cap was reached for current head 9261699. |
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.
Summary
Before a PR goes out, a check makes sure it holds one kind of change, like hook code or docs, not a mix.
Two checks do this, and they disagreed. The PR text checker failed a PR that mixed hook code with the main readme. The earlier check passed it.
The earlier check kept its own copy of the rules, and the copy had drifted. It treated every readme and doc as harmless.
Now it reads the same rules file as the PR text checker. If it cannot read the rules, it fails instead of passing.
Review Claim
Approve the pre-publish check using the repo's one set of change-type rules, so it catches the same mixes the PR text checker rejects.
Review Lane
behavior
Review Unit
engine-runtime
Safety Invariant
The check can only get stricter where the old copy was wrong: docs other than the inventory row now count as their own unit, exactly as the PR text checker already enforced. When the rules cannot be read, it exits 3 and says "unchecked review units"; the pre-push hook then refuses the push as unchecked. It stays one standalone file, so the pre-push hook can still run it as a temp copy; with no rules file beside it, it reads origin/main's copy.
Slice Rationale
The rule change, its tests, the test repos that now need the rules file, the skill line that described the old rule, and the boundary check's exemption marker all move together. Splitting them would leave the skill text or the boundary check describing code that no longer exists.
Non-goals
drafter.config.jsonis untouched.Test Plan
Test Plan
Fail-before: new tests added, preflight unchanged.
Pass-after:
Real path: old preflight on PR #506's commit passed it:
New preflight on the same files:
Other gates on this branch:
Parity with the PR body checker's own rules, every tracked path:
Run exactly as the pre-push hook runs it (temp copy, inside a real repo), on PR #506's original files:
First design (a node helper beside the script) broke 4 pre-push hook tests in CI because the hook runs a temp copy; replaced with the standalone Python rules above. A full local run then caught 2 more fixture gaps, now fixed.
Full suite, rebased on origin/main:
bash scripts/run_all_tests.shpython3 -m unittest tests.test_pre_push_hook tests.test_git_template_hook(28 tests OK)python3 -m unittest tests.test_validate_pr_body_local(5 tests OK)Revert Plan
Revert Plan
git revert <sha>🤖 Generated with Claude Code
https://claude.ai/code/session_014uqkMWYjsKGenUSA1CqBVv