Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/project/cycles/12-kitokey-simple-and-beautiful.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,33 @@ says (b)'s sentence for the private path; nothing of (a) is built in this cycle
their date, so it finds dates. The title from the summary is #1240's, moved here: it is what makes the list
readable.

**Criterion 2, measured on 2026-12-01.** Budget: D105's 100 ms for a response (cycle 11, as amended on
2026-11-20). Machine: AMD Ryzen AI 7 PRO 350, 16 threads, 24 GB, Linux 7.3.4, WebKitGTK 2.54.2. Set: `set500v2`,
500 meetings of an hour each (78 MB), made for the measure by `modules/shell/scripts/meetings_made.py`, no real
meeting, every line one the shell reads: « devis » in three transcripts, « budget » in every summary, « zzqx »
nowhere. Figures in ms, medians.

| Method | Measured where | First search | A search after it |
|---|---|---|---|
| Every file read at each search | `tests/search_speed.rs`, release build, the machine's lock held | 414 | 414 |
| Kept: each summary and transcript read once, folded, read again only once its file changes (`search::Corpus`) | same | 449 (every file read) | 32 (« devis » 32.7, « budget » 32.6, « zzqx » 30.4) |
| **Kept, answered in parts, the list hidden whole** | the release build in a session of its own, by D105's method (#1034): in the page, from the words typed to the status, the first passage and the search complete, each plus one frame; 5 runs | status 14, first passage 77 (runs 69–99), complete 83 | « budget » 63 (complete 70), « zzqx » complete 55, « devis » 50 (52) |

- **Chosen: the kept passages, answered in parts.** A search reads for 50 ms at most, newest meetings first, every
title in its first answer; the window draws each answer as it comes, says « Recherche… » until the search is
complete, and asks again. The texts are read ahead from the first list drawn.
- **Held, with little margin cold:** the first passage cold is 77 ms in the median and 99 ms in the slowest of five
runs. The page's thread never stalls more than 30 ms.
- **The cost: memory.** Holding the passages takes 122 MB more for 500 hours (4 MB resident before the first
search, 126 MB after): each line kept as written and folded.
- **The cold case was first not the search.** The window's search hid the list's 500 rows one by one: 1.9 s in
WebKitGTK, and 2.1 s to show them again (measured in the page). The list is now hidden in one write; its rows are
filtered one by one only when the shell does not answer. The same cost elsewhere in the window: #1419.
- A first set (`speaker` drawn as `me` or `them`, `track` drawn apart) left two lines in three unread by the
shell, and every figure measured on it was too low; the generator's test now demands each line read.
- The probe that measured the app (`speed_search.py`, on #1034's harness) is in D127's pull request, as its method;
it is not merged.

### D128

`screens-and-delight.md` §4, *Shortcuts* and *Command palette*. The global shortcut, which the desktop grants, stays as it is.
Expand Down
105 changes: 104 additions & 1 deletion modules/shell/scripts/e2e_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -11162,7 +11162,9 @@ def found_by_what_was_said(now: dt.datetime) -> None:
the field reaches them; Entrée on the transcript's opens the meeting on its « Transcription » tab (under 1400 px),
the line in view and focused, the player cued there and paused; on the summary's, on « Compte rendu », focused there; on a
title's, the focus on the meeting's name, never the body (#1400); typed fast,
only the last words' results are shown; axe clean in both themes."""
only the last words' results are shown; axe clean in both themes. D127 c2: answered in parts, « Recherche… » said
until complete, each part appended with the focus kept; an answer for other words dropped; 50 results a group,
a button the others."""
print("DG. the search by what was said: titles, summaries, transcripts grouped, the passage marked, Entrée opening the meeting at its line (D127a)")
meetings = WORK / "found"
titled, summarised, heard, other = (meetings / f"2026-11-2{n}_10-00" for n in (6, 5, 4, 3))
Expand Down Expand Up @@ -11211,6 +11213,8 @@ def found_by_what_was_said(now: dt.datetime) -> None:
back = lambda b: (b.execute_script("location.hash = '#/'"),
wait_for(b, lambda c: c.find_element(By.ID, "find").is_displayed(), 10))

seeking_word = {"fr": "Recherche…", "en": "Searching…"}
more_word = {"fr": "Afficher 10 de plus", "en": "Show 10 more"}
for language, heads, theme in (("fr_FR.UTF-8", ["Titres", "Comptes rendus", "Transcriptions"], "light"),
("en_US.UTF-8", ["Titles", "Summaries", "Transcripts"], "dark")):
short = language[:2]
Expand All @@ -11221,6 +11225,12 @@ def found_by_what_was_said(now: dt.datetime) -> None:
typed(browser, "budget")
drawn = wait_for(browser, lambda b: (r := b.execute_script(results)) is not None and len(r) == 3, 10)
got = browser.execute_script(results)
# D127 c2: the list hidden whole, in one write, its rows untouched — none hidden one by one, none marked —:
# on 500 meetings, hiding rows one at a time took WebKitGTK 1.9 s at the first word typed.
rows = ("const g = document.getElementById('groups');"
" return [g.hidden, g.querySelectorAll('li[hidden], .group[hidden]').length, g.querySelectorAll('mark').length]")
check(f"{short}, a search hides the list whole, no row hidden or marked one by one", browser.execute_script(rows) == [True, 0, 0],
browser.execute_script(rows))
check(f"{short}, « budget » finds the meetings grouped by where it was found, in order, each group headed and named by its heading",
drawn and [g[0] for g in got] == heads and all(g[1] for g in got), got)
check(f"{short}, each group its meeting, its passage, the word marked; the transcript's with its time",
Expand Down Expand Up @@ -11321,6 +11331,99 @@ def found_by_what_was_said(now: dt.datetime) -> None:
browser.execute_script(results)])
browser.execute_script("Object.defineProperty(window, '__TAURI__', { configurable: true, writable: true, value: window.__tauri })")

# D127 c2: the shell answers with what it read so far, then the rest — a double of `searched` gives the
# answers in turn, the second held until let go. While incomplete « Recherche… » is said; each answer's
# new results are appended, the ones drawn kept as they are (marked, the focus on one stays); the last
# answer complete, the status gone. An answer for other words than those typed is dropped (#1414's G3).
back(browser)
hit = lambda folder, passage, start=None: {"folder": str(folder), "passage": passage, "start": start}
answers = [
# Every title at the first answer, as the shell gives them.
{"typed": "budget", "titles": [hit(titled, "Budget 2027")], "minutes": [hit(summarised, "Le budget est revu en janvier.")],
"transcripts": [], "complete": False},
{"hold": True, "typed": "budget", "titles": [hit(titled, "Budget 2027")], "minutes": [hit(summarised, "Le budget est revu en janvier.")],
"transcripts": [hit(heard, "Le Budget, on en parle jeudi.", 75.4)], "complete": False},
{"typed": "budget", "titles": [hit(titled, "Budget 2027")], "minutes": [hit(summarised, "Le budget est revu en janvier.")],
"transcripts": [hit(heard, "Le Budget, on en parle jeudi.", 75.4)], "complete": True},
# « salle » typed, answered for « sa »: dropped.
{"typed": "sa", "titles": [], "minutes": [hit(other, "La salle est trouvée.")], "transcripts": [], "complete": True},
# « revu »: 60 summaries' results, complete.
{"typed": "revu", "titles": [], "minutes": [hit(summarised, f"Le budget est revu, {n}.") for n in range(60)],
"transcripts": [], "complete": True},
]
browser.execute_script(
"const t = window.__TAURI__, core = t.core; window.__tauri = t; window.__answers = arguments[0]; window.__go = false;"
" window.__asked = 0;"
" const late = Object.assign(Object.create(Object.getPrototypeOf(core)), core, { invoke: (asked, rest, options) => {"
" if (asked !== 'searched') return core.invoke(asked, rest, options);"
" window.__asked++; const one = window.__answers.shift(); if (!one) return Promise.resolve(null);"
" const wait = (done) => (!one.hold || window.__go) ? done(one) : setTimeout(() => wait(done), 10);"
" return new Promise(wait); } });"
" const top = Object.assign({}, t, { core: late }); try { window.__TAURI__ = top; } catch (x) {}"
" if (window.__TAURI__ !== top) Object.defineProperty(window, '__TAURI__', { configurable: true, writable: true, value: top });",
answers)
seeking = "const s = document.getElementById('seeking'); return [!s.hidden && s.getClientRects().length > 0, s.textContent, s.getAttribute('role')]"
typed(browser, "budget")
first = wait_for(browser, lambda b: (r := b.execute_script(results)) is not None and len(r) == 2, 10)
said = browser.execute_script(seeking)
check(f"{short}, the search not complete: what came is drawn, « {seeking_word[short]} » said in a status",
first and [[g[0], g[2][0][0]] for g in browser.execute_script(results)] == [[heads[0], titled.name], [heads[1], summarised.name]]
and said == [True, seeking_word[short], "status"]
and not browser.find_element(By.ID, "none-found").is_displayed(),
[browser.execute_script(results), said, browser.find_element(By.ID, "none-found").is_displayed()])
shot_themed(browser, f"dg-seeking-{short}-{theme}", theme)
# The focus on the result drawn, marked; then the held answer let go.
browser.find_element(By.ID, "find").click()
ActionChains(browser).send_keys(Keys.ARROW_DOWN).perform()
wait_for(browser, lambda b: b.execute_script("return document.activeElement.matches('#found a.found')"), 3)
browser.execute_script("document.activeElement.dataset.kept = 'yes'")
browser.execute_script("window.__go = true")
appended = wait_for(browser, lambda b: (r := b.execute_script(results)) is not None and len(r) == 3
and not b.execute_script(seeking)[0], 10)
got = [browser.execute_script(results), browser.execute_script(focus_in, "#found"),
browser.execute_script("return document.activeElement.dataset.kept ?? null"), browser.execute_script(seeking),
browser.execute_script("return window.__asked")]
check(f"{short}, the rest appended in its group's place, the result drawn before kept with the focus on it; complete, the status gone",
appended and [g[0] for g in got[0]] == heads and got[0][2][2][0][0] == heard.name and got[1][1] and got[2] == "yes"
and got[4] == 3, got)
typed(browser, "salle")
time.sleep(0.5)
got = [browser.execute_script(results), browser.execute_script("return window.__asked")]
check(f"{short}, an answer for other words than those typed is dropped: nothing of it drawn",
got[1] == 4 and other.name not in json.dumps(got[0]), got)
typed(browser, "revu")
fifty = wait_for(browser, lambda b: (r := b.execute_script(results)) is not None and len(r) == 1 and len(r[0][2]) == 50, 10)
more = "const m = document.querySelector('#found .found-more'); return m && !m.hidden ? m.textContent : null"
got = [len(browser.execute_script(results)[0][2]) if fifty else None, browser.execute_script(more)]
check(f"{short}, 60 results: the first 50 drawn, a button the others", fifty and got[1] == more_word[short], got)
browser.execute_script("document.querySelector('#found .found-more').scrollIntoView({ block: 'end' })")
shot_themed(browser, f"dg-fifty-more-{short}-{theme}", theme)
browser.execute_script("document.querySelector('#found .found-more').focus()")
ActionChains(browser).send_keys(Keys.ENTER).perform()
sixty = wait_for(browser, lambda b: len(b.execute_script(results)[0][2]) == 60, 10)
got = [len(browser.execute_script(results)[0][2]), browser.execute_script(more),
browser.execute_script("return [...document.querySelectorAll('#found a.found')].indexOf(document.activeElement)")]
check(f"{short}, the button pressed: the 10 others drawn, the focus on the first of them, the button gone",
sixty and got[1] is None and got[2] == 50, got)
browser.execute_script("Object.defineProperty(window, '__TAURI__', { configurable: true, writable: true, value: window.__tauri })")

# The shell failing: the rows filtered by what their row says, the search as it was before D127; emptied,
# every row back, unmarked.
browser.execute_script(
"const t = window.__TAURI__, core = t.core; window.__tauri = t;"
" const failing = Object.assign(Object.create(Object.getPrototypeOf(core)), core, { invoke: (asked, rest, options) =>"
" asked === 'searched' ? Promise.reject('failed') : core.invoke(asked, rest, options) });"
" const top = Object.assign({}, t, { core: failing }); try { window.__TAURI__ = top; } catch (x) {}"
" if (window.__TAURI__ !== top) Object.defineProperty(window, '__TAURI__', { configurable: true, writable: true, value: top });")
shown_rows = "return [...document.querySelectorAll('#groups .session')].filter(r => r.getClientRects().length > 0).map(r => decodeURIComponent(r.getAttribute('href').split('/').pop()))"
typed(browser, "budget")
by_title = wait_for(browser, lambda b: b.execute_script(shown_rows) == [titled.name] and not b.execute_script(results), 10)
check(f"{short}, the shell failing: the rows filtered by what their row says", by_title, [browser.execute_script(shown_rows), browser.execute_script(results)])
typed(browser, "")
back_all = wait_for(browser, lambda b: len(b.execute_script(shown_rows)) == 4 and b.execute_script(rows) == [False, 0, 0], 10)
check(f"{short}, emptied after it: every row back, unmarked", back_all, [browser.execute_script(shown_rows), browser.execute_script(rows)])
browser.execute_script("Object.defineProperty(window, '__TAURI__', { configurable: true, writable: true, value: window.__tauri })")

typed(browser, "zzzyx")
none = wait_for(browser, lambda b: b.find_element(By.ID, "none-found").is_displayed() and not b.execute_script(results), 10)
check(f"{short}, nothing found is said", none, [browser.find_element(By.ID, "none-found").text, browser.execute_script(results)])
Expand Down
81 changes: 81 additions & 0 deletions modules/shell/scripts/meetings_made.py
Original file line number Diff line number Diff line change
@@ -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()
Loading
Loading