Skip to content

Pre-publish check uses the repo's one set of change-type rules - #534

Open
EdbertChan wants to merge 1 commit into
mainfrom
stack/EdbertChan/EdbertChan/preflight-real-unit-rules/make-pr-preflight-read-review-unit-rules-instead--4dc0ae8c
Open

Pre-publish check uses the repo's one set of change-type rules#534
EdbertChan wants to merge 1 commit into
mainfrom
stack/EdbertChan/EdbertChan/preflight-real-unit-rules/make-pr-preflight-read-review-unit-rules-instead--4dc0ae8c

Conversation

@EdbertChan

@EdbertChan EdbertChan commented Sep 13, 2026

Copy link
Copy Markdown
Owner

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

Test Plan

Test Plan

Fail-before: new tests added, preflight unchanged.

FAIL: test_docs_other_than_the_inventory_are_their_own_unit
FAIL: test_fails_a_hook_that_also_edits_the_root_readme_and_names_the_split
AssertionError: 0 != 1 : unit    engine-runtime: 3 file(s)
FAIL: test_unreadable_unit_rules_fail_as_unchecked_not_pass
AssertionError: 0 != 1 : unit    product-skill: 2 file(s)
Ran 24 tests in 0.343s
FAILED (failures=3)

Pass-after:

Ran 24 tests in 2.500s
OK

Real path: old preflight on PR #506's commit passed it:

neutral 3 file(s): README.md, docs/ecosystem.md, tests/test_install.py
declare Review Unit: engine-runtime
ok      preflight passed
preflight exit=0

New preflight on the same files:

unit    docs: 1 file(s)
unit    engine-runtime: 9 file(s)
neutral 2 file(s): docs/ecosystem.md, tests/test_install.py
fail    more than one review unit in one PR; validate-pr-body.mjs rejects every declared unit. One PR per unit:
split     docs: README.md
fail    preflight: fix the above before gh pr create
preflight(506) exit=1

Other gates on this branch:

ok      ecosystem boundaries
ok      skill file refs
ok      no new comments
ok      codify-has-code
ok      preflight passed

Parity with the PR body checker's own rules, every tracked path:

compared 848 paths, 0 differ

Run exactly as the pre-push hook runs it (temp copy, inside a real repo), on PR #506's original files:

=== OLD preflight (origin/main), run as a temp copy like the push guard
ok      preflight passed
exit=0
=== NEW preflight, run as a temp copy like the push guard
split     docs: README.md
exit=1
=== NEW preflight, temp copy, on #506 after the split (commit 6697642)
ok      preflight passed
exit=0

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:

suite exit=0
0 FAIL/ERROR lines
  • bash scripts/run_all_tests.sh
  • python3 -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
  • Safe to revert? Yes
  • Revert command: git revert <sha>
  • Post-revert steps: None. Preflight goes back to its own copy of the rules and passes docs mixes again.
  • Data migration? No

🤖 Generated with Claude Code

https://claude.ai/code/session_014uqkMWYjsKGenUSA1CqBVv

@EdbertChan EdbertChan changed the title make-pr preflight: read the review-unit rules instead of a copy Pre-publish check uses the repo's one set of change-type rules Sep 13, 2026
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@mergify

mergify Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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 EdbertChan changed the title Pre-publish check uses the repo's one set of change-type rules make-pr preflight: read the review-unit rules instead of a copy Sep 13, 2026
@EdbertChan
EdbertChan force-pushed the stack/EdbertChan/EdbertChan/preflight-real-unit-rules/make-pr-preflight-read-review-unit-rules-instead--4dc0ae8c branch from e798753 to 9261699 Compare September 13, 2026 06:41
@EdbertChan

Copy link
Copy Markdown
Owner Author

Revision history

# Type Changes Reason Date
1 initial e798753 2026-09-13 06:41 UTC
2 content e798753 → 9261699 (raw) 2026-09-13 06:41 UTC

@EdbertChan EdbertChan changed the title make-pr preflight: read the review-unit rules instead of a copy Pre-publish check uses the repo's one set of change-type rules Sep 13, 2026
@cursor

cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@EdbertChan

Copy link
Copy Markdown
Owner Author

Mergify repair stopped: GitHub reports merge conflict. The retry cap was reached for current head 9261699.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant