ci: harden Conventional Commit validators and Git test isolation - #218
Merged
Conversation
Replace System.unique_integer/1 (which resets across BEAM VM restarts and can collide with stale /tmp directories from killed runs) with a :crypto.strong_rand_bytes/1 nonce in every Git-backed test helper: - app/test/linear_cli/cli/git_test.exs (already fixed in HEAD) - app/test/linear_cli/cli/issue_commands_test.exs - app/test/linear_cli/cli/profile_defaults_test.exs - test/git_hooks_test.exs - test/mix/tasks/stokowski_test.exs In each affected file, on_exit is now registered immediately after the directory is created (before any git command), so a setup failure can no longer leave a stale directory behind. Expand git_hooks_test.exs to cover the remaining acceptance criteria: - Subject guard: EXT-19 squash-title regression (PR #196) - Subject guard: commit message file with body/footer - Subject guard: comment lines above subject in file mode - Subject guard: empty subject string - PR title guard: missing PULL_REQUEST_TITLE when required - PR title guard: invalid PULL_REQUEST_TITLE_REQUIRED value - Range guard: empty commit range passes - Range guard: mixed valid/invalid commit range Refactor the range guard tests into a shared setup_hooks_worktree!/0 helper so each test gets a clean repo without duplicating setup code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bougyman
previously approved these changes
Sep 5, 2026
ci/validate_conventional_commit.sh and ci/conventional_commits.sh now exec into git-hooks/validate-conventional-subject and git-hooks/validate-commit-range respectively. This leaves one live implementation per check and lets callers that already reference the ci/ paths (e.g. the installed commit-msg hook) keep working without changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7 tasks
ruby-automation
added a commit
that referenced
this pull request
Sep 5, 2026
EXT-29 (PR #218) replaced the metadata-aware commit-range validator with a subject-only traversal, losing the exception for GitHub's trusted "Update branch" auto-merge commits. Restore it in validate-commit-range using a three-part predicate: a commit is skipped only when it has exactly two parents, the committer is GitHub <noreply@github.com>, and the subject matches `Merge branch '<base>' into <head>`. The git log format is expanded from `%s` to `%P%x01%cn%x01%ce%x01%s` (SOH-delimited) so parent hashes, committer name, and committer email are available in the loop alongside the subject. Add five new ExUnit tests covering the skip itself and each predicate variation (wrong name, wrong email, single parent, non-matching subject). Add documents/github-update-branch-validation-decision.adoc recording the rationale and alternatives considered. Refs: EXT-35 Co-authored-by: bougyman's bot <ruby-automation@users.noreply.github.com>
This was referenced Sep 5, 2026
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
git-hooks/validate-conventional-subject— a single authoritative implementation shared by thecommit-msghook, the newvalidate-pull-request-titleguard, and the range guard.git-hooks/validate-pull-request-title: fail-closed PR title guard driven byPULL_REQUEST_TITLE_REQUIREDenv var; any value other than"true"or"false"exits 1.git-hooks/validate-commit-range: replaces the oldci/conventional_commits.shlogic; resolvesorigin/<name>before local<name>; handles exact 40-char SHAs for GitHub push events.ci/validate_conventional_commit.shandci/conventional_commits.shto 4-line exec wrappers so existing CI callers keep working.mix precommittask (injectable shell) that runs the two new guards then the full app quality suite; updatesmix git_hooksto point atgit-hooks/and reject unexpected args.System.unique_integer(resets each BEAM restart) with:crypto.strong_rand_bytes(16)nonce; registerson_exitcleanup before any git command.test/git_hooks_test.exscovering subject guard, PR title guard, and range guard (including the PR#197 and PR#196 regression cases); addstest/mix/tasks/git_hooks_test.exsandtest/mix/tasks/precommit_test.exs.Test plan
mix cipasses end-to-end (405 app tests + 30 root tests, no credo issues, format clean)PULL_REQUEST_TITLE_REQUIRED=falseskipsgit-hooks/commit-msgandgit-hooks/pre-pushdelegate correctly to the new scriptsci/validate_conventional_commit.shandci/conventional_commits.shexec-wrap correctly (backward compat)Closes EXT-29
🤖 Generated with Claude Code