use super::*; fn line(speaker: &str, start_ms: i64, text: &str) -> Line { Line { speaker: speaker.into(), start_ms, end_ms: start_ms + 2000, text: text.into(), language: None } } fn voices() -> Vec { vec![Voice { label: "S1".into(), name: Some("Asha".into()) }, Voice { label: "S2".into(), name: Some("Ben".into()) }, Voice { label: "S3".into(), name: None }] } fn tuesday() -> NaiveDate { NaiveDate::from_ymd_opt(2026, 11, 17).unwrap() } fn heard(words: &str, who: Option<&str>, due: Option<&str>, at: Option) -> HeardAction { HeardAction { words: words.into(), who: who.map(str::to_string), due_said: due.map(str::to_string), line: at } } /// RULE (meetings-summaries, 17 Nov 2026): A long transcript is read in parts of whole numbered lines, each under the size, every line in exactly one part, in order. #[test] fn a_long_transcript_is_read_in_parts_of_whole_lines() { let lines: Vec = (0..50).map(|i| line(if i % 2 == 0 { "S1" } else { "S3" }, i * 4000, "We should keep it simple this time, the last attempt got too complicated.")).collect(); let parts = parts(&lines, &voices(), 1000); assert!(parts.len() > 3); assert_eq!(parts[0].first, 1); assert_eq!(parts.last().unwrap().last, 50); for w in parts.windows(2) { assert_eq!(w[1].first, w[0].last + 1); } for p in &parts { assert!(p.text.len() <= 1000); assert_eq!(p.text.lines().count(), p.last - p.first + 1); } assert!(parts[0].text.starts_with("1 [00:00] Asha (S1): We should")); assert!(parts[0].text.lines().nth(1).unwrap().starts_with("2 [00:04] S3: ")); } /// RULE (meetings-summaries, 17 Nov 2026): The summary never invents an owner: an owner is a speaker of the meeting (by label or by the name the person gave them) or a name the transcript says; any other is dropped, the task kept. #[test] fn an_owner_the_transcript_does_not_bear_out_is_dropped() { let lines = vec![line("S1", 0, "Ben, can you also ask Dana for the logo files?"), line("S2", 3000, "Sure, I'll ask her today.")]; let got = check( &[ heard("Ask Dana for the logo files", Some("S2"), None, Some(1)), heard("Ask Dana for the logo files", Some("Ben"), None, Some(1)), heard("Ask Dana for the logo files", Some("Ben (S2)"), None, Some(1)), heard("Send the logo files", Some("Dana"), None, Some(1)), heard("Approve the budget", Some("Priya"), None, None), heard("Approve the budget", Some("S9"), None, None), heard("Approve the budget", Some("null"), None, None), heard("Approve the budget", Some("Dan"), None, None), ], &lines, &voices(), tuesday(), ); let who: Vec> = got.iter().map(|a| a.who.as_deref()).collect(); assert_eq!(who, [Some("S2"), Some("S2"), Some("S2"), Some("Dana"), None, None, None, None]); assert_eq!(got.len(), 8, "the task stays when its owner goes"); let lower = check(&[heard("send the logo files", None, None, None)], &lines, &voices(), tuesday()); assert_eq!(lower[0].words, "Send the logo files", "a task starts with a capital"); } /// RULE (meetings-summaries, 17 Nov 2026): The summary never invents a date: a day is kept only when the words it came from are in the transcript, and the day is worked out from those words and the meeting's day, never taken from the model. #[test] fn a_day_comes_from_the_transcripts_own_words() { let lines = vec![line("S2", 0, "I'll send the revised quote to the client by Thursday."), line("S3", 5000, "I can update the onboarding doc before Friday.")]; let got = check( &[ heard("Send the revised quote", Some("S2"), Some("by Thursday"), Some(1)), heard("Update the onboarding doc", Some("S3"), Some("before Friday"), Some(2)), heard("Book the venue", Some("S1"), Some("by next Monday"), None), ], &lines, &voices(), tuesday(), ); assert_eq!(got[0].due.as_deref(), Some("2026-11-19")); assert_eq!(got[0].at_ms, Some(0)); assert_eq!(got[1].due.as_deref(), Some("2026-11-20")); assert_eq!(got[1].at_ms, Some(5000)); assert_eq!((got[2].due.as_deref(), got[2].due_said.as_deref()), (None, None), "words nobody said give no day"); } /// RULE (meetings-summaries, 17 Nov 2026): A day is worked out from the words in English, Telugu or Hindi: today, tomorrow, the day after, the next such weekday after the meeting's day, the 25th (this month or the next), 25 November or November 25; words naming no one day give none. #[test] fn the_words_for_a_day_in_three_languages() { let day = tuesday(); let d = |s: &str| due_day(s, day).map(|d| d.format("%Y-%m-%d").to_string()); assert_eq!(d("by tomorrow").as_deref(), Some("2026-11-18")); assert_eq!(d("కల్ తక్").as_deref(), None); assert_eq!(d("कल तक").as_deref(), Some("2026-11-18")); assert_eq!(d("రేపు").as_deref(), Some("2026-11-18")); assert_eq!(d("repu").as_deref(), Some("2026-11-18"), "Telugu in Latin letters"); assert_eq!(d("repatiki").as_deref(), Some("2026-11-18"), "a day word keeps its ending"); assert_eq!(d("ellundi").as_deref(), Some("2026-11-19")); assert_eq!(d("ee roju").as_deref(), Some("2026-11-17")); assert_eq!(d("somavaaraniki").as_deref(), Some("2026-11-23")); assert_eq!(d("shukravaaram lopu").as_deref(), Some("2026-11-20")); assert_eq!(d("brepu tasomavaaram"), None, "never the inside of a word"); assert_eq!(d("the day after tomorrow").as_deref(), Some("2026-11-19")); assert_eq!(d("परसों").as_deref(), Some("2026-11-19")); assert_eq!(d("today").as_deref(), Some("2026-11-17")); assert_eq!(d("Monday లోపు").as_deref(), Some("2026-11-23")); assert_eq!(d("శుక్రవారం").as_deref(), Some("2026-11-20")); assert_eq!(d("शुक्रवार तक").as_deref(), Some("2026-11-20")); assert_eq!(d("on Tuesday").as_deref(), Some("2026-11-24"), "the meeting's own weekday is the next one"); assert_eq!(d("on the 25th").as_deref(), Some("2026-11-25")); assert_eq!(d("on the 3rd").as_deref(), Some("2026-12-03")); assert_eq!(d("by 2 December").as_deref(), Some("2026-12-02")); assert_eq!(d("by December 2nd").as_deref(), Some("2026-12-02")); assert_eq!(d("by 10 January").as_deref(), Some("2027-01-10")); assert_eq!(d("2026-12-01").as_deref(), Some("2026-12-01")); assert_eq!(d("this week"), None); assert_eq!(d("the first week of December"), None); assert_eq!(d("soon"), None); } /// RULE (meetings-summaries, 17 Nov 2026): The parts' actions are one list: a task said twice by the same owner is kept once, the first telling, with a day a later telling gave. #[test] fn a_task_said_twice_is_one_action() { let a = |words: &str, who: Option<&str>, due: Option<&str>| Action { words: words.into(), who: who.map(str::to_string), due: due.map(str::to_string), due_said: due.map(|_| "by Friday".into()), at_ms: None }; let got = one_list(vec![ a("Get three quotes from movers", Some("S2"), None), a("Triage the oldest fifty tickets", Some("S3"), None), a("Get three quotes from the movers", Some("S2"), Some("2026-11-20")), a("Get three quotes from movers", Some("S1"), None), ]); assert_eq!(got.len(), 3); assert_eq!(got[0].words, "Get three quotes from movers"); assert_eq!(got[0].due.as_deref(), Some("2026-11-20")); assert_eq!(got[2].who.as_deref(), Some("S1"), "another owner is another task"); } /// RULE (meetings-summaries, 17 Nov 2026): The meeting row's summary is one markdown point a line, each ending on a whole sentence, and its actions one to do a line with the owner's name and the day after it where they were said. #[test] fn the_rows_text_columns() { assert_eq!(summary_text(&["The quote is split in two phases.".into(), " ".into(), "The offsite is in town.".into()]), "- The quote is split in two phases.\n- The offsite is in town."); assert_eq!(summary_text(&["S3 will draft the newsletter. The party stays as it is. The smaller version of the lease,".into()]), "- S3 will draft the newsletter. The party stays as it is.", "a point cut mid-sentence ends on its last whole one"); assert_eq!(summary_text(&["No full stop at all".into()]), "- No full stop at all"); let actions = vec![ Action { words: "Send the revised quote".into(), who: Some("S2".into()), due: Some("2026-11-19".into()), due_said: Some("by Thursday".into()), at_ms: Some(0) }, Action { words: "Update the onboarding doc".into(), who: Some("S3".into()), due: None, due_said: Some("this week".into()), at_ms: None }, Action { words: "Send the logo files".into(), who: Some("Dana".into()), due: None, due_said: None, at_ms: None }, Action { words: "Look at the slow search".into(), who: None, due: None, due_said: None, at_ms: None }, ]; assert_eq!( actions_text(&actions, &voices()), "Send the revised quote — Ben (S2), by Thu 19 Nov\nUpdate the onboarding doc — S3, this week\nSend the logo files — Dana\nLook at the slow search" ); } /// RULE (meetings-summaries, 17 Nov 2026): A summary holds at most ten points and one part's notes at most eight, each a sentence (at most 240 characters; a task at most 120): the answer's schema caps them, so a long meeting's summary stays a summary. #[test] fn the_schemas_cap_the_points() { assert_eq!(part_schema()["properties"]["summary"]["maxItems"], 8); assert_eq!(merge_schema()["properties"]["summary"]["maxItems"], 10); assert_eq!(merge_schema()["properties"]["summary"]["items"]["maxLength"], 240, "a point is a sentence, not the rest run on"); assert_eq!(part_schema()["properties"]["actions"]["items"]["properties"]["words"]["maxLength"], 120); assert_eq!(part_schema()["properties"]["actions"]["items"]["required"], serde_json::json!(["words", "who", "due_said", "line"])); } /// RULE: the model's question is its template filled once: a transcript line or a title that holds `{unit}` or `{about}` reaches the model as said, never read again as a placeholder. #[test] fn a_prompt_fills_its_template_once() { let part = Part { index: 1, first: 12, last: 30, text: "12 [00:01] S1: we {unit} ship {about} by friday".into() }; let one = part_prompt(Some(" An {which} sync "), &part, 1); assert!(one.starts_with("The meeting is called \"An {which} sync\".\nEach line is: line number"), "{one}"); assert!(one.contains("S1: we {unit} ship {about} by friday") && one.contains("the main points of this meeting,"), "{one}"); let third = part_prompt(None, &part, 3); assert!(third.starts_with("This is part 2 of 3 of the transcript (lines 12 to 30).\n"), "{third}"); assert!(third.contains("the main points of this part,"), "{third}"); let merged = merge_prompt(Some(""), &[vec![" a point {body} ".into()]]); assert!(merged.starts_with("These are the notes of a long meeting") && merged.contains("Part 1:\n- a point {body}\n\nAnswer with JSON"), "{merged}"); assert!(SYSTEM.starts_with("You write the notes") && !SYSTEM.ends_with('\n')); } /// RULE (owner, 23 Nov 2026: Cotton has no model of its own): a summary his own assistant writes back is laid out as /// the Mac's local model's is: one point a line, one to-do a line with who and the day, each task once, and the /// actions already added to his to-dos not made again. #[test] fn an_assistants_summary_lands_as_the_macs_does() { let input = serde_json::json!({ "points": ["The walk is on Saturday.", " They meet at the boathouse. "], "actions": [ { "words": "Book the boat", "who": "S2", "due": "2026-11-28" }, { "words": "Book the boat for Saturday", "who": "S2" }, { "words": "Bring the flask", "who": "S1", "due_said": "before Saturday" }, { "words": " " } ], "voices": [{ "label": "S1" }, { "label": "S2", "name": "Chitra Invented" }], "kept": [{ "words": "Bring the flask", "who": "S1" }] }); let out = crate::boundary::call("meetings.summary.land", &input.to_string()).unwrap(); assert_eq!(out["summary"], "- The walk is on Saturday.\n- They meet at the boathouse."); assert_eq!(out["actions"], "Book the boat — Chitra Invented (S2), by Sat 28 Nov\nBring the flask — S1, before Saturday"); let fresh: Vec<&str> = out["fresh"].as_array().unwrap().iter().map(|a| a["words"].as_str().unwrap()).collect(); assert_eq!(fresh, ["Book the boat"]); }