Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

test(testing): build test-scan suite payloads without MSYS path conversion

Đang mở Phù hợp với người mới
#6,390 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash, git, shell

Hướng nghiên cứu

Bắt đầu trong plugins/testing/hooks/test-scan.test.sh: tiền tố mỗi bộ dựng đường dẫn jq --arg (payload(), bash_payload(), diff_of(), và các lời gọi inline quanh các dòng 516, 522, 548, 607) theo từng lời gọi bằng MSYS_NO_PATHCONV=1 MSYS2_ARG_CONV_EXCL='*' như PR #6356 đã làm, không export các biến đó. Giữ nguyên oracle session-key 297a19f13bd5fbd8. Chạy bash plugins/testing/hooks/test-scan.test.sh trên Windows Git Bash với jq native; coi các mismatch .file/.repo còn lại tại các assertion đã liệt kê là follow-up nếu chúng vẫn thất bại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

good first issue needs-triage priority: low

Summary

On Windows Git Bash with a native jq.exe, plugins/testing/hooks/test-scan.test.sh builds its hook payloads by passing POSIX paths to jq through --arg, and MSYS rewrites those arguments to Windows form. The hook then hashes a converted transcript_path against an unconverted CLAUDE_PROJECT_DIR, so the project-key checks cannot match their literal. This is the same fixture defect #6266 fixed for the test-judge suites; PR #6356 added the per-call MSYS_NO_PATHCONV=1 MSYS2_ARG_CONV_EXCL='*' prefix there but did not touch test-scan.test.sh, which carries no such prefix anywhere.

This is a test-fixture defect. Live sessions are unaffected for the reasons #6266 gives: Claude Code supplies drive-letter paths, which MSYS leaves alone.

plugins/testing/skills/audit/scripts/cant-fail-scan.test.sh was checked and is not affected: its only jq call (:1734) reads a file operand, where conversion is wanted. A full local run on Windows Git Bash passed 1195 of 1195.

Steps to reproduce

  1. On Windows Git Bash where jq resolves to a native Windows binary, run bash plugins/testing/hooks/test-scan.test.sh.
  2. Look at the pkey: checks.

Not run this pass (see Evidence); the failure is derived from the code.

Expected

The pkey: checks pass, as they do on Linux: the record lands under sessions/297a19f13bd5fbd8/.

Actual (derived)

payload() passes TPATH=/nonexistent/transcripts/-proj/a.jsonl through --arg tp. MSYS converts it to a path under the Git install root (for example C:/Program Files/Git/nonexistent/transcripts/-proj/a.jsonl), while CLAUDE_PROJECT_DIR=/nonexistent/proj reaches the hook unconverted through the environment. testing::pkey hashes the mixed pair, so the key is not 297a19f13bd5fbd8 and the checks at :437, :439, :441 and :446 fail. :446 also passes PCWD=$P through --arg c, which is converted too.

Evidence (file:line, origin/main 9680bdaa1)

  • plugins/testing/hooks/test-scan.test.sh:135-141: payload() runs jq -cn --arg t ... --arg f "$2" ... --arg tp "$TPATH" --arg c "$PCWD" with no MSYS prefix.
  • test-scan.test.sh:434-446: P=/nonexistent/proj, TP=/nonexistent/transcripts/-proj; CLAUDE_PROJECT_DIR=$P is set as an environment prefix (not converted), TPATH and PCWD go through payload() (converted). Assertions expect /sessions/297a19f13bd5fbd8/.
  • plugins/testing/hooks/test-scan.sh:55-63 reads .cwd and .transcript_path raw from the payload, and :90 calls testing::pkey "${CLAUDE_PROJECT_DIR:-$pcwd}" "$tpath".
  • plugins/testing/hooks/scanner-run.sh:37-44: testing::pkey hashes $1 and the directory of $2 with no path-form normalization.
  • Other --arg path builders in the same file with no prefix: bash_payload() :474 (--arg tp, --arg c), diff_of() :481 (--arg f), and inline builders at :516, :522, :548, :607.
  • Likely second failure, inferred: :378-379 asserts .file == "$REPO/src/mixed.test.ts" and .repo == "$REPO" with $REPO under mktemp -d (a /c/... or /tmp/... path). The recorded .file comes from the converted payload path, and .repo from the git toplevel, which Git for Windows reports in C:/... form. The per-call prefix alone may not fix this one, because test-scan.sh:94 itself passes --arg file "$FILE" to native jq; PR #6356's Related section names the same hook-side follow-up for the judge hooks.
  • Precedent for the fix: PR #6356 (judge-test-helpers.sh, test-judge.test.sh, test-judge-start.test.sh), and lib/hook-utils.test.sh:393-399.
  • Not run: this suite was not executed on Windows this pass, so no failure count is measured. The mechanism rests on the code above and on the native jq.exe established in #6266.

Suggested fix

Prefix each jq call in test-scan.test.sh that passes a filesystem path through --arg into a payload (payload(), bash_payload(), diff_of(), and the inline builders at :516, :522, :548, :607) with MSYS_NO_PATHCONV=1 MSYS2_ARG_CONV_EXCL='*', per call, as PR #6356 did. Do not export either variable; the node exec-bash.mjs calls at :159 and :503 need conversion. Leave the 297a19f13bd5fbd8 literal as the independent oracle. Then run the suite on Windows Git Bash and handle any remaining .file/.repo path-form mismatches at :378-379, :544 and :610 separately.

Related: #6266, PR #6356, #6135.

Ngôn ngữ chính
Shell
Star
22
Fork
2
Merge trung bình
5 giờ 4 phút
Pull request đã merge (30 ngày)
825

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của melodic-software/claude-code-plugins

Tất cả issue của melodic-software/claude-code-plugins

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.