allow forces direct provider; provider_mode in telemetry; eval refuses mixed modes (closes #17)
This commit is contained in:
1 parent
374cf28aed
commit
2ff8abe7a3
8 files changed
+219
-10
No files matched your search
@@ -268,6 +268,23 @@ g.stdin.close()
|
||||
assert g.wait(timeout=5) == 0
|
||||
assert len((tmp / "g-audit.log").read_text().splitlines()) == 4
|
||||
|
||||
# O5 follow-up (#17): the generated guard config forces the direct provider, telemetry records the mode
|
||||
s = check(run("cfgseen", "sec", env=senv, body="CALL write a.txt"), "done")
|
||||
seen = git_show(s["branch"], "cfg-seen.txt")
|
||||
assert "claude_cli = false" in seen and "orch-guard" in seen, seen
|
||||
tel = tmp / "state/telemetry.jsonl"
|
||||
recs2 = [json.loads(l) for l in tel.read_text().splitlines() if l.strip()]
|
||||
assert [r["provider_mode"] for r in recs2 if r["task"] == "cfgseen"] == ["direct"], recs2[-3:]
|
||||
# mode comparison: files from different modes are refused
|
||||
fa, fb = tmp / "ma.jsonl", tmp / "mb.jsonl"
|
||||
base = next(r for r in recs2 if r["task"] == "ok")
|
||||
fa.write_text(json.dumps({**base, "provider_mode": "direct"}) + "\n")
|
||||
fb.write_text(json.dumps({**base, "provider_mode": "claude_cli"}) + "\n")
|
||||
cmp_ = subprocess.run([orch, "eval", str(fa), str(fb)], env=env, capture_output=True, text=True)
|
||||
assert cmp_.returncode == 1 and "NOT COMPARABLE" in cmp_.stdout, cmp_
|
||||
assert subprocess.run([orch, "eval", str(fa), str(fa)], env=env, capture_output=True, text=True).returncode == 0
|
||||
assert "mode" in subprocess.run([orch, "report", str(fb)], env=env, capture_output=True, text=True).stdout.splitlines()[0]
|
||||
|
||||
# warning for unrestricted profiles
|
||||
assert "no `allow` list" in run("warn", "p", body="WRITE").stderr
|
||||
|
||||
|
||||
Reference in new issue
Block a user