Skip to content

omp-hooks.ts: CONVENTIONAL_RE rejects the type!(scope) breaking form and hides the subject #151

Closed

Description

@barbarum

The problem

A commit that uses the type!(scope): breaking form — refactor!(config): … — is hard-blocked:

BLOCKED: Commit message must follow Conventional Commits: <type>(<scope>): <subject>.

The same subject with the bang after the scope (refactor(config)!: …) passes.

Root cause

const CONVENTIONAL_RE =
  /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([^)]+\))?!?:\s.+/;

The !? sits after the optional scope, so only type(scope)!: / type!: match.

Strict Conventional Commits v1.0.0 does spell the breaking marker after the scope, so the regex is not wrong per spec — but type!(scope): is common enough (the repo where this surfaced has an all-type!(scope): history) that blocking it is a false positive.

Separately, the failure reason never echoes the subject, so the author cannot see what was rejected.

Proposed fix

Accept the bang on either side of the scope, and echo the subject.

-const CONVENTIONAL_RE =
-  /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([^)]+\))?!?:\s.+/;
+// Conventional Commits specifies `type(scope)!:`, but many repositories write
+// `type!(scope):`. Accept both; the leading type is what matters.
+const CONVENTIONAL_RE =
+  /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)!?(?:\([^)]+\))?!?:\s.+/;
-            reason:
-              "BLOCKED: Commit message must follow Conventional Commits: <type>(<scope>): <subject>.",
+            reason:
+              `BLOCKED: Commit subject '${msg.split("\n")[0]}' must follow Conventional Commits: <type>(<scope>): <subject>.`,

Test

  • refactor!(config): move the set → allowed after the fix.
  • refactor(config)!: move the set → still allowed.
  • refactor: move the set → still allowed.
  • A non-conventional subject → still blocked.

Environment: pi coding agent on macOS, [email protected]; code confirmed unchanged on main.

Activity

  1. danielvm-git commented on Oct 25, 2026

    @danielvm-git
    Owner

    @barbarum — Two sharp reports in one session. The type!(scope): case is subtle because the spec technically disallows it, yet enough real-world repos use it that blocking it is a false positive. The 'echo the subject' improvement was long overdue — authors should not have to guess what was rejected. Thank you for both the diagnosis and the clean diffs.

  2. github-actions commented on Oct 25, 2026

    @github-actions

    🎉 This issue has been resolved in version 2.88.11 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  3. added a commit that references this issue on Oct 28, 2026
    9e1b11a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions