From 3a9db042dc24c3d65a38c05cbd8417448c3136d5 Mon Sep 17 00:00:00 2001 From: "kitokey-ines[bot]" <356215272+kitokey-ines[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2026 01:38:56 +0100 Subject: [PATCH 1/3] shell: 500 meetings of an hour made for the search's measure, and the search timed on them (D127 criterion 2) Agent-Session: cabe12ee-7978-42b1-82ad-5090c4cba137 Co-Authored-By: Claude Opus 5.5 --- modules/shell/scripts/meetings_made.py | 81 ++++++++++++++++++++++++++ modules/shell/tests/search_speed.rs | 47 +++++++++++++++ 2 files changed, 128 insertions(+) create mode 100755 modules/shell/scripts/meetings_made.py create mode 100644 modules/shell/tests/search_speed.rs diff --git a/modules/shell/scripts/meetings_made.py b/modules/shell/scripts/meetings_made.py new file mode 100755 index 00000000..6e4092a6 --- /dev/null +++ b/modules/shell/scripts/meetings_made.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +"""Meetings made for measuring the search (D127, criterion 2): COUNT folders of MINUTES each, as Kitokey writes +them — `session.json`, a whole `transcript.jsonl` of a line every few seconds, a `minutes.md` of `minutes/v4` —, +nothing of a real meeting. The same seed makes the same meetings, so two runs measure the same files. + +Words placed for the measure, each in known meetings and nowhere else: +- « devis » said in three transcripts (the 8th, the 251st and the 494th meetings), late in each: a rare word; +- « budget » in every summary: a word found everywhere; +- « zzqx », nowhere: every file read, nothing found. + +Usage: meetings_made.py FOLDER [--count 500] [--minutes 60] [--seed 127] +""" + +import argparse +import datetime as dt +import json +import random +from pathlib import Path + +# Words of a work meeting, none of the placed ones. +WORDS = ( + "projet équipe client semaine planning livraison réunion point suivi retour produit version fonction écran " + "utilisateur test bug correctif priorité sprint objectif chiffre vente marché contrat fournisseur délai date " + "lundi mardi mercredi jeudi vendredi matin soir demain hier rapport document présentation question réponse " + "idée proposition décision action tâche responsable groupe service support serveur données sécurité accès " + "compte facture paiement commande stock prix coût marge partenaire réseau formation recrutement poste" +).split() +PLACED = {7: "devis", 250: "devis", 493: "devis"} + + +def sentence(chance: random.Random) -> str: + words = [chance.choice(WORDS) for _ in range(chance.randint(6, 16))] + return (" ".join(words) + ".").capitalize() + + +def meeting(folder: Path, at: int, started: dt.datetime, minutes: int, chance: random.Random) -> None: + folder.mkdir(parents=True) + stopped = started + dt.timedelta(minutes=minutes) + (folder / "session.json").write_text(json.dumps({ + "contract": "session-audio/v2", "started": started.isoformat(timespec="seconds"), + "stopped": stopped.isoformat(timespec="seconds"), "tracks": {}})) + lines = [{"type": "header", "contract": "transcript/v1", "engine": "whisper.cpp", "model": "ggml-large-v3-turbo-q8_0", + "language": "fr", "context": None}] + start, end_of_meeting = 0.0, minutes * 60.0 + while start < end_of_meeting - 5: + length = round(chance.uniform(2.0, 6.0), 1) + lines.append({"type": "segment", "speaker": chance.choice(["me", "them"]), "track": chance.choice(["local", "remote"]), + "voice": None, "start": round(start, 1), "end": round(start + length, 1), "text": sentence(chance)}) + start += length + round(chance.uniform(0.2, 1.5), 1) + if at in PLACED: + # Late in the meeting: a scan that stops at the first hit reads nearly all of it. + lines[-3]["text"] = f"On renvoie le {PLACED[at]} vendredi, signé." + lines.append({"type": "complete", "duration": end_of_meeting}) + (folder / "transcript.jsonl").write_text("".join(json.dumps(line, ensure_ascii=False) + "\n" for line in lines)) + made = stopped + dt.timedelta(minutes=3) + (folder / "minutes.md").write_text( + f"---\ncontract: minutes/v4\nmade: {made.isoformat(timespec='seconds')}\nprovider: local\nmodel: qwen3:8b\n" + f"context: null\ntitle: {json.dumps(f'Point {at + 1}')}\n---\n\n" + f"## Points saillants\n\nLe budget est revu. {sentence(chance)}\n\n" + f"## Actions\n\n" + "".join(f"- {sentence(chance)}\n" for _ in range(4)) + + "\n## Points clés\n\n" + "".join(f"- {sentence(chance)}\n" for _ in range(4))) + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("folder", type=Path) + parser.add_argument("--count", type=int, default=500) + parser.add_argument("--minutes", type=int, default=60) + parser.add_argument("--seed", type=int, default=127) + asked = parser.parse_args() + if asked.folder.exists() and any(asked.folder.iterdir()): + raise SystemExit(f"{asked.folder} is not empty: the meetings are made in an empty folder") + chance = random.Random(asked.seed) + first = dt.datetime(2026, 1, 5, 9, 0, tzinfo=dt.timezone(dt.timedelta(hours=1))) + for at in range(asked.count): + started = first + dt.timedelta(hours=8 * at) + meeting(asked.folder / started.strftime("%Y-%m-%d_%H-%M"), at, started, asked.minutes, chance) + + +if __name__ == "__main__": + main() diff --git a/modules/shell/tests/search_speed.rs b/modules/shell/tests/search_speed.rs new file mode 100644 index 00000000..f5fda247 --- /dev/null +++ b/modules/shell/tests/search_speed.rs @@ -0,0 +1,47 @@ +//! How long the search takes on a set of meetings (D127, criterion 2): what `searched` does for one word typed — +//! the list read, then every summary and transcript sought —, the median of ten runs for each placed word of +//! `scripts/meetings_made.py`. Ignored by default: it needs the set, made first, and measures, it judges nothing. +//! +//! `scripts/meetings_made.py `, then +//! `KITOKEY_SEARCH_SET= cargo test --release --test search_speed -- --ignored --nocapture`. + +use std::time::{Duration, Instant}; + +use kitokey_shell::{search, sessions}; + +#[test] +#[ignore = "a measure, on a set made by scripts/meetings_made.py"] +fn the_search_on_a_set_of_meetings_timed() { + let set = std::env::var("KITOKEY_SEARCH_SET").expect("KITOKEY_SEARCH_SET names the set"); + let set = std::path::Path::new(&set); + let mut listing: Vec = (0..10) + .map(|_| { + let started = Instant::now(); + sessions::list(set, None); + started.elapsed() + }) + .collect(); + listing.sort(); + println!("SPEED the list alone: median {:.1} ms", listing[5].as_secs_f64() * 1e3); + for word in ["devis", "budget", "zzqx"] { + let mut took: Vec = Vec::new(); + let mut found = (0, 0, 0); + for _ in 0..10 { + let started = Instant::now(); + let listed = sessions::list(set, None); + let hits = search::found(&listed, word, &|| true).expect("never replaced"); + took.push(started.elapsed()); + found = (hits.titles.len(), hits.minutes.len(), hits.transcripts.len()); + } + took.sort(); + println!( + "SPEED {word}: median {:.1} ms, min {:.1} ms, max {:.1} ms; found titles {}, summaries {}, transcripts {}", + took[5].as_secs_f64() * 1e3, + took[0].as_secs_f64() * 1e3, + took[9].as_secs_f64() * 1e3, + found.0, + found.1, + found.2 + ); + } +} From 89381244b68e68167990f84c29bd282b39bad554 Mon Sep 17 00:00:00 2001 From: "kitokey-ines[bot]" <356215272+kitokey-ines[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2026 03:39:50 +0100 Subject: [PATCH 2/3] =?UTF-8?q?shell=20tests:=20the=20meetings=20made=20fo?= =?UTF-8?q?r=20the=20search's=20measure=20are=20read=20whole=20by=20the=20?= =?UTF-8?q?shell=20=E2=80=94=20every=20segment,=20as=20transcript/v1=20has?= =?UTF-8?q?=20it=20=E2=80=94=20and=20hold=20their=20placed=20words=20(D127?= =?UTF-8?q?=20criterion=202)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Session: d68d8ea4-0375-44c6-98e5-667929031835 Co-Authored-By: Claude Opus 5.5 --- modules/shell/tests/search_speed.rs | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/modules/shell/tests/search_speed.rs b/modules/shell/tests/search_speed.rs index f5fda247..806dfd9c 100644 --- a/modules/shell/tests/search_speed.rs +++ b/modules/shell/tests/search_speed.rs @@ -45,3 +45,37 @@ fn the_search_on_a_set_of_meetings_timed() { ); } } + +#[test] +fn the_meetings_made_are_read_whole_by_the_shell_and_hold_their_placed_words() { + // The set measures what the shell reads: every transcript must be one it reads whole — each segment as + // `transcript/v1` has it, `me` on `local`, `others` on `remote` —, or the search skips lines and is timed on less + // than an hour (2026-12-01: `them`, and tracks drawn apart from speakers, left 3 lines in 4 unread). + let set = tempfile::tempdir().unwrap(); + let script = concat!(env!("CARGO_MANIFEST_DIR"), "/scripts/meetings_made.py"); + let Ok(made) = std::process::Command::new("python3") + .args(["-I", script]) + .arg(set.path()) + .args(["--count", "8", "--minutes", "5"]) + .output() + else { + assert!(std::env::var_os("CI").is_none(), "python3 is not there on this CI runner"); + eprintln!("python3 is not there: the meetings made are not checked"); + return; + }; + assert!(made.status.success(), "{}", String::from_utf8_lossy(&made.stderr)); + let listed = sessions::list(set.path(), None); + assert_eq!(listed.len(), 8); + for session in &listed { + let written = std::fs::read_to_string(session.folder.join("transcript.jsonl")).unwrap(); + let segments = written.lines().filter(|line| line.contains(r#""type": "segment""#)).count(); + let kitokey_shell::meeting::Read::Present(read) = kitokey_shell::meeting::transcript(&session.folder) else { + panic!("{} not read", session.folder.display()); + }; + assert!(segments > 40, "five minutes of lines: {segments}"); + assert_eq!(read.segments.len(), segments, "every line read, {}", session.folder.display()); + } + let devis = search::found(&listed, "devis", &|| true).unwrap(); + assert_eq!(devis.transcripts.len(), 1, "« devis » in the 8th meeting's transcript: {devis:?}"); + assert_eq!(search::found(&listed, "budget", &|| true).unwrap().minutes.len(), 8); +} From e3c4cfdff49c248cb5c65f501f07f21a8e659a88 Mon Sep 17 00:00:00 2001 From: "kitokey-ines[bot]" <356215272+kitokey-ines[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2026 03:39:50 +0100 Subject: [PATCH 3/3] =?UTF-8?q?shell:=20the=20meetings=20made=20say=20?= =?UTF-8?q?=C2=AB=20me=20=C2=BB=20on=20local=20and=20=C2=AB=20others=20?= =?UTF-8?q?=C2=BB=20on=20remote,=20as=20transcript/v1=20has=20it:=20two=20?= =?UTF-8?q?lines=20in=20three=20were=20skipped=20by=20the=20shell=20and=20?= =?UTF-8?q?the=20search=20timed=20on=20less=20than=20an=20hour=20(D127=20c?= =?UTF-8?q?riterion=202)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Session: d68d8ea4-0375-44c6-98e5-667929031835 Co-Authored-By: Claude Opus 5.5 --- modules/shell/scripts/meetings_made.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/shell/scripts/meetings_made.py b/modules/shell/scripts/meetings_made.py index 6e4092a6..c5b6b591 100755 --- a/modules/shell/scripts/meetings_made.py +++ b/modules/shell/scripts/meetings_made.py @@ -44,7 +44,9 @@ def meeting(folder: Path, at: int, started: dt.datetime, minutes: int, chance: r start, end_of_meeting = 0.0, minutes * 60.0 while start < end_of_meeting - 5: length = round(chance.uniform(2.0, 6.0), 1) - lines.append({"type": "segment", "speaker": chance.choice(["me", "them"]), "track": chance.choice(["local", "remote"]), + # As `transcript/v1` has it: `me` heard on `local`, `others` on `remote` — any other line the shell skips. + speaker = chance.choice(["me", "others"]) + lines.append({"type": "segment", "speaker": speaker, "track": "local" if speaker == "me" else "remote", "voice": None, "start": round(start, 1), "end": round(start + length, 1), "text": sentence(chance)}) start += length + round(chance.uniform(0.2, 1.5), 1) if at in PLACED: