docs: M5d-1 checklist fixes before hand-over

Given tests: Action::Turn (not To), send_turn of epoch 1, clippy on
compact_summary, jsonl-without-baseline, live turn after compact sends
the carry. send_turn maps Damaged to Local("log") as read_turn did.
Gate counts 1484 → 1508. Mutations recorded in the README.

Co-Authored-By: Grok 4.6 <noreply@x.ai>
This commit is contained in:
2026-10-02 22:36:51 -07:00
co-authored by Grok 4.6
parent 3726ae585f
commit c3b05cf003
10 changed files with 135 additions and 52 deletions
@@ -1,21 +1,28 @@
//! Honcho reads every epoch file of a session, in order. Do not edit.
#[path = "support/honcho.rs"]
mod honcho;
#[path = "support/logs.rs"]
mod logs;
#[path = "support/tmp.rs"]
mod tmp;
#[path = "support/turns.rs"]
mod turns;
#[path = "support/worker.rs"]
mod worker;
use std::cell::RefCell;
use bxcore::{Epoch, LogRecord, SessionId, Timestamp};
use honcho::FakeHoncho;
use logs::{assistant, write_log};
use memoryd::honcho::decide::{turn_records, turns};
use memoryd::honcho::ledger::{Action, Item, Ledger, Record, Workspace};
use memoryd::honcho::turns::{LOG_RUNBOOK, TurnSync, read_session};
use memoryd::honcho::worker::Step;
use tmp::TempDir;
use turns::{clean, sid, spoken};
use worker::{FAST, Home as WorkerHome};
const LEDGER: &str = "honcho.jsonl";
@@ -85,10 +92,10 @@ impl World {
}
}
fn to(workspace: Workspace, peer: &str) -> Action {
Action::To {
fn to(workspace: Workspace, speaker: &str) -> Action {
Action::Turn {
workspace,
peer: peer.to_string(),
speaker: speaker.to_string(),
}
}
@@ -108,10 +115,7 @@ fn concatenated_logs_count_three_turns() {
home,
"mm-a",
1,
&[
spoken("three", Some("kyle")),
assistant(4, Some("ok"), &[]),
],
&[spoken("three", Some("kyle")), assistant(4, Some("ok"), &[])],
);
let records = read_session(&home.join("sessions"), &sid("mm-a")).unwrap();
assert_eq!(turns(&records), 3);
@@ -164,10 +168,7 @@ fn turn_sync_decides_a_turn_that_lives_in_epoch_1() {
w.dir.path(),
"mm-a",
1,
&[
spoken("three", Some("kyle")),
assistant(4, Some("ok"), &[]),
],
&[spoken("three", Some("kyle")), assistant(4, Some("ok"), &[])],
);
w.updated("mm-a", 3);
assert_eq!(w.action("mm-a", 3), Some(to(Workspace::Trusted, "kyle")));
@@ -179,3 +180,46 @@ fn a_missing_session_directory_is_empty() {
let records = read_session(&dir.path().join("sessions"), &sid("mm-none")).unwrap();
assert!(records.is_empty());
}
#[test]
fn send_turn_reads_a_turn_that_lives_in_epoch_1() {
let fake = FakeHoncho::start();
let home = WorkerHome::new("honcho-epochs-send");
write_log(
home.dir.path(),
"mm-a",
&[
spoken("one", Some("kyle")),
assistant(2, Some("ok"), &[]),
spoken("two", Some("kyle")),
assistant(3, Some("ok"), &[]),
epoch_end("sum"),
],
);
write_epoch(
home.dir.path(),
"mm-a",
1,
&[spoken("three", Some("kyle")), assistant(4, Some("ok"), &[])],
);
home.report("mm-a", 3);
let mut w = home.worker(&fake, FAST);
assert_eq!(w.step(), Step::Done);
assert_eq!(w.step(), Step::Done);
assert_eq!(w.step(), Step::Done);
let posts: Vec<_> = fake
.requests()
.into_iter()
.filter(|r| r.path.ends_with("/messages"))
.collect();
assert_eq!(posts.len(), 3, "{posts:?}");
let body = posts[2].body.as_ref().expect("message batch");
let contents: Vec<&str> = body["messages"]
.as_array()
.unwrap()
.iter()
.map(|m| m["content"].as_str().unwrap())
.collect();
assert_eq!(contents, ["three", "ok"]);
assert_eq!(body["messages"][0]["metadata"]["turn"], 3);
}