Migrate commit validator to Rust#48
Draft
sebastien-boulle wants to merge 22 commits into
Draft
Conversation
sebastien-boulle
force-pushed
the
feat/rust-migration
branch
from
July 3, 2026 06:13
0261d90 to
f8ae410
Compare
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
Migrates the commit-message validator from bash to a single Rust binary (
commit-message-validator), as designed indocs/superpowers/specs/2026-07-03-rust-migration-design.md.Behavior-compatible port: identical validation rules and exit codes (Structure=1 … Revert=10), same env var names (
COMMIT_VALIDATOR_*,GLOBAL_*) with empty/unset → off/default, same defaults (header 100, body 100, jira typesfeat fix). The.batssuites were ported to Rust as the golden reference.Architecture
config,error,patterns,parser(state machine),validate(rules),preprocess.clapCLI (main.rs) with two subcommands:commit-message-validator message <FILE>— commit-msg hook (replacescheck_message.sh)commit-message-validator range <REV_RANGE>— CI / pre-push (replacescheck.sh)Distribution
.github/workflows/ci.yml): fmt + clippy-D warnings+ test +cargo llvm-cov(hard-fails < 90%; currently 97.82%)..github/workflows/release.yml): onv*tags, builds static binaries for{x86_64,aarch64}-{unknown-linux-musl,apple-darwin}and attaches them to the release.action.yml): downloads the matching prebuilt binary and runsrange.hooks/commit-message-validatorshim downloads/caches the binary..batstests removed; README updated.Testing
74 tests (unit +
assert_cmdCLI integration against temp git repos). Built strictly TDD; each commit is atomic and independently green.Review process
Built via subagent-driven development: a fresh implementer + spec/quality reviewer per task, plus a final whole-branch review. The final review confirmed behavioral equivalence with the bash original (and noted it even fixes two latent bash bugs: cross-commit global state leakage in ranges, and
NO_REVERT_SHA1aborting the whole range). Two cross-cutting bugs it found were fixed inb2e3616(preprocess trailing-newline rejection of normal commit-msg files; download shim defaulting to a nonexistentmasterrelease).Known follow-ups (draft — not blocking review, flagging for decision)
v2.xrelease with the Rust binary assets before switching consumers over — the pre-commit/pre-push/Action integrations need published assets to work end-to-end (CI validates the code meanwhile). The shim now defaults toreleases/latest.SHA256SUMS.messagepath now honors ambient env vars (bashcheck_message.shexplicitlyunsetthem). Intentional per the unified flag/env design; called out in case local-shell env should be ignored for local commits.See
docs/superpowers/plans/2026-07-03-rust-migration.mdfor the full implementation plan.