Expand description
§tokmd-gate
Tier 3 (Policy Evaluation)
Policy evaluation engine for CI gating based on analysis receipts.
§What belongs here
- Policy rule types and parsing
- JSON Pointer resolution
- Rule evaluation logic
- Ratchet evaluation for trend tracking
§Example
use serde_json::json;
use tokmd_gate::{PolicyConfig, evaluate_policy};
let receipt = json!({"tokens": 42});
let policy = PolicyConfig::from_toml(r#"
[[rules]]
name = "check"
pointer = "/tokens"
op = "lte"
value = 1000
"#).unwrap();
let result = evaluate_policy(&receipt, &policy);
assert!(result.passed);Structs§
- Gate
Result - Result of evaluating the entire policy.
- Policy
Config - Root policy configuration.
- Policy
Rule - A single policy rule.
- Ratchet
Config - Configuration for ratchet rules.
- Ratchet
Gate Result - Overall result of ratchet evaluation.
- Ratchet
Result - Result of ratchet evaluation.
- Ratchet
Rule - Ratchet rule for gradual improvement.
- Rule
Result - Result of evaluating a single rule.
Enums§
- Gate
Error - Errors from policy evaluation.
- Rule
Level - Rule severity level.
- Rule
Operator - Comparison operators for rules.
Functions§
- evaluate_
policy - Evaluate a policy against a JSON receipt.
- evaluate_
ratchet_ policy - Evaluate all ratchet rules against baseline and current receipts.
- resolve_
pointer - Resolve a JSON Pointer against a JSON value.