Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

test(guardrails): 4 block-root-delete-target allowed-roots assertions fail on Windows Git Bash

Chiusa
#6,627 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
57/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
git, shell
Ambito
testing

Direzione di ricerca

Start with section 2d of plugins/guardrails/hooks/block-root-delete-target.test.sh and compare its allowed-roots fixtures with the Windows Git Bash path behavior described in the issue. Check how the test derives relative paths and handles / under MSYS; the issue also points to hook behavior as an open question. Done when the four assertions behave appropriately on Windows without breaking the existing Linux suite.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs-human needs-triage

Problem

On Windows Git Bash, four assertions in plugins/guardrails/hooks/block-root-delete-target.test.sh (section 2d, allowed roots) fail. They fail the same way on origin/main (a1a836827) as on the #6542 branch, so the suite cannot go fully green locally on Windows. CI is Linux, and the Windows lane does not run this suite.

Failing assertions and output

FAIL: allowed roots: a relative root grants nothing (direct): expected exit 2, got 0
FAIL: allowed roots: a relative root grants nothing (dispatched): expected exit 2, got 0
FAIL: allowed roots: the root '/' does not allow a top-level path (direct): expected exit 2, got 0
FAIL: allowed roots: the root '/' does not allow a top-level path (dispatched): expected exit 2, got 0

Root-cause hypotheses (test fixtures, not the hook)

  1. a relative root grants nothing passes "${RDT_AR#/}" as a "relative" entry. On Windows, RDT_TOP comes from git rev-parse --show-toplevel, which returns the drive form (D:/worktrees/...). #/ therefore strips nothing, and the entry is a valid absolute root that correctly allows $RDT_AR/child. The test does not build a relative entry on this host. Evidence: git rev-parse --show-toplevel printed D:/worktrees/melodic-software-claude-code-plugins-fix-6542-allowed-roots-prefix.
  2. the root '/' does not allow a top-level path lists / and expects rm -rf /opt/rdt-allowed-x/y to stay refused. Under MSYS, / is the Git install directory (cygpath -m / prints C:/Program Files/Git/). That is not a filesystem root, so rdt_root_like does not drop the entry, and /opt/... lies strictly under it, so the delete is allowed.

Suggested fix

  • Build the relative entry from a path that is certainly relative on every host, e.g. strip the drive or leading slash with a host-aware helper.
  • Skip or re-target the / case on MSYS, where / is not the volume root.
  • Decide whether the hook should also refuse an entry spelled / on Windows. It names the Git install directory, which is probably never what a user means.

Related: #6020. Found while working #6542 (PR #6624).

Lingua principale
Shell
Stelle
22
Fork
2
Merge medio
7h 57m
PR unite (30g)
938

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di melodic-software/claude-code-plugins

Tutte le issue di melodic-software/claude-code-plugins

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.