drop hive and agent response fields the frontend never reads
This commit is contained in:
parent
1875181d59
commit
a437f9ccd5
1 changed files with 347 additions and 598 deletions
|
|
@ -109,8 +109,6 @@ fn adaptive_bucket_secs(span_secs: i64) -> i64 {
|
|||
pub struct Snapshot {
|
||||
pub window: &'static str,
|
||||
pub bucket_seconds: i64,
|
||||
pub now: i64,
|
||||
pub from: i64,
|
||||
/// Total turns in the window.
|
||||
pub turn_count: u64,
|
||||
/// Time-bucketed trend series, oldest first. Always covers the
|
||||
|
|
@ -231,8 +229,6 @@ fn empty_snapshot(window: Window) -> Snapshot {
|
|||
Snapshot {
|
||||
window: window.label(),
|
||||
bucket_seconds: window.bucket_secs(),
|
||||
now,
|
||||
from,
|
||||
turn_count: 0,
|
||||
buckets,
|
||||
tool_breakdown: Vec::new(),
|
||||
|
|
@ -360,8 +356,6 @@ fn snapshot(path: &Path, window: Window) -> Result<Snapshot> {
|
|||
Ok(Snapshot {
|
||||
window: window.label(),
|
||||
bucket_seconds: bucket_secs,
|
||||
now,
|
||||
from,
|
||||
turn_count: acc.turn_count,
|
||||
buckets,
|
||||
tool_breakdown: top_n(acc.tool_totals, 10),
|
||||
|
|
@ -873,4 +867,32 @@ mod tests {
|
|||
Some("cargo")
|
||||
);
|
||||
}
|
||||
|
||||
/// `GET /api/stats` carries exactly the fields the stats page reads.
|
||||
#[test]
|
||||
fn the_stats_snapshot_serialises_exactly_its_read_fields() {
|
||||
let value = serde_json::to_value(empty_snapshot(Window::Hour)).unwrap();
|
||||
let mut keys: Vec<&str> = value
|
||||
.as_object()
|
||||
.unwrap()
|
||||
.keys()
|
||||
.map(String::as_str)
|
||||
.collect();
|
||||
keys.sort_unstable();
|
||||
assert_eq!(
|
||||
keys,
|
||||
[
|
||||
"bash_breakdown",
|
||||
"bucket_seconds",
|
||||
"buckets",
|
||||
"duration_summary",
|
||||
"models",
|
||||
"result_mix",
|
||||
"tool_breakdown",
|
||||
"turn_count",
|
||||
"wake_mix",
|
||||
"window",
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue