T38: review round 1: herdr's records take herdr: before the pane, a colon no OSC 7501 id holds, so a program's record named like theirs, herdr/build among them, stays through herdr's snapshots and its leaving
CI / platforms (windows-latest) (push) Successful in 1m33s
CI / platforms (ubuntu-24.04) (push) Successful in 1m43s
CI / macos (push) Successful in 14m6s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-17 14:24:42 -04:00
1 parent a175b18743
commit 7d56063df9
5 files changed
+44 -15

No files matched your search

+36 -7
View File
@@ -144,8 +144,27 @@ fn records_replace_and_clear_as_the_spec_says() {
fn herdr_s_agents_replace_their_own_records_alone() {
let mut records = Records::default();
records.report("build".into(), record(State::Working, None));
// A program's id ends at a colon, so `herdr:w1:p1` names its record `herdr`.
for body in [
&b"state=done:id=herdr/build"[..],
b"state=done:id=herdr:w1:p1",
] {
let Some(Status::Report(id, done)) = said(body) else {
panic!("a program's report");
};
records.report(id, done);
}
let ids = |records: &Records| -> Vec<String> {
records.list.iter().map(|(id, ..)| id.clone()).collect()
};
records.herdr(&[]);
assert_eq!(
ids(&records),
["build", "herdr/build", "herdr"],
"an empty snapshot takes no program's record"
);
let codex = [(
"herdr/w1:p1".to_string(),
"herdr:w1:p1".to_string(),
record(State::Working, Some("codex")),
)];
records.herdr(&codex);
@@ -153,17 +172,27 @@ fn herdr_s_agents_replace_their_own_records_alone() {
records.herdr(&codex);
assert_eq!(records.clock, clock, "the same agents change nothing");
let claude = [(
"herdr/w1:p2".to_string(),
"herdr:w1:p2".to_string(),
record(State::Blocked, Some("claude")),
)];
records.herdr(&claude);
let ids: Vec<&str> = records.list.iter().map(|(id, ..)| id.as_str()).collect();
assert_eq!(ids, ["build", "herdr/w1:p2"]);
assert_eq!(
ids(&records),
["build", "herdr/build", "herdr", "herdr:w1:p2"]
);
records.herdr(&[]);
assert_eq!(
ids(&records),
["build", "herdr/build", "herdr"],
"herdr's leaving takes its own alone"
);
records.reset();
records.herdr(&claude);
assert_eq!(records.list.len(), 1, "the next snapshot puts them back");
records.herdr(&[]);
assert!(records.list.is_empty());
assert_eq!(
ids(&records),
["herdr:w1:p2"],
"the next snapshot puts them back"
);
}
#[test]