Open-source skills for designing and reviewing software with AI agents
Python agent-skillsai-agentsantigravityclaude-codeclaude-code-pluginclaude-skillscodexcodex-plugincoding-agentscontext-engineeringdeveloper-toolsgeminillmmulti-agentprompt-engineeringspec-driven-development
fix(tests): preserve native probe checks after rebase
Oliver16b0c0e85818
diff --git a/tests/integration/test_claude.py b/tests/integration/test_claude.pyindex 253694f..d61ef73 100644--- a/tests/integration/test_claude.py+++ b/tests/integration/test_claude.py@@ -25,12 +25,14 @@ def trace_directory(workspace: Path) -> Path:return config / "projects" / project-def assert_child_probe(raw: str, persona: Path, markers: list[str]) -> None:+def assert_child_probe(+ raw: str, persona: Path, markers: list[str], deny_persona: bool = False,+) -> None:"""Check the native child's answer, tool restrictions, and completed read."""assert all(marker not in raw for marker in markers)answers = []child_reads = []- successful = set()+ read_results = []for line in raw.split("\n"):if not line.strip():continue@@ -43,25 +45,30 @@ def assert_child_probe(raw: str, persona: Path, markers: list[str]) -> None:child_reads.append((block["id"], block["input"]["file_path"]))if block["type"] == "text":answers.append(block["text"])- if (event.get("type") == "user" and block["type"] == "tool_result"- and not block.get("is_error")):+ if event.get("type") == "user" and block["type"] == "tool_result":result = block.get("content", "")if isinstance(result, list):result = "".join(part["text"] for part in resultif part.get("type") == "text" and isinstance(part.get("text"), str))- if isinstance(result, str) and result.strip():- successful.add(block["tool_use_id"])- assert answers and answers[-1].strip() == "UNKNOWN"+ read_results.append((+ block["tool_use_id"], bool(block.get("is_error")),+ isinstance(result, str) and bool(result.strip()),+ ))+ # Preserve the native probe's allowance for an explanation before the sentinel.+ assert answers and answers[-1].strip().splitlines()[-1:] == [+ "RESOURCE_UNREADABLE" if deny_persona else "UNKNOWN"+ ]assert [path for _, path in child_reads] == [str(persona)]- assert all(call_id in successful for call_id, _ in child_reads), (- "Persona read has no successful native tool result"+ assert read_results == [(child_reads[0][0], deny_persona, True)], (+ "Persona read has no correlated native denial result" if deny_persona+ else "Persona read has no successful native tool result")@pytest.mark.parametrize("deny_persona", [False, True], ids=["scoped-read", "denied-persona"])-def test_native_reviewer_isolation(tmp_path: Path, deny_persona: bool) -> None:>>>>>>> f5b8b45 (Prepare runtime packages and permissions for plugin directories)+def test_native_reviewer_isolation(tmp_path: Path, deny_persona: bool) -> None:root = Path(__file__).resolve().parents[2]build = runpy.run_path(str(root / "scripts/pack_plugin.py"))["build"]plugin, _ = build(root, "claude", tmp_path / "runtime")@@ -137,28 +144,4 @@ Do not read other plugins or logs, use MCP, or modify files.children = list((traces / session / "subagents").glob("agent-*.jsonl"))assert len(children) == 1raw = children[0].read_text()- assert all(marker not in raw for marker in markers)- answers = []- child_reads = []- child_read_results = []- for line in raw.split("\n"):- if not line.strip():- continue- event = json.loads(line)- for block in event.get("message", {}).get("content", []):- if isinstance(block, dict) and block.get("type") == "tool_result":- child_read_results.append(bool(block.get("is_error")))- if event.get("type") == "assistant":- for block in event["message"]["content"]:- if block["type"] == "tool_use":- assert block["name"] == "Read"- child_reads.append(block["input"]["file_path"])- if block["type"] == "text":- answers.append(block["text"])- # Models may prefix the sentinel with an explanation. Tool results and the- # full child transcript independently establish access and marker isolation.- assert answers[-1].strip().splitlines()[-1] == (- "RESOURCE_UNREADABLE" if deny_persona else "UNKNOWN"- )- assert child_reads == [str(plugin / "agents/zoom_out.md")]- assert child_read_results == [deny_persona]>>>>>>> f5b8b45 (Prepare runtime packages and permissions for plugin directories)+ assert_child_probe(raw, plugin / "agents/zoom_out.md", markers, deny_persona)diff --git a/tests/unit/test_claude_traces.py b/tests/unit/test_claude_traces.pyindex 274e006..9b9e326 100644--- a/tests/unit/test_claude_traces.py+++ b/tests/unit/test_claude_traces.py@@ -108,3 +108,39 @@ def test_child_probe_keeps_unicode_inside_json_records(separator: str) -> None:check(raw, persona, ["parent-only-marker"])with pytest.raises(AssertionError):check(raw, persona, ["Persona"])++[email protected]("result", [+ "denied", "missing", "unrelated", "success", "empty", "duplicate",+ "wrong_sentinel", "extra_read",+])+def test_denied_persona_requires_correlated_error(result: str) -> None:+ check = runpy.run_path(str(ROOT / "tests/integration/test_claude.py"))[+ "assert_child_probe"+ ]+ persona = Path("/plugin/agents/zoom_out.md")+ read = {"type": "tool_use", "id": "persona", "name": "Read",+ "input": {"file_path": str(persona)}}+ events = [{"type": "assistant", "message": {"content": [read]}}]+ if result != "missing":+ response = {"type": "tool_result",+ "tool_use_id": "other" if result == "unrelated" else "persona",+ "is_error": result != "success",+ "content": [{"type": "text", "text": (+ "" if result == "empty" else "Permission denied"+ )}]}+ events.append({"type": "user", "message": {"content": [response]}})+ if result == "duplicate":+ events.append(events[-1])+ if result == "extra_read":+ events.append({"type": "assistant", "message": {"content": [read]}})+ events.append({"type": "assistant", "message": {"content": [{+ "type": "text", "text": "UNKNOWN" if result == "wrong_sentinel"+ else "Cannot read the persona.\nRESOURCE_UNREADABLE",+ }]}})+ raw = "\n".join(json.dumps(event) for event in events)+ if result == "denied":+ check(raw, persona, ["parent-only-marker"], deny_persona=True)+ else:+ with pytest.raises(AssertionError):+ check(raw, persona, ["parent-only-marker"], deny_persona=True)diff --git a/tests/unit/test_harnesses.py b/tests/unit/test_harnesses.pyindex 079dc58..e20e1a0 100644--- a/tests/unit/test_harnesses.py+++ b/tests/unit/test_harnesses.py@@ -181,7 +181,7 @@ def test_claude_permissions_remain_under_user_control() -> None:manifest = read_json(".claude-plugin/plugin.json")assert "hooks" not in manifestassert not (ROOT / ".claude-plugin/hooks/allow_plugin_reads.sh").exists()- assert not (ROOT / "hooks/hooks.json").exists()>>>>>>> f5b8b45 (Prepare runtime packages and permissions for plugin directories)+ assert not (ROOT / "hooks/hooks.json").exists()def test_claude_manifest_agents_and_shared_personas_resolve() -> None: