tests: move Workflow receipt rendering to its UI owner

Keep the Workflow tool test's spawn-minted requested/effective route receipt and durable JSONL reload assertions. Move its existing panel/history assertions into the existing row-receipt round-trip test, seeded with the same typed wire fields. Remove only duplicate coordination pager assertions already covered by the UI's durable-resolution test. No new test functions or code comments; correct the existing tool comment that formerly claimed UI rendering.

Before on unchanged compiled test inputs: workflow1, panel31 and coordination4 passed;0 failed. After on95d4ce460a plus five frozen paths: "Summary [   0.477s] 37 tests run: 37 passed, 15279 skipped", including the original durable claim eviction/resolution case. Source hashes unchanged. Runtime boundary production0/test25/uilib0 -> production0/test18/uilib0, late1/doc0 unchanged. fmt/diff pass; blocking538 sites/165files and dead-code221 suppressions remain within unchanged budgets.

Production and model-facing bytes are unchanged. Reuse immediately preceding root npm1312 passed;0 failed;7 skipped and check:web evidence. Full hosted acceptance remains separate.

Refs CW-7160
Refs #6938
This commit is contained in:
CodeWhale Bot committed 2026-10-12 03:09:40 -07:00
1 parent 95d4ce460a
commit a395e38451
5 files changed
+77 -76

No files matched your search

-12
View File
@@ -2019,18 +2019,6 @@ mod tests {
projection.contentions[0].resolution_sequence,
Some(resolution_sequence)
);
assert!(!crate::tui::coordination_detail::needs_attention(
&projection
));
let pager = crate::tui::coordination_detail::format(
codewhale_localization::Locale::En,
&projection,
);
assert!(
pager.contains("disposition resolved_by_successful_claim"),
"{pager}"
);
assert!(!pager.contains("disposition blocked_pending"), "{pager}");
}
#[tokio::test]
+2 -60
View File
@@ -8987,9 +8987,8 @@ export default workflow({
assert_eq!(child.status, SubAgentStatus::Completed);
assert_eq!(child.result.as_deref(), Some("child done"));
// Full receipt chain: the spawn-minted event survives the JSONL
// journal reload, hydrates the live projection, and round-trips into
// history without following a later route or inventing missing usage.
// The spawn-minted receipt survives the JSONL journal reload with
// the requested and resolved route fields intact.
let reloaded = WorkflowWorkspaceState::open(tmp.path());
let persisted = reloaded
.runs
@@ -9011,63 +9010,6 @@ export default workflow({
assert_eq!(persisted_started["resolved_provider"], "deepseek");
assert_eq!(persisted_started["resolved_model"], "deepseek-v4-flash");
assert_eq!(persisted_started["route_source"], "task.model");
let mut panel =
crate::tui::widgets::workflow_panel::WorkflowPanel::from_run_json(&persisted_json)
.expect("journal should hydrate workflow panel");
let original_receipt = panel
.phases
.iter()
.flat_map(|phase| phase.rows.iter())
.find(|row| row.task_id == child_id)
.map(crate::tui::widgets::workflow_panel::row_receipt_text)
.expect("spawned child receipt");
assert!(original_receipt.contains("deepseek/deepseek-v4-flash"));
assert!(original_receipt.contains("reasoning low→"));
assert!(original_receipt.contains("via task.model"));
panel.apply_json_event(&json!({
"type": "task_started",
"at_ms": 9_000,
"task_id": "later-route",
"label": "later-route",
"resolved_role": "consultant",
"resolved_provider": "moonshot",
"resolved_model": "kimi-k3",
"requested_reasoning": "auto",
"effective_reasoning": "medium",
"route_source": "agent_profile.model",
"worktree": false,
}));
panel.apply_json_event(&json!({
"type": "task_completed",
"at_ms": 9_100,
"task_id": "later-route",
"status": "succeeded"
}));
let unchanged = panel
.phases
.iter()
.flat_map(|phase| phase.rows.iter())
.find(|row| row.task_id == child_id)
.map(crate::tui::widgets::workflow_panel::row_receipt_text)
.expect("original child after later route");
assert_eq!(unchanged, original_receipt);
let history =
crate::tui::widgets::workflow_panel::WorkflowPanel::from_run_json(&panel.to_run_json())
.expect("history receipt round trip");
let later_receipt = history
.phases
.iter()
.flat_map(|phase| phase.rows.iter())
.find(|row| row.task_id == "later-route")
.map(crate::tui::widgets::workflow_panel::row_receipt_text)
.expect("later route history receipt");
assert!(later_receipt.contains("moonshot/kimi-k3"));
assert!(later_receipt.contains("reasoning auto→medium"));
assert!(later_receipt.contains("tokens unknown"));
assert!(!later_receipt.contains("tokens 0"));
}
#[tokio::test]
@@ -2563,6 +2563,76 @@ mod tests {
.map(row_receipt_text)
.collect::<Vec<_>>();
assert_eq!(original, round_tripped);
{
let child_id = "persisted-child";
let mut started = task_started_json(child_id, "deepseek", "deepseek-v4-flash");
started["requested_reasoning"] = json!("low");
started["effective_reasoning"] = json!("low");
started["route_source"] = json!("task.model");
let persisted_json = json!({
"run_id":"workflow_abc", "workflow_goal":"audit", "started_at_ms":1_000,
"events":[
{"type":"run_started", "run_id":"workflow_abc", "workflow_goal":"audit", "at_ms":1_000},
started,
{"type":"task_completed", "task_id":child_id, "status":"succeeded", "at_ms":3_200}
]
});
let mut panel = WorkflowPanel::from_run_json(&persisted_json)
.expect("journal should hydrate workflow panel");
let original_receipt = panel
.phases
.iter()
.flat_map(|phase| phase.rows.iter())
.find(|row| row.task_id == child_id)
.map(row_receipt_text)
.expect("spawned child receipt");
assert!(original_receipt.contains("deepseek/deepseek-v4-flash"));
assert!(original_receipt.contains("reasoning low→"));
assert!(original_receipt.contains("via task.model"));
panel.apply_json_event(&json!({
"type": "task_started",
"at_ms": 9_000,
"task_id": "later-route",
"label": "later-route",
"resolved_role": "consultant",
"resolved_provider": "moonshot",
"resolved_model": "kimi-k3",
"requested_reasoning": "auto",
"effective_reasoning": "medium",
"route_source": "agent_profile.model",
"worktree": false,
}));
panel.apply_json_event(&json!({
"type": "task_completed",
"at_ms": 9_100,
"task_id": "later-route",
"status": "succeeded"
}));
let unchanged = panel
.phases
.iter()
.flat_map(|phase| phase.rows.iter())
.find(|row| row.task_id == child_id)
.map(row_receipt_text)
.expect("original child after later route");
assert_eq!(unchanged, original_receipt);
let history = WorkflowPanel::from_run_json(&panel.to_run_json())
.expect("history receipt round trip");
let later_receipt = history
.phases
.iter()
.flat_map(|phase| phase.rows.iter())
.find(|row| row.task_id == "later-route")
.map(row_receipt_text)
.expect("later route history receipt");
assert!(later_receipt.contains("moonshot/kimi-k3"));
assert!(later_receipt.contains("reasoning auto→medium"));
assert!(later_receipt.contains("tokens unknown"));
assert!(!later_receipt.contains("tokens 0"));
}
}
/// #4039 compatibility: journals written before the receipt fields existed
+3 -1
View File
@@ -337,7 +337,9 @@ tier is out of `crates/tui`; then Cargo enforces the boundary and the ratchet
is deleted. The 0.10.2 X2 snapshot stands at 0 production references and
30 test references, down from 11 and 32. The RS-11 roster split then removes
five test references and the final tools/crossterm test import, leaving 25
test references and no UI-library imports. The current baseline is the authority.
test references and no UI-library imports. The following tools split moves the
Workflow panel assertions to its existing history test and removes duplicated
coordination pager checks, leaving 18 test references. The current baseline is the authority.
`crates/runtime` must never depend on `tui`, `cli`, ratatui, crossterm,
`ansi-to-tui` or a terminal component kit; the runtime reaches the terminal
only through `host_terminal`.
+2 -3
View File
@@ -2,7 +2,7 @@
"_comment": "Runtime -> UI boundary ratchet (docs/design/TUI_DECONSTRUCTION.md, runtime split). Counts may only go down. Regenerate with python3 scripts/split/module_graph.py --update after removing references; never raise a count by hand.",
"totals": {
"prod": 0,
"test": 25,
"test": 18,
"late": 1,
"uilib": 0,
"doc": 0
@@ -15,8 +15,7 @@
"core|tui": 2,
"prompts|tui": 1,
"session_manager|tui": 3,
"test_support|tui": 7,
"tools|tui": 7
"test_support|tui": 7
},
"late": {
"core|exec_agent": 1