src/go/tool-executor readOnlyTools diverged from the Python oracle in BOTH directions: - it wrongly ADDED run_command — a mutating tool the oracle routes through operator approval; the Go port would execute it read-only (the dangerous direction: approval bypass) - it MISSED 8 of the 12 oracle read-only tools (git_diff, git_log, repo_map, read_persona, query_memory, check_growth, diagnose_behavior, find_capability) Fixed to the exact 12-tool set, and pinned by a FROZEN truth battery (gen_tool_executor_auth_truth.py → truth_auth.json) asserting set equality both ways forever — the test's failure message says it plainly: THE APPROVAL BOUNDARY HAS DRIFTED. Per-wave routine held (gates bare, spine rebuilt, both snapshots shipped).
54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""gen_tool_executor_auth_truth.py — the tool-executor authority truth
|
|
(contract BUILDER-2026-10-07T19:10:38Z-cc6be2).
|
|
|
|
Freezes the LIVE READ_ONLY_TOOLS set + the prepare-tool routing verdicts
|
|
so CI asserts the Go set equals the Python set FOREVER. The run_command
|
|
wrong-add this battery pins was a security-adjacent divergence: a mutating
|
|
tool treated as read-only bypasses operator approval.
|
|
|
|
Usage: python3 scripts/gen_tool_executor_auth_truth.py (from repo root)
|
|
"""
|
|
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
REPO = Path(__file__).resolve().parent.parent
|
|
sys.path.insert(0, str(REPO / "src"))
|
|
sys.path.insert(0, str(REPO / "src" / "rune"))
|
|
|
|
import tool_executor as te # noqa: E402
|
|
|
|
|
|
def main():
|
|
cases = [
|
|
{
|
|
"fn": "read_only_tools", "name": "exact_set",
|
|
"input": {},
|
|
"expected": {"tools": sorted(te.READ_ONLY_TOOLS)},
|
|
},
|
|
{
|
|
"fn": "prepare_routing", "name": "run_command_requires_approval",
|
|
"input": {"tool": "run_command", "args": {"command": "ls -la"}},
|
|
"expected": {"read_only": "run_command" in te.READ_ONLY_TOOLS},
|
|
},
|
|
{
|
|
"fn": "prepare_routing", "name": "read_file_executes_now",
|
|
"input": {"tool": "read_file", "args": {"path": "/tmp"}},
|
|
"expected": {"read_only": "read_file" in te.READ_ONLY_TOOLS},
|
|
},
|
|
]
|
|
out = {
|
|
"oracle": "src/rune/tool_executor.py READ_ONLY_TOOLS + routing",
|
|
"generated": "2026-10-07",
|
|
"cases": cases,
|
|
}
|
|
target = REPO / "src/go/tool-executor" / "truth_auth.json"
|
|
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
|
|
print(f"wrote {target} ({len(cases)} cases)")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|