Peach: Local-first video metadata scraper and media manager.
fix(test): 按功能域验证新增和删除文件
longmeidaoee55c5f93adb
diff --git a/docs/TESTING.md b/docs/TESTING.mdindex 5e10d0dca..8848eefe0 100644--- a/docs/TESTING.md+++ b/docs/TESTING.md@@ -194,6 +194,8 @@ macOS Release 使用 `macos-15`(Apple Silicon)和 `macos-15-intel`(Intel选测比较文件内容:Python 只有注释或格式变化、npm 清单只有 description/keywords 变化、TOML 只有注释或格式变化时选 `checks`。Python docstring、运行时字串和类型注释属于有效内容。Python 构建元数据变化选 `packaging`,实际依赖变化、文件模式变化、解析失败和未知影响面保留完整验证。+新增、删除文件按所属功能域选测;已有文件的执行权限变化和符号链接保持 `full`。+完整批次通过但运行中发生局部改动时,保留未受影响测试文件的结果和原时间;退出 `4`,随后 `auto` 只补缺少的域。只有同一完整批次覆盖所有测试文件才恢复 `full`,局部批次不能拼成全量证明。环境、共享逻辑或未知范围变化清空保留结果;失败和过期结果不能复用。测试记录格式升级时,主检出的入口可能无法识别新格式。先在工作树通过 `ready`,再由主检出调用该工作树中已验收的 `scripts/agent_worktree.py`,用 `--repo` 指定主检出并执行 `integrate`。该方式仍检查测试记录、README 声明、目标分支和集成锁;不要手工改写记录或跳过门槛。集成后主检出使用同一版本的入口。diff --git a/scripts/test_runner.py b/scripts/test_runner.pyindex 6c74f2f84..befbd05a2 100644--- a/scripts/test_runner.py+++ b/scripts/test_runner.py@@ -413,7 +413,8 @@ def changed_contents(root: Path, base: str, paths: Iterable[str]) -> dict:continuetry:raw = test_evidence.git(root, "diff", "--raw", base, "--", path)- if raw and len(raw.split()) >= 2 and raw.split()[0].lstrip(":") != raw.split()[1]:+ modes = [part.lstrip(":") for part in raw.split()[:2]]+ if "120000" in modes or (len(modes) == 2 and "000000" not in modes and modes[0] != modes[1]):result[path] = (None, None)continueresult[path] = (test_evidence.git(root, "show", f"{base}:{path}"),diff --git a/tests/test_test_evidence.py b/tests/test_test_evidence.pyindex 9e2c0a810..984a47493 100644--- a/tests/test_test_evidence.py+++ b/tests/test_test_evidence.py@@ -148,6 +148,34 @@ class VerificationTests(unittest.TestCase):self.assertEqual(kinds["README.md"], "unsafe")self.assertEqual(runner.scopes_for_changes(paths, kinds=kinds)[0], ("full",))+ def test_known_file_addition_and_deletion_follow_their_domain(self):+ name = "src/peach/web_follow.py"+ path = self.repo / name+ path.write_text("value = 1\n", encoding="utf-8")+ self.git("add", "--", name)+ contents = runner.changed_contents(self.repo, "HEAD", [name])+ self.assertEqual(runner.scopes_for_changes([name], contents=contents)[0], ("follow",))+ self.git("commit", "-m", "test: fixture")+ path.unlink()+ contents = runner.changed_contents(self.repo, "HEAD", [name])+ self.assertEqual(runner.scopes_for_changes([name], contents=contents)[0], ("follow",))++ def test_known_python_file_execute_mode_requires_full(self):+ name = "src/peach/web_follow.py"+ (self.repo / name).write_text("value = 1\n", encoding="utf-8")+ self.git("add", "--", name)+ self.git("commit", "-m", "test: fixture")+ self.git("update-index", "--chmod=+x", name)+ contents = runner.changed_contents(self.repo, "HEAD", [name])+ self.assertEqual(runner.scopes_for_changes([name], contents=contents)[0], ("full",))++ def test_python_symlinks_require_full_for_each_change_kind(self):+ name = "src/peach/web_follow.py"+ for modes in (":000000 120000", ":120000 120000", ":120000 000000"):+ with self.subTest(modes=modes), mock.patch.object(evidence, "git", return_value=modes):+ contents = runner.changed_contents(self.repo, "HEAD", [name])+ self.assertEqual(runner.scopes_for_changes([name], contents=contents)[0], ("full",))+def test_repeated_import_path_preserves_dependency_identity(self):site = self.root / "site"metadata = site / "peach_evidence_probe-1.0.dist-info" / "METADATA"