Skip to content

refactor(git-hooks): consolidate hook path and remove ci/ validators - #222

Closed
ruby-automation wants to merge 1 commit into
mainfrom
EXT-30-consolidate-git-hooks
Closed

refactor(git-hooks): consolidate hook path and remove ci/ validators#222
ruby-automation wants to merge 1 commit into
mainfrom
EXT-30-consolidate-git-hooks

Conversation

@ruby-automation

Copy link
Copy Markdown
Contributor

Summary

  • Deletes ci/conventional_commits.sh and ci/validate_conventional_commit.sh — the validation logic now lives entirely in git-hooks/validate-commit-range and git-hooks/validate-conventional-subject (landed in EXT-29 / ci: harden Conventional Commit validators and Git test isolation #218)
  • Updates .github/workflows/ci.yaml to run ./git-hooks/validate-commit-range instead of the deleted script
  • Updates app/usage-rules.md to reference the new script path

The hook installer (mix git_hooks), the hook wrappers (git-hooks/commit-msg and git-hooks/pre-push), the shared validators, and all other documentation were already updated by EXT-29.

Closes EXT-30.

Test plan

  • mix test (root, 35 tests) — all pass
  • mix ci (full app quality gate, 405 tests) — all pass
  • mix format --check-formatted (root) — clean
  • No remaining active references to ci/conventional_commits.sh, ci/validate_conventional_commit.sh, or githooks/ outside historical plan/changelog files

🤖 Generated with Claude Code

Replace the two legacy ci/ validation scripts (conventional_commits.sh,
validate_conventional_commit.sh) with direct calls to their counterparts
under git-hooks/: git-hooks/validate-commit-range and
git-hooks/validate-conventional-subject.

- Delete ci/conventional_commits.sh and ci/validate_conventional_commit.sh
- Update .github/workflows/ci.yaml to run ./git-hooks/validate-commit-range
- Update app/usage-rules.md to reference git-hooks/validate-commit-range

The hook installer (mix git_hooks), the hook wrappers (git-hooks/commit-msg
and git-hooks/pre-push), the shared validators, and documentation were
already updated by EXT-29 (db08f0e / 044459e).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bougyman bougyman closed this Sep 5, 2026
@ruby-automation

Copy link
Copy Markdown
Contributor Author

Rework complete

This addresses the blocking architecture correction raised in review.

What changed:

  • ci/validate_conventional_subject.sh — canonical subject validator (was git-hooks/validate-conventional-subject)
  • ci/validate_pull_request_title.sh — canonical PR title guard (was git-hooks/validate-pull-request-title)
  • ci/validate_commit_range.sh — canonical commit-range checker (was git-hooks/validate-commit-range)
  • ci/validate_push_refs.shnew canonical pre-push check; implements Git's pre-push stdin protocol (<local-ref> <local-sha> <remote-ref> <remote-sha> per line), handles deletions (skip), new branches (merge-base with origin/main/main), and existing branches (remote SHA as base); preserves the GitHub Update-branch merge exception

git-hooks/ now contains only the two lifecycle adapters:

  • git-hooks/commit-msgexec "$repo_top/ci/validate_conventional_subject.sh" "$1"
  • git-hooks/pre-pushexec "$repo_top/ci/validate_push_refs.sh" "$@"

mix precommit and .github/workflows/ci.yaml call ci/ scripts directly.

Tests updated:

  • @subject_guard, @title_guard, @range_guard now point to ci/*.sh
  • Added @push_refs_guard with four new tests (empty stdin, deletion skip, valid range, invalid range, new-branch mode)
  • setup_hooks_worktree!setup_ci_worktree! — creates ci/ in the test worktree
  • Added structural assertion: git-hooks/ contains exactly ["commit-msg", "pre-push"]
  • precommit_test.exs expects ./ci/validate_pull_request_title.sh and ./ci/validate_commit_range.sh

All 27 tests pass; formatting clean.

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