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:
@@ -106,7 +106,7 @@ fn tags_in_the_completion_are_neutralised() {
|
||||
let client = Client::new(cfg.clone());
|
||||
let s = session(&home, &cfg);
|
||||
let text = compact::summarise(&cfg, &client, &s).unwrap();
|
||||
assert!(!text.contains(&tag), "{text}");
|
||||
assert!(!text.contains(tag), "{text}");
|
||||
assert!(text.contains("hello"), "{text}");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
mod support;
|
||||
|
||||
use bxcore::{Epoch, LogRecord, SessionId, TurnEvent};
|
||||
use loopd::baseline::Baseline;
|
||||
use loopd::baseline::{Baseline, CARRY_HEADING};
|
||||
use loopd::compact;
|
||||
use loopd::llama::Client;
|
||||
use loopd::memory::NoMemory;
|
||||
@@ -125,11 +125,31 @@ fn usage_at_the_threshold_compacts_before_the_turn_returns() {
|
||||
w.finish(&mut s, "hi", outcome).unwrap();
|
||||
assert_eq!(s.epoch(), Epoch(1));
|
||||
assert_eq!(s.carry(), Some("the sum"));
|
||||
w.server.route(CHAT, vec![sse("next", 0, 20)]);
|
||||
let mut events = Vec::new();
|
||||
run_turn(&mut s, &w.runtime(), "again", None, &mut |e| {
|
||||
events.push(e.clone())
|
||||
})
|
||||
.unwrap();
|
||||
let sent = w.server.requests_to(CHAT);
|
||||
assert_eq!(sent.len(), 2);
|
||||
assert_eq!(sent.len(), 3);
|
||||
assert_eq!(sent[0].json()["id_slot"], 0);
|
||||
assert_eq!(sent[1].json()["id_slot"], 1);
|
||||
assert!(sent[1].json().get("tools").is_none());
|
||||
let live = sent[2].json();
|
||||
assert_eq!(live["id_slot"], 0);
|
||||
let contents: Vec<&str> = live["messages"]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|m| m["content"].as_str().unwrap_or(""))
|
||||
.collect();
|
||||
assert!(
|
||||
contents
|
||||
.iter()
|
||||
.any(|c| c.contains(CARRY_HEADING) && c.contains("the sum")),
|
||||
"{contents:?}"
|
||||
);
|
||||
let old = w.home.records("a");
|
||||
assert!(matches!(
|
||||
old.last(),
|
||||
|
||||
@@ -236,6 +236,10 @@ fn an_incomplete_next_epoch_is_ignored() {
|
||||
assert_eq!(s.epoch(), Epoch(0));
|
||||
assert_eq!(s.carry(), None);
|
||||
assert_eq!(s.turns(), 1);
|
||||
drop(s);
|
||||
write_jsonl(&home, "a", 2, &[start("a", 2, 0, &later())]);
|
||||
let s = Session::open(&home.dir, id("a")).unwrap();
|
||||
assert_eq!(s.epoch(), Epoch(0), "a log without its baseline is ignored");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user