test(workbench): harden F-matrix evidence and demote Verified claim

Add dual-endpoint LLM isolation, usage revision replace, cancel/F08/F11
asserts, and mark the design status Partial until remaining F gaps close.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-10-25 11:01:02 +08:00
1 parent 03396afd02
commit 090b026547
6 files changed
+370 -29

No files matched your search

+4 -1
View File
@@ -22,4 +22,7 @@ pub use event_sink::{bind_event_sink, clear_event_sink, emit_event, emit_message
pub use locator::{resolve_reference, KnowledgeLocator};
pub use run_context::{cancel_requested, RunContext};
pub use selection::{parse_model_selection, ModelSelection};
pub use usage::{model_call_usage_from_provider, runtime_event, token_or_null};
pub use usage::{
model_call_usage_from_provider, model_call_usage_from_provider_rev, replace_usage_if_newer,
runtime_event, token_or_null,
};
+31 -1
View File
@@ -18,6 +18,19 @@ pub fn model_call_usage_from_provider(
selection: &Value,
provider_usage: &Value,
status: &str,
) -> Value {
model_call_usage_from_provider_rev(call_id, attempt_id, run_id, selection, provider_usage, status, 1)
}
/// Same as [`model_call_usage_from_provider`] with an explicit revision (F05).
pub fn model_call_usage_from_provider_rev(
call_id: &str,
attempt_id: &str,
run_id: &str,
selection: &Value,
provider_usage: &Value,
status: &str,
revision: u64,
) -> Value {
let has_usage = provider_usage.is_object();
let input = provider_usage
@@ -97,7 +110,7 @@ pub fn model_call_usage_from_provider(
"total_tokens": token_or_null(total),
"cached_input_tokens": token_or_null(cached),
"reasoning_output_tokens": token_or_null(reasoning),
"revision": 1,
"revision": revision.max(1),
"provider_request_id": provider_usage.get("provider_request_id").cloned().unwrap_or(Value::Null),
"diagnostics": diagnostics,
// Legacy fields kept but marked — apps must not treat token_cost as money.
@@ -110,6 +123,23 @@ pub fn model_call_usage_from_provider(
})
}
/// Replace prior usage for the same (call_id, attempt_id) when revision is newer (F05).
/// Returns the winning snapshot; does not sum cumulative stream counters.
pub fn replace_usage_if_newer(prior: &Value, next: &Value) -> Value {
let same_call = prior.get("call_id") == next.get("call_id")
&& prior.get("attempt_id") == next.get("attempt_id");
if !same_call {
return next.clone();
}
let pr = prior.get("revision").and_then(|v| v.as_u64()).unwrap_or(0);
let nr = next.get("revision").and_then(|v| v.as_u64()).unwrap_or(0);
if nr >= pr {
next.clone()
} else {
prior.clone()
}
}
/// RuntimeEventV1 envelope helper.
pub fn runtime_event(
event_id: &str,