Skip git-written Merge, Revert and fixup subjects in the guardrails PreToolUse convention guard

Abierto Apto para principiantes
#20,538 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
bash, git, github
Área
devtools, testing

Línea de trabajo

Lee plugins/guardrails/hooks/block-convention-violation.sh en torno a la comprobación del formato de stdin y compara su lista de exclusión con plugins/guardrails/git-hooks/commit-msg-convention.sh. Añade cobertura de regresión en block-convention-violation.test.sh usando un patrón de fixture que excluya los asuntos de merge. El trabajo estará terminado cuando se acepte un asunto escrito por git, Merge main abc into feature, y se siga rechazando Mergers and acquisitions.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

needs-owner-decision

Part of #20534

Loosens the PreToolUse convention check slightly: needs the owner's yes.

Steps to reproduce

  1. In a repository whose subject_pattern does not itself allow Merge .+ (for example a ticket-key pattern), a subagent runs git -C $W merge --no-ff --no-commit <branch>.
  2. It commits with a heredoc: W=<repo>; git -C $W commit -F - <<'EOF' / Merge main abc into feature / EOF.

Expected behavior

The subject git itself writes for a merge, revert, fixup, squash or amend passes, as the installed commit-msg git hook already allows.

Actual behavior

block-convention-violation.sh refuses the subject. The -m retry passes, because the guard checks only the stdin form (((stdin_form)) || return 0, plugins/guardrails/hooks/block-convention-violation.sh:382).

Severity

Low

Severity justification

One refusal and a retry per merge commit written through a heredoc; nothing is lost.

Suggested fix location

block-convention-violation.sh:393-395: after [[ -n "$subj" ]] || return 0, return 0 for "fixup! "* | "squash! "* | "amend! "* | "Merge "* | 'Revert "'*, copied character for character from plugins/guardrails/git-hooks/commit-msg-convention.sh:64.

Evidence

  • Verified by reading origin/main (6f9409abe9): the skip list exists only in the git hook (commit-msg-convention.sh:64).
  • Not reproduced here: this repository's own pattern includes Merge .+|Revert ".+, so the probe passes in this repo; reproducing needs a fixture whose subject_pattern lacks them.
  • Root cause left open: sequencer_in_progress (:236, called at :384) misses because hook::git_effective_dir_to in hook-utils.sh does not expand -C $W, so the in-progress merge is not seen.
  • The item's author ran a sandbox copy with this patch: suite PASS=181 FAIL=0; the full Bash guard chain gave 0 on merge, revert and fixup subjects and 2 on junk subjects. Not re-run this pass.

Acceptance criteria

  • In a fixture repo with a pattern lacking Merge, a heredoc commit with subject Merge main abc into feature through W=<repo>; git -C $W with no MERGE_HEAD exits 0.
  • Mergers and acquisitions is still refused in that fixture.
  • block-convention-violation.test.sh pins both.

Constraints and gotchas

  • In a repo with a subject_pattern but no commit-msg hook installed, a non-merge -F heredoc commit starting with one of these prefixes would no longer be checked at PreToolUse.
  • Separate defect, not covered: the subject is taken from an earlier non-commit heredoc (see #20535 case 3).

Context

Source: local handoff item 20261201-165317 section 7 (retired into this issue).

Lenguaje dominante
Shell
Estrellas
22
Forks
2
Merge medio
1 h 54 min
PR fusionados (30 d)
938

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de melodic-software/claude-code-plugins

Todos los issues de melodic-software/claude-code-plugins

Issues similares

Más issues de Shell/Bash

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.