pub fn check_budget(
result: &ContextQueryResult,
query: &ContextQuery,
) -> (bool, String)Expand description
Validate a query result against the budget contract (SPEC.md §B1, §B3,
§B4). Returns (passed, evidence).
Three distinct promises, deliberately checked separately so a failure says which one broke:
- §B1 the declared costs sum within
max_tokens; - §B3 each declared cost equals the canonical count for its content — this is what turned the check from arithmetic into truth;
- §B4 the frame count respects
max_frames.