Simulation report: each turn shows the packet's flags (promises over their guard, the domain view's window and what it left out, guards bound, clipped) (Soul's R5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-21 00:55:02 +01:00
commit 886bab8dd4
2 changed files with 30 additions and 0 deletions

View file

@ -719,6 +719,26 @@ fn promises_markdown(out: &mut String, turn: &Value) {
}
}
/// The packet's flags, as the report shows them (Soul's R5): whether her promises overflowed their guard (all still
/// shown), the window her domain view shows and what it left out, the context guards that bound, and what was clipped.
fn flags_markdown(out: &mut String, turn: &Value) {
let packet = &turn["report"]["packet"];
let list = |value: &Value| value.as_array().map(|items| items.iter().map(|item| item.as_str().map_or_else(|| item.to_string(), str::to_owned)).collect::<Vec<_>>().join(", ")).filter(|text| !text.is_empty()).unwrap_or_else(|| "none".to_owned());
let shown = &packet["domain_shown"];
let domain = match (shown["since"].as_str(), shown["omitted"].as_str()) {
(_, Some(why)) => format!("left out ({why})"),
(Some(since), None) => format!("since {since}, {} older items left out", shown["left_out"]),
(None, None) => "none".to_owned(),
};
let _ = writeln!(
out,
"Packet flags: promises over their guard: {}; domain view: {domain}; guards bound: {}; clipped: {}\n",
if packet["promises_over"] == true { "yes (all shown)" } else { "no" },
list(&packet["bound"]),
list(&packet["clipped"]),
);
}
fn markdown(plan_path: &Path, plan: &SimFile, members: &[Member], group_state: Option<bool>, runs: &[Value]) -> String {
let mut out = String::new();
let _ = writeln!(out, "# Swarm simulation\n");
@ -810,6 +830,7 @@ fn markdown(plan_path: &Path, plan: &SimFile, members: &[Member], group_state: O
let _ = writeln!(out, "Stimulus:\n\n````text\n{}\n````\n", report["packet"]["stimulus"].as_str().unwrap_or_default());
turn_markdown(&mut out, &report["renders"][0]);
promises_markdown(&mut out, turn);
flags_markdown(&mut out, turn);
}
let _ = writeln!(out, "</details>\n");
}

View file

@ -769,3 +769,12 @@ says = "good afternoon, everyone"
assert!(decision("Libby").get("reads").is_none(), "no fixture, no reads");
assert!(model.calls.borrow().iter().any(|(_, prompt)| prompt.contains("Then he reads GameCult/Lodur#12 on the forge:")));
}
/// Soul's R5: the report shows the packet's flags, `promises_over` among them.
#[test]
fn r5_the_report_shows_the_packets_flags() {
let turn = json!({ "report": { "packet": { "promises_over": true, "domain_shown": { "since": "2026-11-20T09:01:00+00:00", "left_out": 3, "omitted": null }, "bound": ["outcome"], "clipped": ["(identity)"] } } });
let mut out = String::new();
flags_markdown(&mut out, &turn);
assert_eq!(out, "Packet flags: promises over their guard: yes (all shown); domain view: since 2026-11-20T09:01:00+00:00, 3 older items left out; guards bound: outcome; clipped: (identity)\n\n");
}