use super::*;
#[test]
fn detects_subagents_and_child_rows_from_activity() {
let mut state = MissionControlState::default();
let parent = ActivityId::new("call_parallel");
state
.transcript
.push_back("tool: ⟳ subagents • running".to_string());
state.transcript.link_activity(
0,
TranscriptActivityLink {
activity_id: parent.clone(),
tool_name: "subagents".to_string(),
},
);
state.apply_activity_event(ActivityEvent::Started {
id: parent.clone(),
parent_id: None,
kind: ActivityKind::SubagentBatch,
status: ActivityStatus::Running,
metadata: ActivityMetadata::new("subagents • 2 tasks"),
});
state.apply_activity_event(ActivityEvent::Started {
id: ActivityId::new("call_parallel/g1"),
parent_id: Some(parent.clone()),
kind: ActivityKind::SubagentTask,
status: ActivityStatus::Success,
metadata: ActivityMetadata::new("g1 identity rust-dev"),
});
let cards = project_cards(&state);
assert_eq!(cards[0].role, TranscriptCardRole::SubagentBatch);
assert_eq!(cards[0].children.len(), 1);
assert_eq!(cards[0].children[0].status, TranscriptCardStatus::Success);
}
#[test]
fn subagent_card_parses_intent_led_rows_and_aggregate_progress() {
let mut state = MissionControlState::default();
let parent = ActivityId::new("call_parallel");
state
.transcript
.push_back("tool: ⟳ subagents • running".to_string());
state.transcript.link_activity(
0,
TranscriptActivityLink {
activity_id: parent.clone(),
tool_name: "subagents".to_string(),
},
);
state.apply_activity_event(ActivityEvent::Started {
id: parent.clone(),
parent_id: None,
kind: ActivityKind::SubagentBatch,
status: ActivityStatus::Running,
metadata: ActivityMetadata {
label: "subagents • 3 tasks".to_string(),
detail: None,
fields: vec![("tasks".to_string(), "3".to_string())],
},
});
state.apply_activity_event(ActivityEvent::Started {
id: ActivityId::new("call_parallel/g1"),
parent_id: Some(parent.clone()),
kind: ActivityKind::SubagentTask,
status: ActivityStatus::Success,
metadata: ActivityMetadata {
label: "g1 • depth 2 • implement the subagent card".to_string(),
detail: None,
fields: vec![
("identity".to_string(), "rust-dev".to_string()),
("agent".to_string(), "card-builder".to_string()),
("provider".to_string(), "anthropic".to_string()),
("model".to_string(), "claude-sonnet".to_string()),
("reasoning".to_string(), "high".to_string()),
],
},
});
state.apply_activity_event(ActivityEvent::Started {
id: ActivityId::new("call_parallel/g2"),
parent_id: Some(parent.clone()),
kind: ActivityKind::SubagentTask,
status: ActivityStatus::Running,
metadata: ActivityMetadata {
label: "g2 • depth 2 • investigate theme colors".to_string(),
detail: None,
fields: vec![("identity".to_string(), "identity-only".to_string())],
},
});
state.apply_activity_event(ActivityEvent::Started {
id: ActivityId::new("call_parallel/g3"),
parent_id: Some(parent.clone()),
kind: ActivityKind::SubagentTask,
status: ActivityStatus::Failed,
metadata: ActivityMetadata {
label: "g3 • depth 2 • audit cache invalidation".to_string(),
detail: None,
fields: vec![
("provider".to_string(), "openai-codex".to_string()),
("model".to_string(), "gpt-5".to_string()),
],
},
});
state.apply_activity_event(ActivityEvent::Delta {
id: ActivityId::new("call_parallel/g3"),
preview: "provider timeout after 30s".to_string(),
});
let cards = project_cards(&state);
let card = &cards[0];
assert_eq!(card.children.len(), 3);
assert_eq!(card.children[0].task_id, "g1");
assert_eq!(card.children[0].intent, "implement the subagent card");
assert_eq!(card.children[0].identity.as_deref(), Some("rust-dev"));
assert_eq!(card.children[0].agent.as_deref(), Some("card-builder"));
assert_eq!(
card.children[0].model_line.as_deref(),
Some("anthropic/claude-sonnet(high)")
);
assert_eq!(card.children[1].task_id, "g2");
assert_eq!(card.children[1].intent, "investigate theme colors");
assert_eq!(card.children[1].identity.as_deref(), Some("identity-only"));
assert!(card.children[1].agent.is_none());
assert!(card.children[1].model_line.is_none());
assert_eq!(
card.children[2].model_line.as_deref(),
Some("openai-codex/gpt-5(default)")
);
let subagent_card = card.subagent_card.as_ref().expect("subagent card summary");
assert_eq!(subagent_card.total, 3);
assert_eq!(subagent_card.done, 1);
assert_eq!(subagent_card.failed, 1);
assert_eq!(subagent_card.running, 1);
let wide_lines = visual_lines(&state, CARD_LAYOUT_MIN_WIDTH);
let rendered = wide_lines
.iter()
.map(|line| line_text(&line.line))
.collect::<Vec<_>>()
.join("\n");
assert!(rendered.contains("Subagents"), "{rendered}");
assert!(rendered.contains("2/3 settled"), "{rendered}");
assert!(rendered.contains("RUN1"), "{rendered}");
assert!(rendered.contains("FAIL1"), "{rendered}");
assert!(
rendered.contains("implement the subagent card"),
"{rendered}"
);
assert!(!rendered.contains("DONE"), "{rendered}");
assert!(!rendered.contains("audit cache invalidation"), "{rendered}");
assert!(rendered.contains("[g1 card-builder ✓]"), "{rendered}");
assert!(rendered.contains("[g2 identity-only ●]"), "{rendered}");
assert!(rendered.contains("[g3 ✗]"), "{rendered}");
assert!(!rendered.contains("depth"), "{rendered}");
assert!(!rendered.contains("TASK_COUNT"), "{rendered}");
let wide_model_rendered = visual_lines(&state, 80)
.iter()
.map(|line| line_text(&line.line))
.collect::<Vec<_>>()
.join("\n");
assert!(
wide_model_rendered.contains("✓ g1 · rust-dev · anthropic/claude-sonnet(high)"),
"{wide_model_rendered}"
);
state.pin_subagent_card_task(parent, ActivityId::new("call_parallel/g2"));
let pinned_g2 = visual_lines(&state, CARD_LAYOUT_MIN_WIDTH)
.iter()
.map(|line| line_text(&line.line))
.collect::<Vec<_>>()
.join("\n");
assert!(pinned_g2.contains("● g2 · identity-only"), "{pinned_g2}");
assert!(
!pinned_g2.contains("anthropic/claude-sonnet"),
"{pinned_g2}"
);
}
#[test]
fn subagent_card_sanitizes_provider_controlled_metadata_fields() {
let mut state = linked_tool_state(
"metadata-parent",
"subagents",
"subagents • 1 tasks",
ActivityStatus::Running,
vec![("tasks".to_string(), "1".to_string())],
"",
);
let parent = ActivityId::new("metadata-parent");
state.apply_activity_event(ActivityEvent::Started {
id: ActivityId::new("metadata-parent/g1"),
parent_id: Some(parent),
kind: ActivityKind::SubagentTask,
status: ActivityStatus::Running,
metadata: ActivityMetadata {
label: "g1 • depth 2 • inspect metadata".to_string(),
detail: None,
fields: vec![
("identity".to_string(), "identity\nline".to_string()),
("agent".to_string(), "builder\nsk-ant-secret123".to_string()),
("provider".to_string(), "provider\nline".to_string()),
("model".to_string(), "model\nline".to_string()),
("reasoning".to_string(), "high\nline".to_string()),
],
},
});
let child = &project_cards(&state)[0].children[0];
assert_eq!(child.identity.as_deref(), Some("identity\\nline"));
assert_eq!(child.agent.as_deref(), Some("builder\\n<redacted>"));
assert_eq!(
child.model_line.as_deref(),
Some("provider\\nline/model\\nline(high\\nline)")
);
assert!(
child
.identity
.as_ref()
.is_some_and(|value| !value.contains('\n'))
);
assert!(
child
.agent
.as_ref()
.is_some_and(|value| !value.contains('\n'))
);
assert!(
child
.model_line
.as_ref()
.is_some_and(|value| !value.contains('\n'))
);
}
#[test]
fn subagent_card_headers_match_completed_and_active_failed_states() {
let mut completed = MissionControlState::default();
append_subagent_card_batch(
&mut completed,
"completed-header",
&[ActivityStatus::Success, ActivityStatus::Success],
);
let completed_header = visual_lines(&completed, 80)
.into_iter()
.find(|line| line.copy_text.starts_with("Subagents"))
.expect("completed header")
.copy_text;
assert_eq!(completed_header, "Subagents • 2/2 settled");
for status in ["DONE", "RUN", "FAIL", "WAIT"] {
assert!(!completed_header.contains(status), "{completed_header}");
}
let mut active_failed = MissionControlState::default();
append_subagent_card_batch(
&mut active_failed,
"active-failed-header",
&[
ActivityStatus::Running,
ActivityStatus::Failed,
ActivityStatus::Queued,
],
);
let active_failed_header = visual_lines(&active_failed, 80)
.into_iter()
.find(|line| line.copy_text.starts_with("Subagents"))
.expect("active/failed header")
.copy_text;
assert_eq!(
active_failed_header,
"Subagents • 1/3 settled • RUN1 • FAIL1 • WAIT1",
);
for status in ["RUN1", "FAIL1", "WAIT1"] {
assert!(
active_failed_header.contains(status),
"{active_failed_header}"
);
}
}
#[test]
fn subagent_card_has_one_blank_row_after_final_roster_row() {
let mut state = MissionControlState::default();
append_subagent_card_batch(
&mut state,
"roster-spacing",
&[ActivityStatus::Running, ActivityStatus::Running],
);
let lines = visual_lines(&state, 80);
let final_roster = lines
.iter()
.rposition(|line| {
line.hit_regions.iter().any(|region| {
matches!(
region.target,
super::visual_lines::TranscriptHitTarget::SelectTask { .. }
)
})
})
.expect("final roster row");
assert!(
lines[final_roster + 1].copy_text.trim().is_empty(),
"lines={lines:?} final_roster={final_roster}"
);
assert!(
!lines[final_roster + 2].copy_text.trim().is_empty(),
"lines={lines:?} final_roster={final_roster}"
);
}
#[test]
fn long_subagent_card_intent_is_single_row_with_body_background() {
let mut state = MissionControlState::default();
let parent = ActivityId::new("subagent_card_wrap");
state
.transcript
.push_back("tool: ⟳ subagents • running".to_string());
state.transcript.link_activity(
0,
TranscriptActivityLink {
activity_id: parent.clone(),
tool_name: "subagents".to_string(),
},
);
state.apply_activity_event(ActivityEvent::Started {
id: parent.clone(),
parent_id: None,
kind: ActivityKind::SubagentBatch,
status: ActivityStatus::Running,
metadata: ActivityMetadata::new("subagents • 1 tasks"),
});
state.apply_activity_event(ActivityEvent::Started {
id: ActivityId::new("subagent_card_wrap/g1"),
parent_id: Some(parent),
kind: ActivityKind::SubagentTask,
status: ActivityStatus::Running,
metadata: ActivityMetadata::new("g1 • depth 2 • wrapped selection fragment"),
});
let width = 24;
let lines = visual_lines(&state, width);
let intent_lines = lines
.iter()
.filter(|line| line.copyable && line.copy_text.contains("wrapped"))
.collect::<Vec<_>>();
assert_eq!(intent_lines.len(), 1, "expected one intent row: {lines:?}");
assert_eq!(visual_line_rows(intent_lines[0], width), 1);
assert!(
intent_lines[0]
.line
.spans
.iter()
.all(|span| span.style.bg == Some(MissionControlTheme::default().surface_panel()))
);
assert!(intent_lines[0].hit_regions.is_empty());
let chip = lines
.iter()
.find(|line| line.copy_text.contains("[g1 ●]"))
.expect("compact task chip");
assert!(matches!(
chip.hit_regions.as_slice(),
[super::visual_lines::TranscriptHitRegion {
target: super::visual_lines::TranscriptHitTarget::SelectTask { .. },
..
}]
));
}
#[test]
fn subagent_card_handles_no_separator_label_shape() {
let mut state = MissionControlState::default();
let parent = ActivityId::new("call_parallel");
state
.transcript
.push_back("tool: ⟳ subagents • running".to_string());
state.transcript.link_activity(
0,
TranscriptActivityLink {
activity_id: parent.clone(),
tool_name: "subagents".to_string(),
},
);
state.apply_activity_event(ActivityEvent::Started {
id: parent.clone(),
parent_id: None,
kind: ActivityKind::SubagentBatch,
status: ActivityStatus::Running,
metadata: ActivityMetadata::new("subagents • 1 tasks"),
});
state.apply_activity_event(ActivityEvent::Started {
id: ActivityId::new("call_parallel/g1"),
parent_id: Some(parent),
kind: ActivityKind::SubagentTask,
status: ActivityStatus::Running,
metadata: ActivityMetadata::new("g1 inspect"),
});
let cards = project_cards(&state);
let card = &cards[0];
assert_eq!(card.children.len(), 1);
assert_eq!(card.children[0].task_id, "g1");
assert_eq!(card.children[0].intent, "inspect");
let wide_lines = visual_lines(&state, CARD_LAYOUT_MIN_WIDTH);
let rendered = wide_lines
.iter()
.map(|line| line_text(&line.line))
.collect::<Vec<_>>()
.join("\n");
assert!(rendered.contains("g1"), "{rendered}");
assert!(rendered.contains("inspect"), "{rendered}");
}
#[test]
fn subagent_cache_fallback_survives_waiting_and_unknown_usage_without_changing_totals() {
use crate::output::{NormalizedUsageAggregate, NormalizedUsageSnapshot};
let mut state = linked_tool_state(
"cache-fallback",
"subagents",
"subagents • 2 tasks",
ActivityStatus::Running,
vec![("tasks".into(), "2".into())],
"",
);
let parent = ActivityId::new("cache-fallback");
for task in ["g1", "g2"] {
state.apply_activity_event(ActivityEvent::Started {
id: parent.child(task),
parent_id: Some(parent.clone()),
kind: ActivityKind::SubagentTask,
status: ActivityStatus::Running,
metadata: ActivityMetadata::new(format!("{task} • inspect")),
});
}
let known = NormalizedUsageSnapshot {
effective_input: 300,
output: 20,
cache_read: 200,
cache_known: true,
};
let latest = NormalizedUsageSnapshot {
cache_read: 100,
..known
};
let unknown = NormalizedUsageSnapshot {
cache_known: false,
..known
};
let zero = NormalizedUsageSnapshot {
cache_read: 0,
..known
};
let invalid = NormalizedUsageSnapshot {
cache_read: 301,
..known
};
let empty = NormalizedUsageSnapshot {
effective_input: 0,
..zero
};
for (sequence, (whole_run, latest, expected)) in [
(known, Some(latest), (66, 33)),
(known, None, (66, 33)), (unknown, Some(unknown), (66, 33)),
(invalid, Some(empty), (66, 33)),
(zero, Some(known), (0, 66)), (known, Some(zero), (66, 0)),
(unknown, None, (66, 0)), ]
.into_iter()
.enumerate()
{
let usage = NormalizedUsageAggregate {
whole_run,
latest,
latest_request_sequence: Some(sequence as u64 + 1),
latest_final: false,
};
state.apply_activity_event(ActivityEvent::UsageSnapshot {
id: parent.child("g1"),
usage,
request_sequence: sequence as u64 + 1,
final_usage: false,
});
state.apply_activity_event(ActivityEvent::Started {
id: parent.child("g1"),
parent_id: Some(parent.clone()),
kind: ActivityKind::SubagentTask,
status: ActivityStatus::Running,
metadata: ActivityMetadata::new("g1 • inspect"),
});
let cards = project_cards(&state);
let child = cards[0]
.children
.iter()
.find(|child| child.task_id == "g1")
.unwrap();
assert_eq!(child.usage, Some(usage), "step {sequence}");
assert_eq!(
child.last_known_cache_percent,
Some(expected.0),
"step {sequence}"
);
assert_eq!(
child.last_known_latest_cache_percent,
Some(expected.1),
"step {sequence}"
);
let lines = visual_lines(&state, 80);
let usage_row = lines
.iter()
.find(|line| line.copy_text.starts_with(" │ Tks"))
.unwrap();
assert!(
usage_row
.copy_text
.trim_end_matches([' ', '│'])
.ends_with(&format!(
"Cache {}%(total)| {}%(latest)",
expected.0, expected.1
)),
"step {sequence}: {}",
usage_row.copy_text
);
let intent_row = lines
.iter()
.position(|line| line.copy_text.trim() == "inspect")
.unwrap();
assert!(lines[intent_row + 1].copy_text.trim().is_empty());
assert!(
lines[intent_row + 2]
.copy_text
.trim_start()
.starts_with('╭')
);
assert!(
lines[intent_row + 4 + state.subagent_card_rows()]
.copy_text
.trim_start()
.starts_with('╰')
);
let feed = &lines[intent_row + 4..intent_row + 4 + state.subagent_card_rows()];
let body_background = lines[intent_row].line.spans[0].style.bg;
for row in feed {
assert!(row.copy_text.starts_with(" │ "));
assert!(row.copy_text.ends_with('│'));
assert!(row.hit_regions.is_empty());
let borders = row
.line
.spans
.iter()
.filter(|span| span.content == "│")
.collect::<Vec<_>>();
assert_eq!(borders.len(), 2);
assert!(borders.iter().all(|span| span.style.bg == body_background));
assert!(
row.line
.spans
.iter()
.any(|span| span.style.bg == Some(state.theme.surface_background()))
);
}
let untouched = cards[0]
.children
.iter()
.find(|child| child.task_id == "g2")
.unwrap();
assert_eq!(untouched.usage, None);
assert_eq!(untouched.last_known_cache_percent, None);
assert_eq!(untouched.last_known_latest_cache_percent, None);
}
}
#[test]
fn subagent_usage_projects_selected_totals_and_refreshes_without_hit_regions() {
let mut state = linked_tool_state(
"usage-batch",
"subagents",
"subagents • 2 tasks",
ActivityStatus::Running,
vec![("tasks".into(), "2".into())],
"",
);
let parent = ActivityId::new("usage-batch");
for (task, status) in [
("g1", ActivityStatus::Running),
("g2", ActivityStatus::Success),
] {
state.apply_activity_event(ActivityEvent::Started {
id: parent.child(task),
parent_id: Some(parent.clone()),
kind: ActivityKind::SubagentTask,
status,
metadata: ActivityMetadata::new(format!("{task} • inspect")),
});
}
assert!(project_cards(&state)[0].children[0].usage.is_none());
let g1 = parent.child("g1");
state.apply_activity_event(ActivityEvent::UsageSnapshot {
id: g1.clone(),
usage: crate::output::NormalizedUsageAggregate {
whole_run: crate::output::NormalizedUsageSnapshot {
effective_input: 18_400,
output: 3_200,
cache_read: 7_912,
cache_known: true,
},
latest: Some(crate::output::NormalizedUsageSnapshot {
effective_input: 16_000,
output: 3_200,
cache_read: 15_840,
cache_known: true,
}),
latest_request_sequence: Some(1),
latest_final: false,
},
request_sequence: 1,
final_usage: false,
});
assert!(project_cards(&state)[0].children[0].usage.is_some());
let card = &project_cards(&state)[0];
assert_eq!(
card.children[0].usage.unwrap().whole_run.effective_input,
18_400
);
let lines = visual_lines(&state, 80);
let usage = lines
.iter()
.find(|line| line.copy_text.starts_with(" │ Tks"))
.expect("usage row");
assert_eq!(
usage.copy_text.trim_matches([' ', '│']),
"Tks 18k(in)| 3k(out) • Cache 43%(total)| 99%(latest)"
);
assert!(usage.hit_regions.is_empty());
for (text, color) in [
("18k(in)", state.theme.transcript_user_color()),
("3k(out)", state.theme.text_accent()),
(
"43%(total)",
state.theme.activity_status_color(ActivityStatus::Success),
),
(
"99%(latest)",
state.theme.activity_status_color(ActivityStatus::Success),
),
] {
let span = usage
.line
.spans
.iter()
.find(|span| span.content == text)
.expect("colored token field");
assert_eq!(span.style.fg, Some(color));
}
let separators = usage
.line
.spans
.iter()
.filter(|span| span.content == "| ")
.collect::<Vec<_>>();
assert_eq!(separators.len(), 2);
for separator in separators {
assert_eq!(separator.style.fg, Some(state.theme.text_muted()));
}
state.pin_subagent_card_task(parent.clone(), parent.child("g2"));
assert!(
!visual_lines(&state, CARD_LAYOUT_MIN_WIDTH)
.iter()
.any(|line| line.copy_text.contains("18k(in)"))
);
state.apply_activity_event(ActivityEvent::UsageSnapshot {
id: parent.child("g2"),
usage: crate::output::NormalizedUsageAggregate {
whole_run: crate::output::NormalizedUsageSnapshot {
effective_input: 0,
output: 0,
cache_read: 0,
cache_known: true,
},
latest: None,
latest_request_sequence: Some(2),
latest_final: true,
},
request_sequence: 2,
final_usage: true,
});
let g2_lines = visual_lines(&state, 80);
let g2_usage = g2_lines
.iter()
.find(|line| line.copy_text.starts_with(" │ Tks"))
.expect("g2 usage row");
assert_eq!(
g2_usage.copy_text.trim_matches([' ', '│']),
"Tks 0(in)| 0(out) • Cache —(total)| —(latest)"
);
}
#[test]
fn subagent_usage_unknown_cache_uses_one_row_and_survives_finish() {
let mut state = linked_tool_state(
"usage-unknown",
"subagents",
"subagents • 1 tasks",
ActivityStatus::Running,
vec![("tasks".into(), "1".into())],
"",
);
let parent = ActivityId::new("usage-unknown");
let child = parent.child("g1");
state.apply_activity_event(ActivityEvent::Started {
id: child.clone(),
parent_id: Some(parent.clone()),
kind: ActivityKind::SubagentTask,
status: ActivityStatus::Running,
metadata: ActivityMetadata::new("g1 • a very long intent"),
});
let snapshot = crate::output::NormalizedUsageSnapshot {
effective_input: 1_234_567,
output: 12_345,
cache_read: 0,
cache_known: false,
};
state.apply_activity_event(ActivityEvent::UsageSnapshot {
id: child.clone(),
usage: crate::output::NormalizedUsageAggregate {
whole_run: snapshot,
latest: Some(snapshot),
latest_request_sequence: Some(1),
latest_final: false,
},
request_sequence: 1,
final_usage: false,
});
state.apply_activity_event(ActivityEvent::Finished {
id: child,
status: ActivityStatus::Success,
metadata: None,
});
let wide_lines = visual_lines(&state, 80);
let usage_rows = wide_lines
.iter()
.filter(|line| line.copy_text.starts_with(" │ Tks"))
.collect::<Vec<_>>();
assert_eq!(usage_rows.len(), 1);
assert_eq!(
usage_rows[0].copy_text.trim_matches([' ', '│']),
"Tks 1M(in)| 12k(out) • Cache —(total)| —(latest)"
);
assert!(usage_rows[0].hit_regions.is_empty());
for width in 1..=80 {
let lines = visual_lines(&state, width);
let usage_rows = lines
.iter()
.filter(|line| line.copy_text.contains("Tks"))
.collect::<Vec<_>>();
assert_eq!(usage_rows.len(), usize::from(width >= 18), "width {width}");
if let Some(row) = usage_rows.first() {
let expected = match width {
18..=27 => "Tks 1M(in)",
28..=44 => "Tks 1M(in)| 12k(out)",
45..=55 => "Tks 1M(in)| 12k(out) • Cache —(total)",
56.. => "Tks 1M(in)| 12k(out) • Cache —(total)| —(latest)",
_ => unreachable!(),
};
assert_eq!(
row.copy_text.trim_matches([' ', '│']),
expected,
"width {width}"
);
assert!(row.hit_regions.is_empty());
}
for row in lines
.iter()
.filter(|line| line.copy_text.starts_with(" │"))
{
assert!(
row.copy_text.ends_with('│'),
"width {width}: {}",
row.copy_text
);
assert!(
row.line.width() <= usize::from(width),
"width {width}: {}",
row.copy_text
);
}
assert!(!lines.iter().any(|line| line.copy_text.contains("Latest")));
}
assert!(
!project_cards(&state)[0].children[0]
.usage
.unwrap()
.whole_run
.cache_known
);
state.apply_activity_event(ActivityEvent::UsageSnapshot {
id: ActivityId::new("usage-unknown/g1"),
usage: crate::output::NormalizedUsageAggregate {
whole_run: crate::output::NormalizedUsageSnapshot {
effective_input: u64::MAX - 1,
output: u64::MAX,
cache_read: u64::MAX,
cache_known: true,
},
latest: Some(crate::output::NormalizedUsageSnapshot {
effective_input: u64::MAX - 1,
output: u64::MAX,
cache_read: u64::MAX,
cache_known: true,
}),
latest_request_sequence: Some(2),
latest_final: false,
},
request_sequence: 2,
final_usage: false,
});
let max_cache = visual_lines(&state, 80)
.into_iter()
.find(|line| line.copy_text.starts_with(" │ Tks"))
.expect("max cache row");
assert_eq!(
max_cache.copy_text.trim_matches([' ', '│']),
"Tks 18E(in)| 18E(out) • Cache —(total)| —(latest)"
);
}