Workflow-step verifier test fixture breaks when the checkout path contains whitespace (4 failures on macOS)

未關閉 適合新手
#5,360 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@mehdikarimi55 已經在處理了。

開始於 2026年11月10日。

  • #5362 來自 @mehdikarimi55 —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
83/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
testing

研究方向

從 tests/test_workflow_step_submission.py 中的 test_fetch_keeps_malicious_text_in_one_argument_even_if_validation_is_bypassed 開始,接著將 fixture 與 tests/extensions/test_extension_agent_context.py 中的 _ensure_test_python_on_path() 或 tests/parity_helpers.py 中的 make_python3_path_shim() 比較。更新假的 curl fixture,使其能處理包含空白的直譯器路徑,同時保留其引數行為。當參數化測試從包含空白的 checkout 路徑執行並通過時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

triage-can-wait

Summary

tests/test_workflow_step_submission.py::test_fetch_keeps_malicious_text_in_one_argument_even_if_validation_is_bypassed fails 4 times (one per parametrized suffix) when the spec-kit checkout lives under a path containing whitespace, e.g. ~/Downloads/GitHub Contribution/spec-kit:

E   step_submission_verifier.Blocked: cannot download https://...: [Errno 2] No such file or directory: 'curl'

Root cause

The fixture writes its fake curl with a #!{sys.executable} shebang. On macOS the XNU kernel splits the shebang line on whitespace, so an interpreter path like /Users/me/Downloads/GitHub Contribution/spec-kit/.venv/bin/python is parsed as interpreter /Users/me/Downloads/GitHub with argument Contribution/... — execve fails with ENOENT and the test reports "No such file or directory: 'curl'".

GitHub CI never sees this (runner paths have no spaces), but any contributor cloning into a directory with a space in the name — common on desktop OSes — hits it. The repo already solves this exact problem elsewhere: _ensure_test_python_on_path() in tests/extensions/test_extension_agent_context.py and make_python3_path_shim() in tests/parity_helpers.py both route through #!/usr/bin/env sh with shlex.quoted interpreter paths.

Suggested fix

Apply the same established pattern in this fixture: write a #!/bin/sh wrapper that execs the quoted interpreter with -c and the quoted Python payload. With -c, sys.argv[1:] is exactly the argument list curl was invoked with, so the test's assertions (len(args) == 14, args[-1] == url) are unchanged.

Minimal repro of the kernel behavior (outside the test suite):

mkdir -p "/tmp/space test"
printf '#!/tmp/space test/python\nprint(1)\n' > /tmp/script
chmod +x /tmp/script
ln -s "$(command -v python3)" "/tmp/space test/python"
/tmp/script   # macOS: [Errno 2] No such file or directory

Observed on macOS 15 (Apple Silicon), Python 3.12.16, spec-kit main at 08252af.

AI disclosure

Issue filed after diagnosis performed with AI assistance: OpenCode running GLM 5.3 Flash (Z.ai), agent mode under human supervision by @mehdikarimi55; reproduction, root-cause analysis (macOS shebang splitting), and verification of the sh-wrapper fix.

主要語言
Python
星號
149k
分支
13.4k
平均合併
1 天 5 小時
30 天內合併 PR
223

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/spec-kit 的其他 Issue

查看 github/spec-kit 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。