Align native CLI execution with approved T03 targets and authority
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a09cbb-87c6-7900-a145-4ce53ba9f1a6
This commit is contained in:
parent
09422db079
commit
25a7d71cf5
8 changed files with 90 additions and 8 deletions
|
|
@ -59,3 +59,26 @@ def test_openrouter_plan_exposes_all_limits_and_preserves_existing_custody():
|
|||
"token_ttl": "15m", "token_max_ttl": "30m", "token_num_uses": 8,
|
||||
"secret_id_ttl": "15m", "secret_id_num_uses": 1,
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("action", ["apply", "verify", "exec"])
|
||||
def test_cli_submits_the_exact_reviewed_openrouter_targets(action, tmp_path, monkeypatch):
|
||||
import json
|
||||
from secrets_engine import cli
|
||||
from secrets_engine.authorization import digest_material
|
||||
from secrets_engine.config import Config
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
entry = load_entry(root / "docs/proposals/openrouter-key-check.yaml")
|
||||
expected = json.loads((root / f"docs/evidence/2026-09-14-openrouter-final-{action}-request.json").read_text())
|
||||
class Observed(Exception):
|
||||
pass
|
||||
def observe(cfg, actual_entry, actual_action, decision, **kwargs):
|
||||
actual = build_action_request(actual_entry, actual_action,
|
||||
subject_id="secrets-engine", subject_type="service",
|
||||
purpose=actual_entry.approval["purpose"], **kwargs)
|
||||
assert digest_material(actual) == digest_material(expected)
|
||||
raise Observed
|
||||
monkeypatch.setattr(cli, "authorize_action", observe)
|
||||
with pytest.raises(Observed):
|
||||
cli._require_lane_approval(Config.load(), entry, action,
|
||||
fields=() if action == "apply" else tuple(entry.fields))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue