event-bus, model-routing, tool-executor, work-manager, rune-entry: core
code in internal/*, 15-26 line main.go shells preserving exact CLI
behavior. Batteries green through the shells; byte-identical CLI
matrices pre/post (24-case event-bus, 16-case tool-executor, 6-case
work-manager replay, 7-case routing parity, 8-case entry).
Fixes riding the wave: tool-executor duplicate pyListRepr symbol (broken
on HEAD since 07c08c34), work-manager repoRoot depth, CI run-pattern +
fuzz + generator path repointing.
Main-session verification: all five build + test green by own run;
-race clean on event-bus. model-routing has no Go test files — its
battery IS the binary's replay mode, verified through the shell.
54 lines
1.8 KiB
Python
54 lines
1.8 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/internal/toolexec" / "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()
|