feat(author-workflow): add fail-closed branch-identity proofs for commit/push (#177)
Adds author_proofs.py, the author-side counterpart of review_proofs.py (#173), turning the branch-drift incident from PR #176 into fail-closed gates: - verify_branch_for_commit: the current branch must equal the intended feature branch and may never be a protected branch (master, main, develop, development, dev); missing state fails closed. - detect_branch_drift: any branch or HEAD change between validation time and commit time — including an external branch switch in a shared worktree, which is treated as an expected event to detect — blocks the commit until reconciled. - verify_push_target: a push requires the local branch, remote target branch, and intended issue branch to all match, none protected. - assess_protected_branch_commit: an accidental protected-branch commit must never be pushed, requires repair, and the repair must be reported; pushing the accident or silently continuing is a violation. - build_commit_push_report: final-report block carrying the branch proof before commit and before push; any failed proof, drift, or violation makes the status blocked. tests/test_author_proofs.py (27 tests) covers the issue's harness assertions: commit on master blocked; drift between validation and commit blocked; push target mismatch blocked; shared-worktree branch switch detected; repair path cannot silently continue without reporting. SKILL.md section E and templates/start-issue.md now require recording the validation-time branch/HEAD, the branch proof before commit, the branch proof before push, and non-silent accident repair. No review/merge/ permission gate is weakened. Closes #177 Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -150,12 +150,33 @@ Worktree folder = branch with `/` replaced by `-`
|
||||
6. Implement the narrow scope only — no unrelated refactors or formatting churn.
|
||||
7. Add/update focused tests when behavior changes.
|
||||
8. Run the checks (tests, compile/lint, `git diff --check`, secret scan).
|
||||
9. Commit with an issue-linked message.
|
||||
10. Push the branch.
|
||||
11. Open a PR to `master`.
|
||||
12. **If you are the author, stop before review/merge.**
|
||||
13. **Normal issue work must not directly push to `master`.** PR content should be merged through the forge PR merge mechanism.
|
||||
14. Direct push to `master` is allowed only as a documented recovery exception. If used, the final report must include:
|
||||
Record the branch name and `HEAD` SHA at validation time — the drift
|
||||
check in step 9 compares against exactly this state.
|
||||
9. **Branch proof before commit (#177):** prove and state, immediately
|
||||
before staging/committing (`author_proofs.verify_branch_for_commit`,
|
||||
`author_proofs.detect_branch_drift`):
|
||||
- current branch (`git branch --show-current`) equals the intended
|
||||
feature branch from the issue claim
|
||||
- current branch is not `master`, `main`, `develop`, `development`, or
|
||||
`dev`
|
||||
- branch and `HEAD` have not changed since validation (step 8) — in a
|
||||
shared checkout another session may switch branches mid-session;
|
||||
treat that as expected and **stop before committing** when detected
|
||||
If any check fails, stop and reconcile; do not commit.
|
||||
10. Commit with an issue-linked message.
|
||||
11. **Branch proof before push (#177):** prove that the local branch, the
|
||||
push target branch, and the intended issue branch all match, and that
|
||||
none of them is a protected branch
|
||||
(`author_proofs.verify_push_target`). If a commit accidentally landed
|
||||
on a protected branch, do **not** push: report the accident and the
|
||||
exact repair steps (`author_proofs.assess_protected_branch_commit`) —
|
||||
never silently continue after a repair.
|
||||
12. Push the branch.
|
||||
13. Open a PR to `master`. The final report must include the branch proofs
|
||||
from steps 9 and 11 (`author_proofs.build_commit_push_report`).
|
||||
14. **If you are the author, stop before review/merge.**
|
||||
15. **Normal issue work must not directly push to `master`.** PR content should be merged through the forge PR merge mechanism.
|
||||
16. Direct push to `master` is allowed only as a documented recovery exception. If used, the final report must include:
|
||||
- why the PR merge path could not be used
|
||||
- exact commits pushed
|
||||
- PR metadata state
|
||||
|
||||
Reference in New Issue
Block a user