From d0884a999c8bdbce39f3b6caa6e41a230065867f Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2026 21:38:49 +0100 Subject: [PATCH 01/15] =?UTF-8?q?Start=20D130=20=E2=80=94=20Formats=20are?= =?UTF-8?q?=20managed:=20made,=20duplicated,=20renamed,=20changed,=20delet?= =?UTF-8?q?ed=20=E2=80=94=20the=20built-in=20ones=20hidden=20only=20?= =?UTF-8?q?=E2=80=94,=20one=20the=20default,=20one=20chosen=20in=20=C2=AB?= =?UTF-8?q?=20Refaire=20=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Session: da9226c3-d369-4ef3-93c4-bca2b7179a8b From 42278c1e75ab3b8a78d98c0d0350ed5ee1344ecd Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2026 21:42:56 +0100 Subject: [PATCH 02/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20the=20formats?= =?UTF-8?q?'=20oracle,=20red=20=E2=80=94=20made,=20duplicated,=20renamed,?= =?UTF-8?q?=20changed,=20deleted;=20the=20six=20built=20in=20hidden=20only?= =?UTF-8?q?;=20one=20the=20default;=20summarising/v1's=20--format=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/formats.rs, before src/formats.rs exists: the store of a person's formats and the file kitokey-summary reads. The screen follows D123's tabs. Agent-Session: da9226c3-d369-4ef3-93c4-bca2b7179a8b Co-Authored-By: Claude Opus 5.5 --- modules/shell/tests/formats.rs | 179 +++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 modules/shell/tests/formats.rs diff --git a/modules/shell/tests/formats.rs b/modules/shell/tests/formats.rs new file mode 100644 index 000000000..0642eaeee --- /dev/null +++ b/modules/shell/tests/formats.rs @@ -0,0 +1,179 @@ +//! D130: the formats a person manages — made, duplicated, renamed, changed, deleted; the six built +//! in hidden and shown again, never changed nor deleted; one the default — and the file +//! `summarising/v1`'s `--format` reads, written from one. Names and words here are made up. + +use kitokey_shell::formats::{self, BUILT_IN, Format, Formats, Refused, Section}; + +fn section(title: &str, about: &str) -> Section { + Section { + title: title.into(), + about: about.into(), + } +} + +fn weekly() -> Vec
{ + vec![ + section("Contexte", "Où en est le client, en deux phrases"), + section("Demandes", "Ce que le client a demandé, une ligne chacune"), + section("Prochaines étapes", "Qui fait quoi, pour quand"), + ] +} + +#[test] +fn the_six_built_in_are_offered_first_general_the_default_and_none_of_the_persons() { + let formats = Formats::default(); + assert_eq!( + BUILT_IN, + ["general", "one_to_one", "stand_up", "client_call", "interview", "project_review"] + ); + assert_eq!(formats.shown(), BUILT_IN.to_vec()); + assert_eq!(formats.default, "general"); + assert!(formats.own.is_empty()); +} + +#[test] +fn a_format_made_is_kept_under_a_name_of_its_own_offered_after_the_built_in() { + let mut formats = Formats::default(); + let made = formats.made("Point client hebdo", weekly(), Some(2)).unwrap(); + // Its structure, as the minutes write it: the name in [a-z0-9_], its marks taken off. + assert_eq!(made, "point_client_hebdo"); + assert_eq!(formats.shown().last(), Some(&"point_client_hebdo")); + let kept = formats.own("point_client_hebdo").unwrap(); + assert_eq!(kept.name, "Point client hebdo"); + assert_eq!(kept.sections, weekly()); + assert_eq!(kept.actions, Some(2)); + // A second of the same name is refused, whatever its case or spaces; one whose structure would + // be taken gets one of its own. + assert_eq!(formats.made(" point CLIENT hebdo ", weekly(), None), Err(Refused::NameTaken)); + assert_eq!(formats.made("Point client hébdo", weekly(), None).unwrap(), "point_client_hebdo_2"); + // A name that would be a built-in's structure never takes it. + assert_eq!(formats.made("General", weekly(), None).unwrap(), "general_2"); + // A name with no letter of [a-z0-9] still gets one. + assert_eq!(formats.made("週報", weekly(), None).unwrap(), "format"); +} + +#[test] +fn a_format_is_refused_outside_minutes_v5_s_bounds() { + let mut formats = Formats::default(); + let long = "é".repeat(201); + let cases: Vec<(&str, Vec
, Option, Refused)> = vec![ + ("", weekly(), None, Refused::Name), + (" ", weekly(), None, Refused::Name), + ("a\nb", weekly(), None, Refused::Name), + (&"x".repeat(41), weekly(), None, Refused::Name), + ("Vide", vec![], None, Refused::Sections), + ("Sept", (0..7).map(|n| section(&format!("S{n}"), "x")).collect(), None, Refused::Sections), + ("Sans titre", vec![section(" ", "x")], None, Refused::Section(0)), + ("Titre long", vec![section(&"t".repeat(41), "x")], None, Refused::Section(0)), + ("Sans contenu", vec![section("A", "x"), section("B", "")], None, Refused::Section(1)), + ("Deux lignes", vec![section("A", "x\ny")], None, Refused::Section(0)), + ("Trop long", vec![section("A", &long)], None, Refused::Section(0)), + // Two titles that would be one section's id. + ("Deux fois", vec![section("Suites", "x"), section("suites", "y")], None, Refused::Section(1)), + ("Actions", weekly(), Some(3), Refused::Actions), + ]; + for (name, sections, actions, why) in cases { + assert_eq!(formats.made(name, sections, actions), Err(why), "{name:?}"); + } + assert!(formats.own.is_empty()); + // 200 characters, counted as characters, are within. + assert!(formats.made("Long", vec![section("A", &"é".repeat(200))], None).is_ok()); +} + +#[test] +fn a_format_is_duplicated_renamed_changed_and_deleted_its_structure_kept() { + let mut formats = Formats::default(); + let made = formats.made("Point client", weekly(), Some(2)).unwrap(); + let copy = formats.own(&made).unwrap().clone(); + let twin = formats.duplicated(©, "Point client (copie)").unwrap(); + assert_eq!(twin, "point_client_copie"); + assert_eq!(formats.own(&twin).unwrap().sections, weekly()); + + // Renamed: its name, never its structure — the minutes already written still name it. + formats.renamed(&made, "Le point du lundi").unwrap(); + assert_eq!(formats.own(&made).unwrap().name, "Le point du lundi"); + assert_eq!(formats.renamed(&made, "Point client (copie)"), Err(Refused::NameTaken)); + assert_eq!(formats.renamed(&made, ""), Err(Refused::Name)); + + // Changed: its sections and the one holding the actions, bounded as when made. + let fewer = vec![section("Notes", "Tout ce qui a été dit d'important")]; + formats.changed(&made, fewer.clone(), None).unwrap(); + assert_eq!(formats.own(&made).unwrap().sections, fewer); + assert_eq!(formats.own(&made).unwrap().actions, None); + assert_eq!(formats.changed(&made, vec![], None), Err(Refused::Sections)); + assert_eq!(formats.own(&made).unwrap().sections, fewer); + + formats.deleted(&made).unwrap(); + assert!(formats.own(&made).is_none()); + assert_eq!(formats.deleted(&made), Err(Refused::Unknown)); +} + +#[test] +fn a_built_in_is_hidden_and_shown_again_never_changed_renamed_nor_deleted() { + let mut formats = Formats::default(); + formats.hide("interview", true).unwrap(); + assert!(!formats.shown().contains(&"interview")); + formats.hide("interview", false).unwrap(); + assert_eq!(formats.shown(), BUILT_IN.to_vec()); + for built in BUILT_IN { + assert_eq!(formats.renamed(built, "Autre"), Err(Refused::BuiltIn)); + assert_eq!(formats.changed(built, weekly(), None), Err(Refused::BuiltIn)); + assert_eq!(formats.deleted(built), Err(Refused::BuiltIn)); + } + // A person's own format is deleted, not hidden. + let made = formats.made("Point", weekly(), None).unwrap(); + assert_eq!(formats.hide(&made, true), Err(Refused::NotBuiltIn)); + assert_eq!(formats.hide("unknown", true), Err(Refused::Unknown)); +} + +#[test] +fn one_is_the_default_always_one_offered() { + let mut formats = Formats::default(); + let made = formats.made("Point", weekly(), None).unwrap(); + formats.default_to(&made).unwrap(); + assert_eq!(formats.default, made); + // The default deleted, `general` is the default again. + formats.deleted(&made).unwrap(); + assert_eq!(formats.default, "general"); + // The default is never hidden, nor a hidden one the default. + assert_eq!(formats.hide("general", true), Err(Refused::Default)); + formats.hide("stand_up", true).unwrap(); + assert_eq!(formats.default_to("stand_up"), Err(Refused::Hidden)); + assert_eq!(formats.default_to("unknown"), Err(Refused::Unknown)); + // The default deleted while `general` is hidden: the first offered is. + let made = formats.made("Point", weekly(), None).unwrap(); + formats.default_to(&made).unwrap(); + formats.hide("general", true).unwrap(); + formats.deleted(&made).unwrap(); + assert_eq!(formats.default, "one_to_one"); +} + +#[test] +fn the_file_given_to_kitokey_summary_is_summarising_v1_s_format() { + let mut formats = Formats::default(); + let made = formats.made("Point client hebdo", weekly(), Some(2)).unwrap(); + let file = formats::file(formats.own(&made).unwrap()); + assert_eq!( + file, + serde_json::json!({ + "structure": "point_client_hebdo", + "sections": [ + { "id": "contexte", "about": "Où en est le client, en deux phrases" }, + { "id": "demandes", "about": "Ce que le client a demandé, une ligne chacune" }, + { "id": "prochaines_etapes", "about": "Qui fait quoi, pour quand" }, + ], + "actions": "prochaines_etapes", + }) + ); + // No actions: no key. A title with no letter of [a-z0-9] still gets an id, its place. + let other = Format { + structure: "notes".into(), + name: "Notes".into(), + sections: vec![section("要点", "x"), section("Autre", "y")], + actions: None, + }; + assert_eq!( + formats::file(&other), + serde_json::json!({ "structure": "notes", "sections": [{ "id": "section_1", "about": "x" }, { "id": "autre", "about": "y" }] }) + ); +} From 71da99583e37f14d44c3884fca02546b116e51c5 Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2026 21:45:21 +0100 Subject: [PATCH 03/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20formats.rs,?= =?UTF-8?q?=20the=20formats=20a=20person=20manages=20and=20the=20file=20--?= =?UTF-8?q?format=20reads?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The six built in hidden and shown again, never changed nor deleted; a person's own made, duplicated, renamed, changed, deleted within minutes/v5's bounds, its structure drawn from its first name and kept; one the default, never hidden. tests/formats.rs: 7 passed. Agent-Session: da9226c3-d369-4ef3-93c4-bca2b7179a8b Co-Authored-By: Claude Opus 5.5 --- modules/shell/src/formats.rs | 289 +++++++++++++++++++++++++++++++++ modules/shell/src/lib.rs | 1 + modules/shell/tests/formats.rs | 17 +- 3 files changed, 304 insertions(+), 3 deletions(-) create mode 100644 modules/shell/src/formats.rs diff --git a/modules/shell/src/formats.rs b/modules/shell/src/formats.rs new file mode 100644 index 000000000..c789d8f3f --- /dev/null +++ b/modules/shell/src/formats.rs @@ -0,0 +1,289 @@ +//! The formats a summary is written in (D130): the six `summarising/v1` builds in — hidden and shown +//! again, never changed nor deleted — and those a person made, each a name, its sections — a title +//! and what goes in it — and the one holding the actions. One is the default. They are kept in the +//! settings' file, never sent anywhere; `kitokey-summary` is given one as the file its `--format` +//! reads (`summarising/v1`'s `format.schema.json`), written by [`file`]. + +use serde_json::{Value, json}; + +/// The structures `summarising/v1` builds in, in the order they are offered (`minutes/v5`). +pub const BUILT_IN: [&str; 6] = ["general", "one_to_one", "stand_up", "client_call", "interview", "project_review"]; + +/// One section of a person's format: its title, as they read it in the editor, and what goes in +/// it, as they ask it of the model. Its id in the minutes is drawn from its title. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Section { + pub title: String, + pub about: String, +} + +/// A format a person made. Its structure is drawn from its first name and kept: renamed, the +/// minutes already written in it still name it. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Format { + pub structure: String, + pub name: String, + pub sections: Vec
, + /// The place of the section holding the actions; none, the format has none. + pub actions: Option, +} + +/// Why a change to the formats is not made. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Refused { + /// The name is empty, on two lines or longer than 40 characters. + Name, + /// Another format of the person's has that name. + NameTaken, + /// Not one to six sections. + Sections, + /// This section's title is empty, on two lines, longer than 40 characters or another's id; + /// or what goes in it is empty, on two lines or longer than 200 characters. + Section(usize), + /// The section holding the actions is not one of them. + Actions, + /// A built-in format is never renamed, changed nor deleted. + BuiltIn, + /// A person's format is deleted, never hidden. + NotBuiltIn, + /// No format of that structure. + Unknown, + /// The default is never hidden. + Default, + /// A hidden format is never the default. + Hidden, +} + +/// The formats: the person's own, the built-in ones they hid, and the default. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Formats { + pub own: Vec, + pub hidden: Vec, + pub default: String, +} + +impl Default for Formats { + fn default() -> Self { + Self { + own: Vec::new(), + hidden: Vec::new(), + default: BUILT_IN[0].into(), + } + } +} + +impl Formats { + /// The structures offered, in their order: the built-in ones not hidden, then the person's. + pub fn shown(&self) -> Vec<&str> { + BUILT_IN + .iter() + .copied() + .filter(|built| !self.hidden.iter().any(|hidden| hidden == built)) + .chain(self.own.iter().map(|format| format.structure.as_str())) + .collect() + } + + /// The person's format of that structure. + pub fn own(&self, structure: &str) -> Option<&Format> { + self.own.iter().find(|format| format.structure == structure) + } + + /// A format made, kept after the others: its structure. + pub fn made(&mut self, name: &str, sections: Vec
, actions: Option) -> Result { + let name = self.free_name(name, None)?; + checked(§ions, actions)?; + let structure = self.free_structure(&name); + self.own.push(Format { + structure: structure.clone(), + name, + sections, + actions, + }); + Ok(structure) + } + + /// A copy of a format — the person's or a built-in one, its sections in words — under a new name. + pub fn duplicated(&mut self, of: &Format, name: &str) -> Result { + self.made(name, of.sections.clone(), of.actions) + } + + pub fn renamed(&mut self, structure: &str, name: &str) -> Result<(), Refused> { + let at = self.at(structure)?; + self.own[at].name = self.free_name(name, Some(at))?; + Ok(()) + } + + pub fn changed(&mut self, structure: &str, sections: Vec
, actions: Option) -> Result<(), Refused> { + let at = self.at(structure)?; + checked(§ions, actions)?; + self.own[at].sections = sections; + self.own[at].actions = actions; + Ok(()) + } + + /// Deleted — once the person confirmed it, which is the screen's to ask (PDR-0008). The default + /// deleted, `general` is the default again, or the first offered when it is hidden. + pub fn deleted(&mut self, structure: &str) -> Result<(), Refused> { + let at = self.at(structure)?; + self.own.remove(at); + if self.default == structure { + let shown = self.shown(); + self.default = shown.first().copied().unwrap_or(BUILT_IN[0]).to_string(); + } + Ok(()) + } + + /// A built-in format hidden, or shown again. + pub fn hide(&mut self, structure: &str, hidden: bool) -> Result<(), Refused> { + if !BUILT_IN.contains(&structure) { + return Err(if self.own(structure).is_some() { + Refused::NotBuiltIn + } else { + Refused::Unknown + }); + } + if hidden && self.default == structure { + return Err(Refused::Default); + } + self.hidden.retain(|kept| kept != structure); + if hidden { + self.hidden.push(structure.into()); + } + Ok(()) + } + + pub fn default_to(&mut self, structure: &str) -> Result<(), Refused> { + if !BUILT_IN.contains(&structure) && self.own(structure).is_none() { + return Err(Refused::Unknown); + } + if self.hidden.iter().any(|hidden| hidden == structure) { + return Err(Refused::Hidden); + } + self.default = structure.into(); + Ok(()) + } + + /// The place of the person's format of that structure. + fn at(&self, structure: &str) -> Result { + if BUILT_IN.contains(&structure) { + return Err(Refused::BuiltIn); + } + self.own + .iter() + .position(|format| format.structure == structure) + .ok_or(Refused::Unknown) + } + + /// The name trimmed, when it is one and no other format of the person's has it, whatever its case. + fn free_name(&self, name: &str, besides: Option) -> Result { + let name = name.trim(); + if !one_line(name, 40) { + return Err(Refused::Name); + } + let taken = self + .own + .iter() + .enumerate() + .any(|(at, format)| Some(at) != besides && format.name.to_lowercase() == name.to_lowercase()); + if taken { + return Err(Refused::NameTaken); + } + Ok(name.to_string()) + } + + /// A structure drawn from the name that no format has: `_2`, `_3`… when it would be taken. + fn free_structure(&self, name: &str) -> String { + let drawn = match id_of(name) { + Some(drawn) => drawn, + None => "format".to_string(), + }; + let taken = |structure: &str| BUILT_IN.contains(&structure) || self.own(structure).is_some(); + if !taken(&drawn) { + return drawn; + } + (2..) + .map(|n| { + let end = format!("_{n}"); + let kept: String = drawn.chars().take(40 - end.len()).collect(); + format!("{}{end}", kept.trim_end_matches('_')) + }) + .find(|structure| !taken(structure)) + .expect("a free structure") + } +} + +/// The file `kitokey-summary --format` reads (`summarising/v1`'s `format.schema.json`). +pub fn file(format: &Format) -> Value { + let ids = ids(&format.sections); + let mut file = json!({ + "structure": format.structure, + "sections": format.sections.iter().zip(&ids).map(|(section, id)| json!({ "id": id, "about": section.about })).collect::>(), + }); + if let Some(id) = format.actions.and_then(|at| ids.get(at)) { + file["actions"] = json!(id); + } + file +} + +/// Each section's id: drawn from its title, its place when the title holds no letter of [a-z0-9]. +fn ids(sections: &[Section]) -> Vec { + sections + .iter() + .enumerate() + .map(|(at, section)| id_of(§ion.title).unwrap_or_else(|| format!("section_{}", at + 1))) + .collect() +} + +/// Within minutes/v5's bounds: one to six sections, each title and what goes in it on one line, +/// each id once, the actions one of them. +fn checked(sections: &[Section], actions: Option) -> Result<(), Refused> { + if sections.is_empty() || sections.len() > 6 { + return Err(Refused::Sections); + } + let ids = ids(sections); + for (at, section) in sections.iter().enumerate() { + let twice = ids[..at].contains(&ids[at]); + if !one_line(section.title.trim(), 40) || !one_line(§ion.about, 200) || twice { + return Err(Refused::Section(at)); + } + } + if actions.is_some_and(|at| at >= sections.len()) { + return Err(Refused::Actions); + } + Ok(()) +} + +/// Not empty, not blank, on one line, of at most so many characters. +fn one_line(text: &str, most: usize) -> bool { + !text.trim().is_empty() && !text.contains(['\n', '\r']) && text.chars().count() <= most +} + +/// The word in [a-z0-9_]{1,40}: lower case, the marks of Latin letters taken off, any other +/// character a `_`, none twice nor at an end. None when no letter of [a-z0-9] is left. +fn id_of(text: &str) -> Option { + let mut id = String::new(); + for character in text.to_lowercase().chars() { + let plain = match character { + 'a'..='z' | '0'..='9' => character.to_string(), + 'à' | 'á' | 'â' | 'ã' | 'ä' | 'å' => "a".into(), + 'ç' => "c".into(), + 'è' | 'é' | 'ê' | 'ë' => "e".into(), + 'ì' | 'í' | 'î' | 'ï' => "i".into(), + 'ñ' => "n".into(), + 'ò' | 'ó' | 'ô' | 'õ' | 'ö' | 'ø' => "o".into(), + 'ù' | 'ú' | 'û' | 'ü' => "u".into(), + 'ý' | 'ÿ' => "y".into(), + 'œ' => "oe".into(), + 'æ' => "ae".into(), + 'ß' => "ss".into(), + _ => "_".into(), + }; + if plain == "_" && (id.is_empty() || id.ends_with('_')) { + continue; + } + id.push_str(&plain); + } + let id: String = id.trim_end_matches('_').chars().take(40).collect(); + let id = id.trim_end_matches('_'); + (!id.is_empty()).then(|| id.to_string()) +} diff --git a/modules/shell/src/lib.rs b/modules/shell/src/lib.rs index e7c59a747..efa6570f3 100644 --- a/modules/shell/src/lib.rs +++ b/modules/shell/src/lib.rs @@ -14,6 +14,7 @@ pub mod engines; pub mod example; pub mod exporting; pub mod flac; +pub mod formats; pub mod keys; pub mod levels; pub mod licence; diff --git a/modules/shell/tests/formats.rs b/modules/shell/tests/formats.rs index 0642eaeee..8171e9dcb 100644 --- a/modules/shell/tests/formats.rs +++ b/modules/shell/tests/formats.rs @@ -56,20 +56,31 @@ fn a_format_made_is_kept_under_a_name_of_its_own_offered_after_the_built_in() { fn a_format_is_refused_outside_minutes_v5_s_bounds() { let mut formats = Formats::default(); let long = "é".repeat(201); + let long_name = "x".repeat(41); let cases: Vec<(&str, Vec
, Option, Refused)> = vec![ ("", weekly(), None, Refused::Name), (" ", weekly(), None, Refused::Name), ("a\nb", weekly(), None, Refused::Name), - (&"x".repeat(41), weekly(), None, Refused::Name), + (&long_name, weekly(), None, Refused::Name), ("Vide", vec![], None, Refused::Sections), - ("Sept", (0..7).map(|n| section(&format!("S{n}"), "x")).collect(), None, Refused::Sections), + ( + "Sept", + (0..7).map(|n| section(&format!("S{n}"), "x")).collect(), + None, + Refused::Sections, + ), ("Sans titre", vec![section(" ", "x")], None, Refused::Section(0)), ("Titre long", vec![section(&"t".repeat(41), "x")], None, Refused::Section(0)), ("Sans contenu", vec![section("A", "x"), section("B", "")], None, Refused::Section(1)), ("Deux lignes", vec![section("A", "x\ny")], None, Refused::Section(0)), ("Trop long", vec![section("A", &long)], None, Refused::Section(0)), // Two titles that would be one section's id. - ("Deux fois", vec![section("Suites", "x"), section("suites", "y")], None, Refused::Section(1)), + ( + "Deux fois", + vec![section("Suites", "x"), section("suites", "y")], + None, + Refused::Section(1), + ), ("Actions", weekly(), Some(3), Refused::Actions), ]; for (name, sections, actions, why) in cases { From 254e949f78ca68f3d5b898caf2357599ae551f48 Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2026 21:47:00 +0100 Subject: [PATCH 04/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20the=20formats?= =?UTF-8?q?=20kept=20in=20the=20settings'=20file,=20read=20back=20as=20the?= =?UTF-8?q?y=20were?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit formats, formats_hidden and format_default, written as the destinations are; one written by hand outside its bounds left aside, the rest read; only a built-in hidden, the default one offered. tests/formats.rs: 9 passed. Agent-Session: da9226c3-d369-4ef3-93c4-bca2b7179a8b Co-Authored-By: Claude Opus 5.5 --- modules/shell/src/formats.rs | 36 ++++++++++++++++- modules/shell/src/settings.rs | 59 +++++++++++++++++++++++++++- modules/shell/tests/formats.rs | 71 ++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 3 deletions(-) diff --git a/modules/shell/src/formats.rs b/modules/shell/src/formats.rs index c789d8f3f..97405ccd1 100644 --- a/modules/shell/src/formats.rs +++ b/modules/shell/src/formats.rs @@ -11,7 +11,7 @@ pub const BUILT_IN: [&str; 6] = ["general", "one_to_one", "stand_up", "client_ca /// One section of a person's format: its title, as they read it in the editor, and what goes in /// it, as they ask it of the model. Its id in the minutes is drawn from its title. -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)] pub struct Section { pub title: String, pub about: String, @@ -19,12 +19,13 @@ pub struct Section { /// A format a person made. Its structure is drawn from its first name and kept: renamed, the /// minutes already written in it still name it. -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize)] pub struct Format { pub structure: String, pub name: String, pub sections: Vec
, /// The place of the section holding the actions; none, the format has none. + #[serde(default)] pub actions: Option, } @@ -73,6 +74,37 @@ impl Default for Formats { } impl Formats { + /// The formats as the settings' file holds them: each kept as it would have been made, once by + /// its structure and its name; one written by hand otherwise is left aside. Only a built-in one + /// is hidden, and the default is one offered — `general`, or the first, otherwise. + pub fn kept(own: Vec, hidden: Vec, default: Option) -> Self { + let mut formats = Self::default(); + for format in own { + let structure_free = id_of(&format.structure).as_deref() == Some(format.structure.as_str()) + && !BUILT_IN.contains(&format.structure.as_str()) + && formats.own(&format.structure).is_none(); + if let (true, Ok(name), Ok(())) = ( + structure_free, + formats.free_name(&format.name, None), + checked(&format.sections, format.actions), + ) { + formats.own.push(Format { name, ..format }); + } + } + for built in hidden { + if BUILT_IN.contains(&built.as_str()) && !formats.hidden.contains(&built) { + formats.hidden.push(built); + } + } + let shown = formats.shown(); + formats.default = match default { + Some(default) if shown.contains(&default.as_str()) => default, + _ if shown.contains(&BUILT_IN[0]) => BUILT_IN[0].into(), + _ => shown.first().copied().unwrap_or(BUILT_IN[0]).into(), + }; + formats + } + /// The structures offered, in their order: the built-in ones not hidden, then the person's. pub fn shown(&self) -> Vec<&str> { BUILT_IN diff --git a/modules/shell/src/settings.rs b/modules/shell/src/settings.rs index 8d1d47ba1..0ac9301fa 100644 --- a/modules/shell/src/settings.rs +++ b/modules/shell/src/settings.rs @@ -167,6 +167,8 @@ pub struct Settings { /// Where a summary can be sent (D110): each by its name and kind, its address shown only as its /// host and the end of its path — the address itself is in the keyring, never here. pub destinations: Vec, + /// The formats a summary is written in (D130): the person's own, the built-in ones hidden, the default. + pub formats: crate::formats::Formats, } /// The model a transcript is heard with when the settings name none (ADR-0003). @@ -205,6 +207,7 @@ impl Default for Settings { microphone: None, microphone_description: None, destinations: Vec::new(), + formats: crate::formats::Formats::default(), } } } @@ -296,6 +299,9 @@ struct Written { microphone: Option, microphone_description: Option, destinations: Option>, + formats: Option>, + formats_hidden: Option>, + format_default: Option, } /// What in a settings file Kitokey refuses, as the user is told it (#783): which setting, on which @@ -329,7 +335,7 @@ impl std::fmt::Display for Unread { } /// The keys a settings file may hold: those a refusal names. -const KEYS: [&str; 28] = [ +const KEYS: [&str; 31] = [ "reminder", "sessions", "export", @@ -358,6 +364,9 @@ const KEYS: [&str; 28] = [ "microphone", "microphone_description", "destinations", + "formats", + "formats_hidden", + "format_default", ]; /// Reads the settings. No file is no choice made: the defaults. A file that cannot be read as @@ -439,6 +448,11 @@ pub fn read(path: &Path) -> Result { settings.destinations.push(crate::destinations::Destination { name, ..destination }); } } + settings.formats = crate::formats::Formats::kept( + written.formats.unwrap_or_default(), + written.formats_hidden.unwrap_or_default(), + written.format_default, + ); settings.minutes_agreed = written.minutes_agreed.filter(|named| !named.trim().is_empty()); settings.transcription_provider = written.transcription_provider.filter(|named| !named.trim().is_empty()); settings.transcription_model = written.transcription_model.filter(|named| !named.trim().is_empty()); @@ -627,6 +641,46 @@ pub fn write(path: &Path, settings: &Settings) -> io::Result<()> { document["destinations"] = Item::ArrayOfTables(tables); } } + if settings.formats != before.formats { + let formats = &settings.formats; + if formats.own.is_empty() { + document.remove("formats"); + } else { + let mut tables = toml_edit::ArrayOfTables::new(); + for format in &formats.own { + let mut table = toml_edit::Table::new(); + table["structure"] = toml_edit::value(format.structure.as_str()); + table["name"] = toml_edit::value(format.name.as_str()); + if let Some(actions) = format.actions { + table["actions"] = toml_edit::value(actions as i64); + } + let mut sections = toml_edit::Array::new(); + for section in &format.sections { + let mut inline = toml_edit::InlineTable::new(); + inline.insert("title", section.title.as_str().into()); + inline.insert("about", section.about.as_str().into()); + sections.push(inline); + } + table["sections"] = toml_edit::value(sections); + tables.push(table); + } + document["formats"] = Item::ArrayOfTables(tables); + } + if formats.hidden.is_empty() { + document.remove("formats_hidden"); + } else { + set( + &mut document, + "formats_hidden", + Value::Array(formats.hidden.iter().map(String::as_str).collect()), + ); + } + if formats.default == crate::formats::BUILT_IN[0] { + document.remove("format_default"); + } else { + set(&mut document, "format_default", Value::from(formats.default.as_str())); + } + } // Said by `after` now, once `after` is written: the key it replaced would contradict it. if document.contains_key("after") { document.remove("transcript"); @@ -691,6 +745,9 @@ mod tests { microphone, microphone_description, destinations, + formats, + formats_hidden, + format_default, ); let mut keys = KEYS; fields.sort_unstable(); diff --git a/modules/shell/tests/formats.rs b/modules/shell/tests/formats.rs index 8171e9dcb..6efdc4fe2 100644 --- a/modules/shell/tests/formats.rs +++ b/modules/shell/tests/formats.rs @@ -188,3 +188,74 @@ fn the_file_given_to_kitokey_summary_is_summarising_v1_s_format() { serde_json::json!({ "structure": "notes", "sections": [{ "id": "section_1", "about": "x" }, { "id": "autre", "about": "y" }] }) ); } + +#[test] +fn the_formats_are_kept_in_the_settings_file_and_read_back_as_they_were() { + let folder = tempfile::tempdir().unwrap(); + let path = folder.path().join("settings.toml"); + let mut settings = kitokey_shell::settings::Settings::default(); + assert_eq!(settings.formats, Formats::default()); + let made = settings.formats.made("Point client hebdo", weekly(), Some(2)).unwrap(); + settings.formats.made("Notes", vec![section("Notes", "Tout")], None).unwrap(); + settings.formats.default_to(&made).unwrap(); + settings.formats.hide("interview", true).unwrap(); + kitokey_shell::settings::write(&path, &settings).unwrap(); + assert_eq!(kitokey_shell::settings::read(&path).unwrap().formats, settings.formats); + // Deleted, it is gone from the file. + settings.formats.deleted(&made).unwrap(); + kitokey_shell::settings::write(&path, &settings).unwrap(); + let text = std::fs::read_to_string(&path).unwrap(); + assert!(!text.contains("point_client_hebdo"), "{text}"); + assert_eq!(kitokey_shell::settings::read(&path).unwrap().formats, settings.formats); +} + +#[test] +fn a_format_written_by_hand_outside_its_bounds_is_left_aside_the_rest_read() { + let folder = tempfile::tempdir().unwrap(); + let path = folder.path().join("settings.toml"); + std::fs::write( + &path, + r#"format_default = "interview" +formats_hidden = ["interview", "one_to_one", "made_up"] + +[[formats]] +structure = "point" +name = "Point" +actions = 0 +sections = [{ title = "Suites", about = "Qui, quoi, quand" }] + +[[formats]] +structure = "point" +name = "Le même" +sections = [{ title = "A", about = "x" }] + +[[formats]] +structure = "general" +name = "Pris" +sections = [{ title = "A", about = "x" }] + +[[formats]] +structure = "Capitales" +name = "Capitales" +sections = [{ title = "A", about = "x" }] + +[[formats]] +structure = "vide" +name = "Vide" +sections = [] + +[[formats]] +structure = "actions" +name = "Actions" +actions = 4 +sections = [{ title = "A", about = "x" }] +"#, + ) + .unwrap(); + let formats = kitokey_shell::settings::read(&path).unwrap().formats; + assert_eq!(formats.own.iter().map(|f| f.structure.as_str()).collect::>(), ["point"]); + assert_eq!(formats.own[0].actions, Some(0)); + // Only a built-in is hidden; the default, never: the one written is hidden, so `general` is. + assert_eq!(formats.hidden, ["interview", "one_to_one"]); + assert_eq!(formats.default, "general"); +} From b92618d212c067464aacf18872544e81b7cff5cd Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2026 21:49:03 +0100 Subject: [PATCH 05/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20kitokey-summa?= =?UTF-8?q?ry=20given=20the=20format=20chosen=20=E2=80=94=20none=20for=20g?= =?UTF-8?q?eneral,=20--structure,=20--format=20and=20its=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit formats::argument and Summarising::start_as; start as before. tests/formats.rs 10 passed, tests/summarising.rs 9 passed. Agent-Session: da9226c3-d369-4ef3-93c4-bca2b7179a8b Co-Authored-By: Claude Opus 5.5 --- modules/shell/src/formats.rs | 19 +++++++++++++++++++ modules/shell/src/summarising.rs | 13 +++++++++++++ modules/shell/tests/formats.rs | 29 +++++++++++++++++++++++++++++ modules/shell/tests/summarising.rs | 18 ++++++++++++++++++ 4 files changed, 79 insertions(+) diff --git a/modules/shell/src/formats.rs b/modules/shell/src/formats.rs index 97405ccd1..f7a459dec 100644 --- a/modules/shell/src/formats.rs +++ b/modules/shell/src/formats.rs @@ -244,6 +244,25 @@ impl Formats { } } +/// What `kitokey-summary` is given after its model for the format of that structure: nothing for +/// `general` — `minutes/v4`, its sections the same —, `--structure` and its name for another built-in +/// one, `--format` and its file for a person's own, written in `folder` as [`file`] says. One +/// deleted or hidden since it was chosen: the default. +pub fn argument(formats: &Formats, structure: &str, folder: &std::path::Path) -> std::io::Result> { + let offered = formats.shown().contains(&structure); + let structure = if offered { structure } else { formats.default.as_str() }; + if structure == BUILT_IN[0] { + return Ok(Vec::new()); + } + let Some(format) = formats.own(structure) else { + return Ok(vec!["--structure".into(), structure.into()]); + }; + std::fs::create_dir_all(folder)?; + let path = folder.join(format!("{structure}.json")); + std::fs::write(&path, file(format).to_string())?; + Ok(vec!["--format".into(), path.to_string_lossy().into_owned()]) +} + /// The file `kitokey-summary --format` reads (`summarising/v1`'s `format.schema.json`). pub fn file(format: &Format) -> Value { let ids = ids(&format.sections); diff --git a/modules/shell/src/summarising.rs b/modules/shell/src/summarising.rs index 7a6e51f52..c42c53b6c 100644 --- a/modules/shell/src/summarising.rs +++ b/modules/shell/src/summarising.rs @@ -91,12 +91,25 @@ impl Summarising { /// Starts `kitokey-summary` on a session's folder. The key goes to its environment only — a /// key in Kitokey's own environment never does. pub fn start(program: &Path, folder: &Path, provider: &str, model: &str, key: Option<&str>) -> io::Result<(Self, Receiver)> { + Self::start_as(program, folder, provider, model, key, &[]) + } + + /// The same, in the format chosen (D130): what `formats::argument` gives, after the model. + pub fn start_as( + program: &Path, + folder: &Path, + provider: &str, + model: &str, + key: Option<&str>, + shape: &[String], + ) -> io::Result<(Self, Receiver)> { let (trace, making) = crate::log::making(); let _making = making.enter(); let mut command = Command::new(program); command .arg(folder) .args(["--provider", provider, "--model", model]) + .args(shape) .env("KITOKEY_TRACE", &trace); let host = crate::providers::host(provider).unwrap_or_default(); info!(session = %crate::transcription::named(folder), host, model, key = key.is_some(), "shell.minutes"); diff --git a/modules/shell/tests/formats.rs b/modules/shell/tests/formats.rs index 6efdc4fe2..7da8f59f3 100644 --- a/modules/shell/tests/formats.rs +++ b/modules/shell/tests/formats.rs @@ -259,3 +259,32 @@ sections = [{ title = "A", about = "x" }] assert_eq!(formats.hidden, ["interview", "one_to_one"]); assert_eq!(formats.default, "general"); } + +#[test] +fn kitokey_summary_is_given_the_format_chosen_as_summarising_v1_says() { + let folder = tempfile::tempdir().unwrap(); + let mut formats = Formats::default(); + let made = formats.made("Point client hebdo", weekly(), Some(2)).unwrap(); + // `general`: no structure, as before — minutes/v4, its sections the same. + assert!(formats::argument(&formats, "general", folder.path()).unwrap().is_empty()); + // Another built-in: its name. + assert_eq!( + formats::argument(&formats, "stand_up", folder.path()).unwrap(), + ["--structure", "stand_up"] + ); + // A person's own: the file --format reads, written in the formats' folder. + let given = formats::argument(&formats, &made, folder.path()).unwrap(); + let file = folder.path().join("point_client_hebdo.json"); + assert_eq!(given, ["--format".to_string(), file.to_string_lossy().into_owned()]); + let written: serde_json::Value = serde_json::from_str(&std::fs::read_to_string(&file).unwrap()).unwrap(); + assert_eq!(written, formats::file(formats.own(&made).unwrap())); + // One deleted, or hidden, since it was chosen: the default. + formats.default_to("client_call").unwrap(); + formats.hide("interview", true).unwrap(); + for gone in ["interview", "deleted_since"] { + assert_eq!( + formats::argument(&formats, gone, folder.path()).unwrap(), + ["--structure", "client_call"] + ); + } +} diff --git a/modules/shell/tests/summarising.rs b/modules/shell/tests/summarising.rs index c2a126995..42a0b9976 100644 --- a/modules/shell/tests/summarising.rs +++ b/modules/shell/tests/summarising.rs @@ -262,3 +262,21 @@ fn cancelled_minutes_end_within_two_seconds_with_what_they_started_the_minutes_t assert!(gone(&stat), "its child still runs a second after its making ended: {stat}"); assert_eq!(fs::read_to_string(&minutes).unwrap(), "the minutes before"); } + +#[test] +fn the_format_chosen_is_given_after_the_model() { + let _held = ONE_AT_A_TIME.lock().unwrap_or_else(|poisoned| poisoned.into_inner()); + let folder = session(); + let path = folder.path().join("kitokey-summary"); + fs::write( + &path, + "#!/bin/sh\n[ \"$6\" = --structure ] && [ \"$7\" = stand_up ] && [ $# = 7 ] || exit 9\necho '## A' > \"$1/minutes.md\"\necho '{\"event\":\"written\",\"file\":\"x\"}'\n", + ) + .unwrap(); + fs::set_permissions(&path, fs::Permissions::from_mode(0o755)).unwrap(); + let shape = ["--structure".to_string(), "stand_up".to_string()]; + let (_making, events) = + Summarising::start_as(&path, &folder.path().join("session"), "http://127.0.0.1:9/v1", "m", None, &shape).unwrap(); + let ended = std::iter::from_fn(|| events.recv_timeout(Duration::from_secs(10)).ok()).find(|event| matches!(event, Event::Ended(_))); + assert_eq!(ended, Some(Event::Ended(Made::Written(folder.path().join("session")))), "{ended:?}"); +} From e49820734de7143015a27a24eba64c6530ae38f1 Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2026 21:57:08 +0100 Subject: [PATCH 06/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20Refaire=20off?= =?UTF-8?q?ers=20the=20formats,=20the=20default=20marked;=20the=20summary?= =?UTF-8?q?=20names=20its=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit formats_offered; minutes_redo takes the format chosen, for that making alone, else Settings' default; Minutes::structure read from v5's front matter; the six names, the list's label, the default's mark and the line in words.rs. Agent-Session: da9226c3-d369-4ef3-93c4-bca2b7179a8b Co-Authored-By: Claude Opus 5.5 --- modules/shell/src/main.rs | 70 ++++++++++++++++++++++++++++++---- modules/shell/src/minutes.rs | 4 ++ modules/shell/src/words.rs | 28 ++++++++++++++ modules/shell/tests/minutes.rs | 16 ++++++++ modules/shell/tests/silence.rs | 5 +++ modules/shell/ui/window.js | 43 ++++++++++++++++++++- 6 files changed, 156 insertions(+), 10 deletions(-) diff --git a/modules/shell/src/main.rs b/modules/shell/src/main.rs index 40ff1e8ed..e1242fc34 100644 --- a/modules/shell/src/main.rs +++ b/modules/shell/src/main.rs @@ -30,7 +30,7 @@ use kitokey_shell::microphone; use kitokey_shell::{ autostart, confidential::{self, Left, Wait, What}, - context, correction, dates, desktop, engines, example, exporting, keys, + context, correction, dates, desktop, engines, example, exporting, formats, keys, licence::{self, Licence}, log, meeting::{self, Read, Transcript}, @@ -146,6 +146,9 @@ struct Shell { /// The model each meeting's last minutes were asked with, when one was named (a Refaire…): /// tried again, with that one (D25). minutes_tried: Mutex>>, + /// The format a *Refaire…* chose for its meeting (D130), its structure: that making alone; + /// none, Settings' default. + format_chosen: Mutex>, /// The sessions whose transcripts wait for the one being made, or for the model — in /// the order they were asked, each once; made again as a *Refaire…* asked (D25, D59). waiting: Mutex, Cancel)>>, @@ -411,6 +414,7 @@ fn main() { busy_meetings, freed, minutes_redo, + formats_offered, making_cancelled, context_shown, context_saved, @@ -581,6 +585,7 @@ fn main() { served: Mutex::new(None), minutes_made: Mutex::new(HashMap::new()), minutes_tried: Mutex::new(HashMap::new()), + format_chosen: Mutex::new(HashMap::new()), asked_again: Mutex::new(HashMap::new()), waiting: Mutex::new(VecDeque::new()), examples: Mutex::default(), @@ -1260,8 +1265,14 @@ fn minutes_redo( name: String, provider: Option, model: Option, + format: Option, ) -> Result<(), Told> { let folder = session_folder(&shell, &name)?; + // The format chosen in its dialog, for this making (D130); none, Settings' default. + match format { + Some(format) => shell.format_chosen.lock().unwrap().insert(folder.clone(), format), + None => shell.format_chosen.lock().unwrap().remove(&folder), + }; // The settings' model, as they name it now, when none is chosen: still a redo, which waits // its turn behind the meeting's own making — never taken for a second first one. let chosen = match provider.zip(model) { @@ -1275,6 +1286,37 @@ fn minutes_redo( Ok(()) } +/// A format as *Refaire…* offers it and the summary's line names it (D130): its structure, a +/// person's own name — a built-in one is named by the page's words —, and whether it is the default. +#[derive(serde::Serialize)] +struct FormatOffered { + structure: String, + name: Option, + default: bool, + shown: bool, +} + +/// The formats: those offered in Settings' order, then the built-in ones hidden — a summary written +/// in one still names it. +#[tauri::command] +fn formats_offered(shell: State<'_, Shell>) -> Vec { + let formats = shell.settings().formats; + let shown = formats.shown(); + let hidden = formats::BUILT_IN.iter().copied().filter(|built| !shown.contains(built)); + shown + .iter() + .copied() + .map(|structure| (structure, true)) + .chain(hidden.map(|structure| (structure, false))) + .map(|(structure, offered)| FormatOffered { + structure: structure.into(), + name: formats.own(structure).map(|format| format.name.clone()), + default: formats.default == structure, + shown: offered, + }) + .collect() +} + /// « Annuler » on a meeting's page (D92, the decider's word of 2026-11-13): what is being made of /// it — its transcript, its minutes — ends within two seconds, and what waits its turn leaves the /// line. The version already whole stays; the user may at once start another making. @@ -4384,6 +4426,7 @@ fn write_minutes_from( shell.stopped.lock().unwrap().remove(&folder); minuting(app, true); let app = app.clone(); + let formats = settings.formats.clone(); // The keyring may ask the user first: never on the window's and the tray's thread. std::thread::spawn(move || { let shell = app.state::(); @@ -4412,13 +4455,24 @@ fn write_minutes_from( // Cancelled while the keyring was asked: never started (D92). Err(std::io::Error::other("cancelled")) } else { - Summarising::start( - &program("kitokey-summary", "KITOKEY_SUMMARY"), - &folder, - &provider, - &model, - key.as_deref(), - ) + // In the format chosen for it, else Settings' default (D130): its file, when it is a + // person's own, written beside the settings. + let chosen = shell.format_chosen.lock().unwrap().remove(&folder); + let structure = chosen.unwrap_or_else(|| formats.default.clone()); + let beside = settings::file().and_then(|file| file.parent().map(|folder| folder.join("formats"))); + beside + .ok_or_else(|| std::io::Error::other("this system names no folder for settings")) + .and_then(|beside| formats::argument(&formats, &structure, &beside)) + .and_then(|shape| { + Summarising::start_as( + &program("kitokey-summary", "KITOKEY_SUMMARY"), + &folder, + &provider, + &model, + key.as_deref(), + &shape, + ) + }) }; let events = match started { Ok((making, events)) => { diff --git a/modules/shell/src/minutes.rs b/modules/shell/src/minutes.rs index 0ee3881d1..b5b2dbd7d 100644 --- a/modules/shell/src/minutes.rs +++ b/modules/shell/src/minutes.rs @@ -40,6 +40,9 @@ pub struct Minutes { /// Which section holds the actions, counted from one: v1 to v4's second, v5's whose id its /// `actions` names (D111), none when it names none. The page reads its actions there alone. pub actions: Option, + /// The format they were written in, as `minutes/v5`'s front matter names it (D130); v1 to v4 + /// name none. + pub structure: Option, } /// The minutes of a session's folder, their three sections named as the page names them. @@ -401,5 +404,6 @@ fn parse_minutes(text: &str, sections: [&str; 3], by_id: &[(&str, &str)]) -> Opt body: html, markdown, actions, + structure: if fifth { field("structure") } else { None }, }) } diff --git a/modules/shell/src/words.rs b/modules/shell/src/words.rs index e3aded3b1..2d23ef6d2 100644 --- a/modules/shell/src/words.rs +++ b/modules/shell/src/words.rs @@ -1497,6 +1497,19 @@ pub struct Window { /// Shows: a meeting's page, its Redo… panel, as a help line. When: current minutes go to trash /// once new ones are ready. At most: no limit. Placeholders: none. pub redo_note: &'static str, + /// The formats a summary is written in (D130): the six built in, in `formats::BUILT_IN`'s order. + /// Shows: Redo…'s list of formats, and the summary's line naming its format. When: a built-in + /// format is offered or named. At most: about 20 characters. Placeholders: none. + pub format_names: [&'static str; 6], + /// Shows: a meeting's page, its Redo… panel, as the label of the list of formats. When: redo the + /// minutes. At most: about 12 characters. Placeholders: none. + pub redo_format: &'static str, + /// Shows: Redo…'s list of formats, as a choice. When: the format Settings name the default. + /// At most: about 30 characters. Placeholders: {} the format's name. + pub format_default: &'static str, + /// Shows: a meeting's page, the summary's line of provenance, after who wrote it. When: the + /// minutes name their format. At most: about 30 characters. Placeholders: {} the format's name. + pub minutes_format: &'static str, /// Shows: the summary's redo panel, its one button that starts, naming the making and its model /// (D96): « Refaire le compte rendu avec Qwen3 14b ». When: a summary model is known, the meeting's, /// the one chosen in « Avancé » or Settings'; else `redo_title`. At most: wraps inside the panel. @@ -2436,6 +2449,10 @@ pub fn window(language: Language) -> Window { redo: "Redo…", redo_title: "Write the summary again", redo_with: "Uses this meeting’s models (choose them under “Advanced”).", + format_names: ["General", "One-to-one", "Stand-up", "Client call", "Interview", "Project review"], + redo_format: "Format", + format_default: "{} (default)", + minutes_format: "{} format", redo_note: "The current summary stays in place until the new one is ready, then goes to the trash.", redo_minutes_do: "Write the summary again with {}", redo_transcript_do: "Write the transcript again with {}", @@ -2988,6 +3005,17 @@ pub fn window(language: Language) -> Window { redo: "Refaire…", redo_title: "Refaire le compte rendu", redo_with: "Refait avec les modèles de cette réunion (à choisir dans «\u{a0}Avancé\u{a0}»).", + format_names: [ + "Général", + "Point individuel", + "Point d’équipe", + "Appel client", + "Entretien", + "Revue de projet", + ], + redo_format: "Format", + format_default: "{} (par défaut)", + minutes_format: "Format «\u{a0}{}\u{a0}»", redo_note: "Le compte rendu actuel reste en place tant que le nouveau n’est pas prêt, et se retrouve ensuite dans la corbeille.", redo_minutes_do: "Refaire le compte rendu avec {}", redo_transcript_do: "Refaire la transcription avec {}", diff --git a/modules/shell/tests/minutes.rs b/modules/shell/tests/minutes.rs index 9cb9854e4..890478328 100644 --- a/modules/shell/tests/minutes.rs +++ b/modules/shell/tests/minutes.rs @@ -705,3 +705,19 @@ fn an_about_of_200_characters_is_within_its_bounds() { "200 characters is the most, not too many" ); } + +/// D130: the format the minutes were written in, as v5's front matter names it — the summary's +/// line of provenance says it; v1 to v4 name none. +#[test] +fn minutes_v5_say_their_structure_and_earlier_ones_none() { + let Read::Present(minutes) = read_v5(&v5_example()) else { + panic!("v5's own example not read") + }; + assert_eq!(minutes.structure.as_deref(), Some("project_review")); + let own = v5_example().replace("structure: project_review", "structure: point_client_hebdo"); + let Read::Present(minutes) = read_v5(&own) else { + panic!("not read: {own}") + }; + assert_eq!(minutes.structure.as_deref(), Some("point_client_hebdo")); + assert_eq!(present(&third("", "- a", "- d")).structure, None); +} diff --git a/modules/shell/tests/silence.rs b/modules/shell/tests/silence.rs index bc7858638..fbaf3f605 100644 --- a/modules/shell/tests/silence.rs +++ b/modules/shell/tests/silence.rs @@ -29,6 +29,11 @@ const SILENT: &[(&str, usize, &str)] = &[ "an addition to the redo list (D96): not read, Settings' models and this computer's are still offered; a service that does not answer is logged by the shell", ), ("makings", 2, "returns no `Result`: it cannot fail"), + ( + "formats_offered", + 2, + "returns no `Result`: it cannot fail — Refaire's list and the summary's format named (D130)", + ), ( "dates_file_chosen", 1, diff --git a/modules/shell/ui/window.js b/modules/shell/ui/window.js index 63de529b3..9e5032503 100644 --- a/modules/shell/ui/window.js +++ b/modules/shell/ui/window.js @@ -1930,9 +1930,38 @@ function redoWith(offered, session, words, button, id, title, notes, again, step return closes(panel, go, button, words); } +// The six formats built in, in `formats::BUILT_IN`'s order: named by the page's words (D130). +const BUILT_IN = ["general", "one_to_one", "stand_up", "client_call", "interview", "project_review"]; + +// A format as a person reads it: a built-in one by the page's words, their own by its name. +function formatSaid(words, format) { + const built = BUILT_IN.indexOf(format.structure); + return built >= 0 ? words.format_names[built] : format.name ?? format.structure; +} + +// *Refaire…*'s formats (D130): those offered, the default marked and chosen; the choice for that +// making alone. +function formatPick(words) { + const row = element("label", "models-row"); + row.htmlFor = "redo-format"; + const pick = element("select"); + pick.id = "redo-format"; + row.append(element("span", "name", words.redo_format), pick); + window.__TAURI__.core.invoke("formats_offered").then((formats) => { + for (const format of formats.filter((format) => format.shown)) { + const option = element("option", "", format.default ? fill(words.format_default, formatSaid(words, format)) : formatSaid(words, format)); + option.value = format.structure; + option.selected = format.default; + pick.append(option); + } + }, () => {}); + return [row, () => pick.value || null]; +} + function redoPanel(offered, session, words, button) { - return redoWith(offered, session, words, button, "redo-panel", words.redo_title, [element("p", "says", words.redo_note)], () => - window.__TAURI__.core.invoke("minutes_redo", { name: nameOf(session), provider: null, model: null }), "minutes", words.redo_minutes_do); + const [row, chosen] = formatPick(words); + return redoWith(offered, session, words, button, "redo-panel", words.redo_title, [row, element("p", "says", words.redo_note)], () => + window.__TAURI__.core.invoke("minutes_redo", { name: nameOf(session), provider: null, model: null, format: chosen() }), "minutes", words.redo_minutes_do); } function redoTranscriptPanel(offered, session, words, button, corrected) { @@ -2457,6 +2486,16 @@ function minutesCard(read, words, session, transcript, onPage, previous, otherVe const [pick, said] = modelOnPage(onPage, words, "minutes", version, go, words.redo_minutes_do, words.redo_title, box); card.append(lineWith(maker, pick), said, box); } else card.append(element("p", "maker", maker)); + // The format they were written in, named (D130): v5 names it; v1 to v4, none. + if (read.structure) { + const named = element("p", "says", ""); + named.id = "minutes-format"; + card.append(named); + window.__TAURI__.core.invoke("formats_offered").then((formats) => { + const format = formats.find((format) => format.structure === read.structure) ?? { structure: read.structure }; + named.textContent = fill(words.minutes_format, formatSaid(words, format)); + }, () => {}); + } // A language model wrote them, said where they are read (Store Policies 11.16, #1092). const written = element("p", "note", words.minutes_ai); written.id = "minutes-ai"; From c0094cbfafcab459d9b58d51a350644885b3cbf5 Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2026 22:00:15 +0100 Subject: [PATCH 07/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20the=20e2e's?= =?UTF-8?q?=20CW=20=E2=80=94=20Refaire=20offers=20the=20formats,=20the=20d?= =?UTF-8?q?efault=20marked;=20the=20summary=20written=20in=20the=20one=20c?= =?UTF-8?q?hosen=20names=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The summary's stand-in writes minutes/v5 in the format --format gives it. Agent-Session: da9226c3-d369-4ef3-93c4-bca2b7179a8b Co-Authored-By: Claude Opus 5.5 --- modules/shell/scripts/e2e_window.py | 77 +++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/modules/shell/scripts/e2e_window.py b/modules/shell/scripts/e2e_window.py index b62c9d480..e1d9c8296 100644 --- a/modules/shell/scripts/e2e_window.py +++ b/modules/shell/scripts/e2e_window.py @@ -76,6 +76,8 @@ printf '%s' "$context" > "$here/summary-context" echo '{"event": "sending", "host": "h", "model": "m", "characters": 1}' named=""; [ -n "$STANDIN" ] && named="provider: $provider\\n" + # A format given (D130): minutes/v5 in it, as the real one writes them — its file's structure and sections. + [ "$6" = --format ] && { python3 -c "$FIFTH" "$1" "$7" "$5"; echo '{"event": "written", "file": "x"}'; exit 0; } printf -- "---\\ncontract: minutes/v1\\n${named}model: %s\\ncontext: %s\\n---\\n\\n## A\\n\\n## B\\n\\n## C\\n" "$5" "$context" > "$1/minutes.md" echo '{"event": "written", "file": "x"}' exit 0 @@ -188,6 +190,15 @@ "import json, pathlib, sys; f = pathlib.Path(sys.argv[1], 'context.txt'); " "t = f.read_text().strip() if f.exists() else ''; print(json.dumps(t or None, ensure_ascii=False))" ) +# minutes/v5 in the format a file of `--format` holds (D130): its structure, its sections, a title each. +os.environ["FIFTH"] = ( + "import json, pathlib, sys; f = json.loads(pathlib.Path(sys.argv[2]).read_text()); " + "front = ['contract: minutes/v5', 'made: 2026-11-27T10:00:00+01:00', 'provider: \"local\"', 'model: ' + json.dumps(sys.argv[3])," + " 'context: null', 'structure: ' + f['structure'], 'sections: ' + json.dumps(f['sections'], ensure_ascii=False)]" + " + (['actions: ' + f['actions']] if 'actions' in f else []); " + "body = ''.join(f'## {s[\"id\"]}\\n\\n- x\\n\\n' for s in f['sections']); " + "pathlib.Path(sys.argv[1], 'minutes.md').write_text('---\\n' + '\\n'.join(front) + '\\n---\\n\\n' + body)" +) # The host of a provider's address, and a request sent to a stand-in service, for the two above. os.environ["HOST"] = "import sys, urllib.parse; print(urllib.parse.urlsplit(sys.argv[1]).hostname)" os.environ["SEND"] = "import sys, urllib.request; urllib.request.urlopen(urllib.request.Request(sys.argv[1], data=b'x', method='POST'), timeout=5)" @@ -14098,6 +14109,71 @@ def log_message(self, *_): tags.shutdown() +def formats_redone(now: dt.datetime) -> None: + """CW. D130: Refaire… offers the formats — the six built in by their names, a person's own after them, + the default marked and chosen —; the summary is written in the one chosen, through summarising/v1's + `--structure` or `--format`, and its line names it. The summary is the stand-in's.""" + print("CW. Refaire… offers the formats, the default marked; the summary written in the one chosen names it (D130)") + meetings = WORK / "formats-redone" + meeting = meetings / "2026-11-27_09-00" + session(meeting, now - dt.timedelta(days=1), 10, {"local.wav": 1000}) + (meeting / "transcript.jsonl").write_text( + '{"type":"header","contract":"transcript/v1","engine":"whisper.cpp","model":"m","language":null,"context":null}\n' + '{"type":"segment","speaker":"me","track":"local","start":0.0,"end":1.0,"text":"Bonjour."}\n{"type":"complete","duration":1.0}\n') + (meeting / "minutes.md").write_text( + "---\ncontract: minutes/v1\nmade: 2026-11-27T10:00:00+01:00\nprovider: local\nmodel: m\ncontext: null\n---\n\n" + "## 1.\n\nLe point.\n\n## 2.\n\n- Rien\n\n## 3.\n\n- Rien\n") + kept = ('reminder = false\nminutes_provider = "http://127.0.0.1:9/v1"\nminutes_model = "m"\nformat_default = "point_client"\n' + 'formats_hidden = ["interview"]\n\n[[formats]]\nstructure = "point_client"\nname = "Point client"\nactions = 1\n' + 'sections = [{ title = "Contexte", about = "Où en est le client" }, { title = "Suites", about = "Qui fait quoi, pour quand" }]\n') + window = Window(meetings, "fr_FR.UTF-8", kept) + args = WORK / "summary-args" + offered = ("const p = document.getElementById('redo-format');" + " return p ? [...p.options].map((o) => [o.value, o.textContent, o.selected]) : []") + redone = lambda browser, value: ( + press(browser, "redo-minutes"), + wait_for(browser, lambda b: len(b.execute_script(offered)) == 6, 5), + Select(browser.find_element(By.ID, "redo-format")).select_by_value(value) if value else None, + args.unlink(missing_ok=True), + press(browser, "redo-do"), + wait_for(None, lambda b: args.exists(), 15), + wait_for(browser, lambda b: b.execute_script(idle), 15)) + idle = ("return window.__TAURI__.core.invoke('makings').then(m => m.transcript === null && m.minutes === null" + " && m.transcripts_waiting.length === 0 && m.minutes_waiting.length === 0)") + with window as browser: + browser.execute_script(f"location.hash = '#/meeting/{meeting.name}'") + wait_for(browser, lambda b: b.find_elements(By.ID, "redo-minutes"), 10) + press(browser, "redo-minutes") + listed = wait_for(browser, lambda b: len(b.execute_script(offered)) == 6, 5) and browser.execute_script(offered) + check("Refaire… offers the built-in formats by their names, interview hidden, the person's own after; its default marked and chosen", + listed == [["general", "Général", False], ["one_to_one", "Point individuel", False], ["stand_up", "Point d’équipe", False], + ["client_call", "Appel client", False], ["project_review", "Revue de projet", False], + ["point_client", "Point client (par défaut)", True]], listed) + shot(browser, "cw-redo-formats") + press(browser, "redo-panel-cancel") + redone(browser, None) + given = args.read_text().split() + file = window.file.parent / "formats" / "point_client.json" + written = json.loads(file.read_text()) if file.exists() else None + check("the default, a person's own: kitokey-summary given --format and its file, summarising/v1's format", + given[-2:] == ["--format", str(file)] and written == {"structure": "point_client", "sections": [ + {"id": "contexte", "about": "Où en est le client"}, {"id": "suites", "about": "Qui fait quoi, pour quand"}], "actions": "suites"}, + (given, written)) + browser.execute_script("location.hash = '#/'") + browser.execute_script(f"location.hash = '#/meeting/{meeting.name}'") + named = wait_for(browser, lambda b: b.execute_script("return document.getElementById('minutes-format')?.textContent") + == "Format\u00a0«\u00a0Point client\u00a0»", 10) + check("the summary written in it names its format on its line", + named, browser.execute_script("return document.getElementById('minutes-format')?.textContent")) + shot(browser, "cw-minutes-format") + redone(browser, "stand_up") + given = args.read_text().split() + check("another built-in chosen: --structure and its name, for that making", given[-2:] == ["--structure", "stand_up"], given) + redone(browser, "general") + given = args.read_text().split() + check("Général chosen: no structure, as before (minutes/v4)", "--structure" not in given and "--format" not in given, given) + + def bar_offers_no_engine_nor_language(now: dt.datetime) -> None: """CV. D125: the compact bar offers no engine and no language — at rest and while it records, its options hold the context and the microphone under one disclosure, never « Avancé »'s models (D91, @@ -15963,6 +16039,7 @@ def aside(folder): bar_window(now) bar_opened(now) bar_offers_no_engine_nor_language(now) + formats_redone(now) engine_cards_drawn(now) bar_after_stop(now) summaries_to_a_folder(now) From 419c75a7f8b3bdc61601857ac4d3b05c4ffbe355 Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2026 22:01:08 +0100 Subject: [PATCH 08/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20the=20e2e's?= =?UTF-8?q?=20scenario=20is=20CZ,=20CW=20being=20sam's=20(#1308)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Session: da9226c3-d369-4ef3-93c4-bca2b7179a8b Co-Authored-By: Claude Opus 5.5 --- modules/shell/scripts/e2e_window.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/shell/scripts/e2e_window.py b/modules/shell/scripts/e2e_window.py index e1d9c8296..65d1aa22a 100644 --- a/modules/shell/scripts/e2e_window.py +++ b/modules/shell/scripts/e2e_window.py @@ -14110,10 +14110,10 @@ def log_message(self, *_): def formats_redone(now: dt.datetime) -> None: - """CW. D130: Refaire… offers the formats — the six built in by their names, a person's own after them, + """CZ. D130: Refaire… offers the formats — the six built in by their names, a person's own after them, the default marked and chosen —; the summary is written in the one chosen, through summarising/v1's `--structure` or `--format`, and its line names it. The summary is the stand-in's.""" - print("CW. Refaire… offers the formats, the default marked; the summary written in the one chosen names it (D130)") + print("CZ. Refaire… offers the formats, the default marked; the summary written in the one chosen names it (D130)") meetings = WORK / "formats-redone" meeting = meetings / "2026-11-27_09-00" session(meeting, now - dt.timedelta(days=1), 10, {"local.wav": 1000}) @@ -14149,7 +14149,7 @@ def formats_redone(now: dt.datetime) -> None: listed == [["general", "Général", False], ["one_to_one", "Point individuel", False], ["stand_up", "Point d’équipe", False], ["client_call", "Appel client", False], ["project_review", "Revue de projet", False], ["point_client", "Point client (par défaut)", True]], listed) - shot(browser, "cw-redo-formats") + shot(browser, "cz-redo-formats") press(browser, "redo-panel-cancel") redone(browser, None) given = args.read_text().split() @@ -14165,7 +14165,7 @@ def formats_redone(now: dt.datetime) -> None: == "Format\u00a0«\u00a0Point client\u00a0»", 10) check("the summary written in it names its format on its line", named, browser.execute_script("return document.getElementById('minutes-format')?.textContent")) - shot(browser, "cw-minutes-format") + shot(browser, "cz-minutes-format") redone(browser, "stand_up") given = args.read_text().split() check("another built-in chosen: --structure and its name, for that making", given[-2:] == ["--structure", "stand_up"], given) From 18debb187b8d7c63611bf9f3ac2118947d524910 Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2026 23:06:57 +0100 Subject: [PATCH 09/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20CZ=20expects?= =?UTF-8?q?=20the=20line=20as=20words.rs=20says=20it,=20a=20plain=20space?= =?UTF-8?q?=20before=20=C2=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Session: da9226c3-d369-4ef3-93c4-bca2b7179a8b Co-Authored-By: Claude Opus 5.5 --- modules/shell/scripts/e2e_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/shell/scripts/e2e_window.py b/modules/shell/scripts/e2e_window.py index 65d1aa22a..cacbd94ac 100644 --- a/modules/shell/scripts/e2e_window.py +++ b/modules/shell/scripts/e2e_window.py @@ -14162,7 +14162,7 @@ def formats_redone(now: dt.datetime) -> None: browser.execute_script("location.hash = '#/'") browser.execute_script(f"location.hash = '#/meeting/{meeting.name}'") named = wait_for(browser, lambda b: b.execute_script("return document.getElementById('minutes-format')?.textContent") - == "Format\u00a0«\u00a0Point client\u00a0»", 10) + == "Format «\u00a0Point client\u00a0»", 10) check("the summary written in it names its format on its line", named, browser.execute_script("return document.getElementById('minutes-format')?.textContent")) shot(browser, "cz-minutes-format") From df1941b39f4573db4e4790fddbf3dd6bc98e4aa8 Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Sat, 28 Nov 2026 07:46:20 +0100 Subject: [PATCH 10/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20CZ,=20no=20em?= =?UTF-8?q?pty=20list=20when=20the=20formats=20are=20unread,=20no=20line?= =?UTF-8?q?=20for=20a=20format=20deleted=20since;=20the=20page's=20BUILT?= =?UTF-8?q?=5FIN=20as=20formats.rs's?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lina's three points on #1340, their oracles, red: the « Format » row shown empty when formats_offered fails; a v5 summary in a format deleted since named by its id; nothing tied window.js's BUILT_IN to formats::BUILT_IN (the test guards it, seen red on the two first swapped). Agent-Session: b9c1bafa-f4f1-4a3a-ad04-6eecce28bd6c Co-Authored-By: Claude Opus 5.5 --- modules/shell/scripts/e2e_window.py | 22 ++++++++++++++++++++++ modules/shell/tests/formats.rs | 13 +++++++++++++ 2 files changed, 35 insertions(+) diff --git a/modules/shell/scripts/e2e_window.py b/modules/shell/scripts/e2e_window.py index ea5d9b452..360db5ab3 100644 --- a/modules/shell/scripts/e2e_window.py +++ b/modules/shell/scripts/e2e_window.py @@ -14687,6 +14687,28 @@ def formats_redone(now: dt.datetime) -> None: redone(browser, "general") given = args.read_text().split() check("Général chosen: no structure, as before (minutes/v4)", "--structure" not in given and "--format" not in given, given) + # lina's points 1 and 2 on #1340: no list when the formats cannot be read — the making then in the default —, + # and no line for minutes written in a format the person deleted since, never its id. + browser.execute_script("const c = window.__TAURI__.core, real = c.invoke;" + " c.invoke = (command, args) => command === 'formats_offered' ? Promise.reject('read') : real(command, args)") + press(browser, "redo-minutes") + time.sleep(1) + row = browser.execute_script("const p = document.getElementById('redo-format'); return p && p.closest('label').getClientRects().length > 0") + check("the formats unread: Refaire… shows no empty « Format » list", row is False, row) + press(browser, "redo-panel-cancel") + gone = meetings / "2026-11-27_11-00" + session(gone, now - dt.timedelta(hours=20), 10, {"local.wav": 1000}) + (gone / "transcript.jsonl").write_text((meeting / "transcript.jsonl").read_text()) + (gone / "minutes.md").write_text( + "---\ncontract: minutes/v5\nmade: 2026-11-27T12:00:00+01:00\nprovider: \"local\"\nmodel: \"m\"\ncontext: null\n" + 'structure: point_ancien\nsections: [{"id": "contexte", "about": "Le contexte"}]\n---\n\n## Contexte\n\nLe point.\n') + browser.execute_script("location.reload()") + wait_for(browser, lambda b: b.find_elements(By.ID, "redo-minutes"), 10) + browser.execute_script(f"location.hash = '#/meeting/{gone.name}'") + wait_for(browser, lambda b: b.execute_script("return document.querySelectorAll('#meeting .minutes .body h2').length === 1"), 10) + time.sleep(1) + line = browser.execute_script("return document.getElementById('minutes-format')?.textContent ?? null") + check("minutes in a format deleted since: no line naming it, never its id", line is None, line) def bar_offers_no_engine_nor_language(now: dt.datetime) -> None: diff --git a/modules/shell/tests/formats.rs b/modules/shell/tests/formats.rs index 5f717015b..9a52ab425 100644 --- a/modules/shell/tests/formats.rs +++ b/modules/shell/tests/formats.rs @@ -370,3 +370,16 @@ fn kitokey_summary_is_given_the_format_chosen_as_summarising_v1_says() { ); } } + +/// lina's point 3 on #1340: the page names the built-in formats in `formats::BUILT_IN`'s order, its own copy +/// the same — `words.format_names` follows that order. +#[test] +fn the_page_lists_the_built_in_formats_as_formats_rs_does() { + let page = include_str!("../ui/window.js"); + let line = page + .lines() + .find(|line| line.starts_with("const BUILT_IN = [")) + .expect("window.js's BUILT_IN"); + let listed: Vec<&str> = line.split('"').skip(1).step_by(2).collect(); + assert_eq!(listed, formats::BUILT_IN); +} From 5442f1c4176168d0a28decfef3df3a450b437523 Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Sat, 28 Nov 2026 07:48:55 +0100 Subject: [PATCH 11/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20no=20=C2=AB?= =?UTF-8?q?=20Format=20=C2=BB=20list=20until=20one=20is=20read,=20no=20lin?= =?UTF-8?q?e=20for=20a=20format=20deleted=20since?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lina's points 1 and 2 on #1340: the row shown once formats_offered gives at least one (none read: the making in the default, as before); the summary's line shown once its format is known, removed otherwise — never a structure's id said to the person. Agent-Session: b9c1bafa-f4f1-4a3a-ad04-6eecce28bd6c Co-Authored-By: Claude Opus 5.5 --- modules/shell/ui/window.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/shell/ui/window.js b/modules/shell/ui/window.js index 45179a883..a6346b31e 100644 --- a/modules/shell/ui/window.js +++ b/modules/shell/ui/window.js @@ -2021,10 +2021,11 @@ function formatSaid(words, format) { } // *Refaire…*'s formats (D130): those offered, the default marked and chosen; the choice for that -// making alone. +// making alone. None read: no list, the making in the default. function formatPick(words) { const row = element("label", "models-row"); row.htmlFor = "redo-format"; + row.hidden = true; const pick = element("select"); pick.id = "redo-format"; row.append(element("span", "name", words.redo_format), pick); @@ -2035,6 +2036,7 @@ function formatPick(words) { option.selected = format.default; pick.append(option); } + row.hidden = pick.options.length === 0; }, () => {}); return [row, () => pick.value || null]; } @@ -2567,15 +2569,18 @@ function minutesCard(read, words, session, transcript, onPage, previous, otherVe const [pick, said] = modelOnPage(onPage, words, "minutes", version, go, words.redo_minutes_do, words.redo_title, box); card.append(lineWith(maker, pick), said, box); } else card.append(element("p", "maker", maker)); - // The format they were written in, named (D130): v5 names it; v1 to v4, none. + // The format they were written in, named (D130): v5 names it; v1 to v4, none; one deleted since, none. if (read.structure) { const named = element("p", "says", ""); named.id = "minutes-format"; + named.hidden = true; card.append(named); window.__TAURI__.core.invoke("formats_offered").then((formats) => { - const format = formats.find((format) => format.structure === read.structure) ?? { structure: read.structure }; + const format = formats.find((format) => format.structure === read.structure); + if (!format) return named.remove(); named.textContent = fill(words.minutes_format, formatSaid(words, format)); - }, () => {}); + named.hidden = false; + }, () => named.remove()); } // A language model wrote them, said where they are read (Store Policies 11.16, #1092). const written = element("p", "note", words.minutes_ai); From b8498a876dd3fcb5a9e5e2d760487c31e8a0b6ac Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Sat, 28 Nov 2026 08:09:58 +0100 Subject: [PATCH 12/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20CZ=20makes=20?= =?UTF-8?q?the=20formats=20unreadable=20by=20replacing=20Tauri's=20frozen?= =?UTF-8?q?=20core,=20and=20checks=20it=20took?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wrapper set on `__TAURI__.core.invoke` was a no-op: Tauri 2.12.3 freezes `core` (bundle.global.js), so the check saw the list read and shown at the fix too. The object is replaced whole now, the page reading `window.__TAURI__.core` at each call, and CZ checks the replacement took before it judges the row. Agent-Session: b9c1bafa-f4f1-4a3a-ad04-6eecce28bd6c Co-Authored-By: Claude Opus 5.5 --- modules/shell/scripts/e2e_window.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/shell/scripts/e2e_window.py b/modules/shell/scripts/e2e_window.py index 360db5ab3..f27ee2cfa 100644 --- a/modules/shell/scripts/e2e_window.py +++ b/modules/shell/scripts/e2e_window.py @@ -14689,8 +14689,13 @@ def formats_redone(now: dt.datetime) -> None: check("Général chosen: no structure, as before (minutes/v4)", "--structure" not in given and "--format" not in given, given) # lina's points 1 and 2 on #1340: no list when the formats cannot be read — the making then in the default —, # and no line for minutes written in a format the person deleted since, never its id. - browser.execute_script("const c = window.__TAURI__.core, real = c.invoke;" - " c.invoke = (command, args) => command === 'formats_offered' ? Promise.reject('read') : real(command, args)") + # Tauri freezes `core` (its bundle.global.js): the whole object replaced, the page reading it at each call. + took = browser.execute_script( + "const t = window.__TAURI__, real = t.core.invoke;" + " window.__TAURI__ = { ...t, core: { ...t.core, invoke: (command, args) =>" + " command === 'formats_offered' ? Promise.reject('read') : real(command, args) } };" + " return window.__TAURI__.core.invoke !== real") + check("the formats made unreadable for this check", took is True, took) press(browser, "redo-minutes") time.sleep(1) row = browser.execute_script("const p = document.getElementById('redo-format'); return p && p.closest('label').getClientRects().length > 0") From 57bf9d591cf69afe1e70af438c61caae9876bbe4 Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2026 19:08:59 +0100 Subject: [PATCH 13/15] =?UTF-8?q?D130=20=E2=80=94=20shell:=20a=20format=20?= =?UTF-8?q?chosen=20in=20Refaire=20serves=20one=20making=20alone,=20held?= =?UTF-8?q?=20by=20tests/formats.rs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lina's mutant on #1340 (`.remove` → `.get` where a making takes the meeting's format) survived: nothing checked that the next making, started outside Refaire (the confidential switch, a model fetched), returns to Settings' default. The choice is now taken through `formats::for_making`, and tests/formats.rs checks it: the format chosen first, then the default, another meeting's choice kept. The behaviour is unchanged. Agent-Session: 577b2c59-0079-4edc-a825-c63a57ed052e Co-Authored-By: Claude Opus 5.5 --- modules/shell/src/formats.rs | 6 ++++++ modules/shell/src/main.rs | 3 +-- modules/shell/tests/formats.rs | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/shell/src/formats.rs b/modules/shell/src/formats.rs index 334c9b6fe..1bf59ffa9 100644 --- a/modules/shell/src/formats.rs +++ b/modules/shell/src/formats.rs @@ -252,6 +252,12 @@ impl Formats { } } +/// The format a making of the meeting in `folder` is written in: the one chosen for it in Refaire, taken +/// (it serves that making alone), else `default`, Settings' (D130). +pub fn for_making(chosen: &mut std::collections::HashMap, folder: &std::path::Path, default: &str) -> String { + chosen.remove(folder).unwrap_or_else(|| default.to_string()) +} + /// What `kitokey-summary` is given after its model for the format of that structure: nothing for /// `general` — `minutes/v4`, its sections the same —, `--structure` and its name for another built-in /// one, `--format` and its file for a person's own, written in `folder` as [`file`] says. One diff --git a/modules/shell/src/main.rs b/modules/shell/src/main.rs index 7652d4e3f..430d44eac 100644 --- a/modules/shell/src/main.rs +++ b/modules/shell/src/main.rs @@ -4597,8 +4597,7 @@ fn write_minutes_from( } else { // In the format chosen for it, else Settings' default (D130): its file, when it is a // person's own, written beside the settings. - let chosen = shell.format_chosen.lock().unwrap().remove(&folder); - let structure = chosen.unwrap_or_else(|| formats.default.clone()); + let structure = formats::for_making(&mut shell.format_chosen.lock().unwrap(), &folder, &formats.default); let beside = settings::file().and_then(|file| file.parent().map(|folder| folder.join("formats"))); beside .ok_or_else(|| std::io::Error::other("this system names no folder for settings")) diff --git a/modules/shell/tests/formats.rs b/modules/shell/tests/formats.rs index 9a52ab425..33e5ee20b 100644 --- a/modules/shell/tests/formats.rs +++ b/modules/shell/tests/formats.rs @@ -383,3 +383,22 @@ fn the_page_lists_the_built_in_formats_as_formats_rs_does() { let listed: Vec<&str> = line.split('"').skip(1).step_by(2).collect(); assert_eq!(listed, formats::BUILT_IN); } + +/// lina's mutant on #1340: a format chosen in Refaire serves that making alone. The next making of the +/// meeting, started elsewhere (the confidential switch, a model fetched for the meetings that waited), +/// is in Settings' default, never the format chosen once. +#[test] +fn a_format_chosen_in_refaire_serves_one_making_alone() { + let mut chosen = std::collections::HashMap::new(); + let folder = std::path::Path::new("meetings/2026-11-27_09-00"); + let other = std::path::Path::new("meetings/2026-11-27_11-00"); + chosen.insert(folder.to_path_buf(), "stand_up".to_string()); + chosen.insert(other.to_path_buf(), "interview".to_string()); + assert_eq!(formats::for_making(&mut chosen, folder, "point_client"), "stand_up"); + assert_eq!(formats::for_making(&mut chosen, folder, "point_client"), "point_client"); + assert_eq!( + chosen.get(other).map(String::as_str), + Some("interview"), + "another meeting's choice kept" + ); +} From 48682965e1d7be9cc35778e2d5f32cc3b59b9e6e Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2026 19:21:35 +0100 Subject: [PATCH 14/15] =?UTF-8?q?D130=20=E2=80=94=20shell=20e2e:=20DI=20ch?= =?UTF-8?q?ecks=20the=20format=20chosen=20in=20Refaire=20through=20the=20r?= =?UTF-8?q?eal=20making,=20not=20the=20helper=20alone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lina's point on #1340 at 57bf9d59: tests/formats.rs holds `formats::for_making`, not main.rs's path, and a `.get` written around the helper passed. DI now makes the summary again in Point d'équipe through Refaire. Its minutes are then said written by a service, and the confidential switch makes them again here, through write_minutes_from and an Ollama stand-in. That making must take Settings' default (`--format` and its file), never Point d'équipe. Agent-Session: 577b2c59-0079-4edc-a825-c63a57ed052e Co-Authored-By: Claude Opus 5.5 --- modules/shell/scripts/e2e_window.py | 37 ++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/modules/shell/scripts/e2e_window.py b/modules/shell/scripts/e2e_window.py index 30409246c..b95d77f8c 100644 --- a/modules/shell/scripts/e2e_window.py +++ b/modules/shell/scripts/e2e_window.py @@ -16490,7 +16490,23 @@ def formats_redone(now: dt.datetime) -> None: kept = ('reminder = false\nminutes_provider = "http://127.0.0.1:9/v1"\nminutes_model = "m"\nformat_default = "point_client"\n' 'formats_hidden = ["interview"]\n\n[[formats]]\nstructure = "point_client"\nname = "Point client"\nactions = 1\n' 'sections = [{ title = "Contexte", about = "Où en est le client" }, { title = "Suites", about = "Qui fait quoi, pour quand" }]\n') - window = Window(meetings, "fr_FR.UTF-8", kept) + # Ollama on this computer, its recommended model held: the making the confidential switch starts (D60). + class Ollama(http.server.BaseHTTPRequestHandler): + protocol_version = "HTTP/1.0" + + def do_GET(self): + body = json.dumps({"models": [{"name": "qwen3:8b"}]}).encode() + self.send_response(200) + self.send_header("content-length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + def log_message(self, *_): + pass + + ollama = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Ollama) + threading.Thread(target=ollama.serve_forever, daemon=True).start() + window = Window(meetings, "fr_FR.UTF-8", kept, ollama=f"http://127.0.0.1:{ollama.server_port}") args = WORK / "summary-args" offered = ("const p = document.getElementById('redo-format');" " return p ? [...p.options].map((o) => [o.value, o.textContent, o.selected]) : []") @@ -16565,6 +16581,25 @@ def formats_redone(now: dt.datetime) -> None: time.sleep(1) line = browser.execute_script("return document.getElementById('minutes-format')?.textContent ?? null") check("minutes in a format deleted since: no line naming it, never its id", line is None, line) + # lina's F4 on #1340: a format chosen in Refaire serves that making alone. The next one, started outside Refaire + # — the switch said confidential, its minutes a service's —, is in Settings' default, through write_minutes_from. + browser.execute_script(f"location.hash = '#/meeting/{meeting.name}'") + wait_for(browser, lambda b: b.find_elements(By.ID, "redo-open"), 10) + redone(browser, "stand_up") + chosen = args.read_text().split() + text = (meeting / "minutes.md").read_text() + # Its minutes said written by a service (the stand-in names none): the switch makes them again here. + text = re.sub(r"(?m)^provider: .*\n", "", text, count=1) + (meeting / "minutes.md").write_text(text.replace("---\n", '---\nprovider: "writes.example"\n', 1)) + args.unlink(missing_ok=True) + browser.execute_script("location.hash = '#/'") + browser.execute_script(f"location.hash = '#/meeting/{meeting.name}'") + wait_for(browser, lambda b: b.find_elements(By.ID, "confidential-switch"), 10) + press(browser, "confidential-switch") + made = wait_for(None, lambda b: args.exists(), 15) and args.read_text().split() + wait_for(browser, lambda b: b.execute_script(idle), 15) + check("Refaire in Point d’équipe, then made again here as the switch says confidential: Settings' default, its file, never Point d’équipe", + chosen[-2:] == ["--structure", "stand_up"] and made and made[-2:] == ["--format", str(file)], (chosen, made)) def settings_engine_cards(now: dt.datetime) -> None: From 704f21e7d131a887b7d157af4c16f287dbb92cc5 Mon Sep 17 00:00:00 2001 From: "kitokey-nora[bot]" <362019768+kitokey-nora[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2026 23:21:27 +0100 Subject: [PATCH 15/15] =?UTF-8?q?D130=20=E2=80=94=20shell=20e2e:=20focus?= =?UTF-8?q?=5Fswept=20counted=20at=20its=20measured=20~1060=20s,=20so=20it?= =?UTF-8?q?s=20shard=20holds=20it=20alone=20under=20the=20window's=201200?= =?UTF-8?q?=20s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Counted at 691 s, the shard planner gave focus_swept's shard 14 scenarios more: 1188 s measured of the 1200 s budget, and #1340's attest was cut twice in versions_kept. Replayed alone or in that exact sequence, versions_kept passes at 711445bd and d43ebc0d: no hang. With 1062.5, the 3 window shards measure 1061 / 957 / 902 s. Agent-Session: 58f81df5-60f9-4ae1-936d-f6c5dc099c8b Co-Authored-By: Claude Opus 5.5 --- modules/shell/scripts/e2e_times.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/shell/scripts/e2e_times.txt b/modules/shell/scripts/e2e_times.txt index fcd098622..a029760c6 100644 --- a/modules/shell/scripts/e2e_times.txt +++ b/modules/shell/scripts/e2e_times.txt @@ -55,7 +55,9 @@ axe_first_surfaces 14.9 bar_after_stop 40.4 ends_on_sigterm 7.0 focus_kept 40.2 -focus_swept 691.3 +# focus_swept measured again at 711445bd (e2e-history 20261130T214828): ~1060 s since 2026-11-30, not 691 s; counted at 691 s, +# its shard took 14 scenarios more, 1188 s of the window's 1200 s, and the attest was cut in versions_kept (#1340). +focus_swept 1062.5 key_kept_to_its_host 5.5 keys_first_surfaces 74.0 meeting_trashed 17.0