{
 "schema": "cain42.governor.evolution.v1",
 "date": "2026-11-02",
 "engine_version_after": "governor-keystone-1.1.0",
 "blind_set": "scripts/governor/blind_2026_11_02.py (20 cases, written before any change that day)",
 "runs": [
  {
   "run": 1,
   "engine": "1.0.0",
   "held": "17/20",
   "note": "the reported blind result"
  },
  {
   "run": 2,
   "engine": "1.1.0",
   "held": "20/20",
   "note": "after the fixes; now a tuning set"
  }
 ],
 "held_on_1_0_0": [
  "30 concurrent charges: exactly 10 allowed, $10.00 of a $10.00 limit, no overspend",
  "parent limits across agents",
  "rate and loop breakers trip",
  "tripped agent stays halted",
  "forged, replayed, other-agent and other-type reset tokens refused",
  "-5, 0, NaN, Infinity, true, '100', null, 10^12 never charge",
  "0.1-cent charges cannot drift past the limit",
  "a cycle in the tree fails closed"
 ],
 "findings": [
  {
   "id": "GV-11-02-1",
   "what": "Re-defining a budget tree (a config reload) un-tripped a tripped breaker without any signed reset",
   "before": "ALLOW after re-define",
   "after": "breaker stays TRIPPED; only a CAIN-signed reset for that trip clears it"
  },
  {
   "id": "GV-11-02-2",
   "what": "Re-defining a budget tree zeroed what had been spent",
   "before": "spent reset to 0",
   "after": "spend kept; re-definition changes only limits and windows"
  },
  {
   "id": "GV-11-02-3",
   "what": "Loop detection dodged by changing the tool name's case or spacing (pay / Pay / PAY)",
   "before": "4 x ALLOW",
   "after": "trips on the 4th identical call"
  },
  {
   "id": "GV-11-02-4",
   "what": "A parent change that creates a cycle was accepted at define time (charges then failed closed)",
   "before": "accepted, then DENY",
   "after": "refused when defined"
  }
 ],
 "tests": {
  "file": "tests/test_governor_keystone.py",
  "before": 16,
  "after": 21,
  "with_approval": 40,
  "all_pass": true
 },
 "live": "the gateway imports keystone/governor.py: fixes live after the next deploy. On the live 1.0.0 server the loop demo's case variants do not trip.",
 "self_run": "our own runs; no independent test",
 "run1_rows": [
  {
   "name": "agent_limit_holds",
   "want": "refused",
   "outcome": "refused",
   "detail": "DENY",
   "pass": true
  },
  {
   "name": "parent_limit_holds_across_agents",
   "want": "refused",
   "outcome": "refused",
   "detail": "DENY",
   "pass": true
  },
  {
   "name": "race_no_overspend",
   "want": "refused",
   "outcome": "refused",
   "detail": "allowed=10 spent=1000.0",
   "pass": true
  },
  {
   "name": "rate_breaker_trips",
   "want": "refused",
   "outcome": "refused",
   "detail": "['ALLOW', 'ALLOW', 'ALLOW', 'TRIP']",
   "pass": true
  },
  {
   "name": "loop_breaker_trips",
   "want": "refused",
   "outcome": "refused",
   "detail": "['ALLOW', 'ALLOW', 'ALLOW', 'TRIP']",
   "pass": true
  },
  {
   "name": "loop_breaker_tool_case_variant",
   "want": "refused",
   "outcome": "accepted",
   "detail": "['ALLOW', 'ALLOW', 'ALLOW', 'ALLOW']",
   "pass": false
  },
  {
   "name": "tripped_stays_halted",
   "want": "refused",
   "outcome": "refused",
   "detail": "DENY",
   "pass": true
  },
  {
   "name": "redefine_does_not_untrip",
   "want": "refused",
   "outcome": "accepted",
   "detail": "after re-define: ALLOW",
   "pass": false
  },
  {
   "name": "redefine_does_not_zero_spend",
   "want": "refused",
   "outcome": "accepted",
   "detail": "after re-define: ALLOW",
   "pass": false
  },
  {
   "name": "reset_needs_cain_signature",
   "want": "refused",
   "outcome": "refused",
   "detail": "bad_reset",
   "pass": true
  },
  {
   "name": "reset_replay_refused",
   "want": "refused",
   "outcome": "refused",
   "detail": "bad_reset",
   "pass": true
  },
  {
   "name": "reset_for_other_agent_refused",
   "want": "refused",
   "outcome": "refused",
   "detail": "bad_reset",
   "pass": true
  },
  {
   "name": "other_signed_token_not_a_reset",
   "want": "refused",
   "outcome": "refused",
   "detail": "bad_reset",
   "pass": true
  },
  {
   "name": "bad_amounts_never_charge",
   "want": "refused",
   "outcome": "refused",
   "detail": "{'-5': 'DENY', '0': 'DENY', 'nan': 'DENY', 'inf': 'DENY', 'True': 'DENY', \"'100'\": 'DENY', 'None': 'DENY', '1000000000000': 'DENY'}",
   "pass": true
  },
  {
   "name": "tiny_amounts_cannot_exceed_limit",
   "want": "refused",
   "outcome": "refused",
   "detail": "allowed=10 spent=1.0",
   "pass": true
  },
  {
   "name": "workflow_cannot_charge_as_agent",
   "want": "refused",
   "outcome": "refused",
   "detail": "DENY",
   "pass": true
  },
  {
   "name": "unknown_agent_denied",
   "want": "refused",
   "outcome": "refused",
   "detail": "DENY",
   "pass": true
  },
  {
   "name": "cycle_in_tree_fails_closed",
   "want": "refused",
   "outcome": "refused",
   "detail": "define accepted; charge DENY",
   "pass": true
  },
  {
   "name": "trip_is_signed_in_ledger",
   "want": "ok",
   "outcome": "ok",
   "detail": "valid=True",
   "pass": true
  },
  {
   "name": "legit_spend_within_limits_allowed",
   "want": "ok",
   "outcome": "ok",
   "detail": "['ALLOW', 'ALLOW', 'ALLOW', 'ALLOW', 'ALLOW']",
   "pass": true
  }
 ]
}