Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(tooling): retain the main checkout deployment test gate

longmeidaoe4b96c6dc7da
diff --git a/.claude/skills/peach-worktree/SKILL.md b/.claude/skills/peach-worktree/SKILL.md
index 07da5bc9c..02ddf221c 100644
--- a/.claude/skills/peach-worktree/SKILL.md
+++ b/.claude/skills/peach-worktree/SKILL.md
@@ -22,6 +22,7 @@ description: 在用户说并行、工作树、暂存、提交、ready、集成
两者契约相同:从 Git common directory 定位主项目 venv,强制 `PYTHONPATH=<当前工作树>/src`,
核对 `peach.__file__` 后运行标准库 `unittest`。禁止手工拼接 venv 路径或调用 pytest。
测试入口固定 `PYTHONIOENCODING=utf-8`,覆盖标准输出、错误输出及子进程;其他 Python CLI 使用 `-X utf8`。
+ 主检出无参调用保留全量门槛,覆盖托盘部署调用;开发任务在隔离工作树使用自动选测。
PowerShell 读 UTF-8 日志显式加 `-Encoding utf8`;编码在输出端固定,不能只给读取端指定编码。
记录绑定完整代码内容、依赖环境和范围,24 小时有效;失败、验证期间改动使记录无效。
有同环境全量基线时,`auto` 对比文件清单,只补跑新增差异的影响域;共享设施或未知文件仍跑全量。
diff --git a/scripts/test.ps1 b/scripts/test.ps1
index e03d67ee2..52cbaa212 100644
--- a/scripts/test.ps1
+++ b/scripts/test.ps1
@@ -19,6 +19,9 @@ if ([IO.Path]::IsPathRooted($GitCommonRaw)) {
}
$MainRoot = Split-Path -Parent $GitCommon
+if (-not $PSBoundParameters.ContainsKey('Scope') -and $WorktreeRoot -eq $MainRoot) {
+ $Scope = 'full'
+}
$Python = Join-Path $MainRoot '.venv\Scripts\python.exe'
if (-not (Test-Path -LiteralPath $Python -PathType Leaf)) {
throw "Peach 主项目 venv 不存在:$Python"
diff --git a/scripts/test.sh b/scripts/test.sh
index dd856e2f7..798c93db4 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -53,4 +53,7 @@ if [[ "$LOADED_MODULE" != "$SOURCE_ROOT/"* ]]; then
fi
echo "Peach source: $LOADED_MODULE"
+if [[ $# -eq 0 && "$WORKTREE_ROOT" = "$(dirname "$GIT_COMMON")" ]]; then
+ SCOPE=full
+fi
exec "$PYTHON" scripts/test_runner.py --scope "$SCOPE" "${EXTRA[@]}"
diff --git a/tests/test_scripts.py b/tests/test_scripts.py
index a6b5e86cd..3fa160420 100644
--- a/tests/test_scripts.py
+++ b/tests/test_scripts.py
@@ -242,6 +242,7 @@ class OperationalScriptTests(unittest.TestCase):
self.assertIn("$env:PYTHONPATH = $SourceRoot", windows)
self.assertIn("$env:PYTHONIOENCODING = 'utf-8'", windows)
self.assertIn("$env:PYTHONIOENCODING = $PreviousPythonIoEncoding", windows)
+ self.assertIn("-not $PSBoundParameters.ContainsKey('Scope') -and $WorktreeRoot -eq $MainRoot", windows)
self.assertIn("peach.__file__", windows)
self.assertIn("scripts\\test_runner.py --scope $Scope", windows)
self.assertIn("ValidateSet('full', 'auto', 'follow'", windows)
@@ -251,6 +252,7 @@ class OperationalScriptTests(unittest.TestCase):
self.assertIn("rev-parse --git-common-dir", posix)
self.assertIn('export PYTHONPATH="$SOURCE_ROOT"', posix)
self.assertIn("export PYTHONIOENCODING=utf-8", posix)
+ self.assertIn('[[ $# -eq 0 && "$WORKTREE_ROOT" = "$(dirname "$GIT_COMMON")" ]]', posix)
self.assertIn("peach.__file__", posix)
self.assertIn('scripts/test_runner.py --scope "$SCOPE"', posix)
self.assertIn('SCOPE="${1:-auto}"', posix)