Skip to content

EasySpeak import: read every timed row, and put each on a role the user has - #185

Merged
ShuhaoZQGG merged 25 commits into
devfrom
fix/easyspeak-import-roles
Dec 2, 2026
Merged

ShuhaoZQGG merged 25 commits into
devfrom
fix/easyspeak-import-roles

Conversation

@ShuhaoZQGG

@ShuhaoZQGG ShuhaoZQGG commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

No issue: found while testing #184.

Stacked on #184 (feat/111-agenda-import). Until #184 merges, the diff here also shows its commits. This change on its own: feat/111-agenda-import...fix/easyspeak-import-roles

Why

Pasting demo-agenda-easyspeak.txt gave 7 speakers where the agenda has 9 timed roles. The General Evaluator and the Ah Counter were dropped, and nothing said so.

Looking at why showed a wider gap: EasySpeak import was the one way onto the agenda that ignored the user's role list. Its parser turned every row into one of five built-in role names, and the import saved that name with Standard Speech's 5/6/7 minutes when the user had removed the role. A club running only its own roles got every row highlighted as "(Short Roles) is not one of your roles", whatever the agenda called it, and a role of theirs named "Grammarian" was never tried. #184's own run on the test device recorded this: all seven rows red.

The owner chose to fix both here, and made the three calls the role matching needed: a role of the user's with the agenda's exact name wins over the built-in; the match is exact wording only ("1st Speaker" is not "Speaker"); a role the parser has no word for is read only when the user has a role of that name.

What changes

Rows that were dropped are read. For the demo agenda:

Rows
Before (7) Priya Sharma = Short Roles - Grammarian; Sarah Chen = Ice Breaker; James Wilson, Maria Garcia = Standard Speech; Emily Brown, Alex Thompson, Natalie Foster = Speech Evaluation
After (9) the same seven, then Michael Lee = General Evaluation and Jordan Blake = Short Roles - Ah Counter
  • With speech details shown, a role row right after another role row was taken as that row's speech details (any line over 20 characters). A role row is never speech details now.
  • "Ah Counter" and "Public Speaking Tip" were in the list that maps a short role but in neither list that recognises a row. Both are read now, tab-separated and with the name on the next line, and "Ah-Counter" with its hyphen. They match as the whole cell or line, so a speech called "Public Speaking Tips for Beginners" and a speaker called Sarah Counter are not roles.
  • A role with nobody in it yet took the tab-separated row below it as its name. It leaves a role row alone now.

A row takes one of the user's roles, or none. In this order:

  1. the user's own role with the name the agenda uses (same words; case and punctuation aside);
  2. else the built-in the row maps to, while the user still has it;
  3. else no role: the row keeps the agenda's wording and no timings, and the Agenda tab asks, as for any other row (Simple Format import: ask for a role when the bracket doesn't name one, instead of guessing #91). An Ice Breaker is not put on Standard Speech when only that one is left.

The same demo agenda on a device with no built-in role left:

Device's roles Before After
Grammarian, General Evaluator, Ah Counter, Speech, Evaluation, 1min Role 7 red, 2 missing 3 ready (Priya, Michael, Jordan), 6 red: "(1st Speaker - Ice Breaker)", "(2nd Speaker)", "(1st Evaluator)"…
1min Role, 1-2min Role, 5-7min Speech, Tech Tip 7 red, 2 missing 9 red, each in the agenda's words
  • A row for a role the parser has no word for ("Joke Master") is read when a role the user added has exactly that name; otherwise it stays out, as before.
  • The line under the paste box and the toast say how many EasySpeak rows need a role ("EasySpeak agenda: 9 speakers found. 6 need a role: you pick it after import."), in the words already used for "Name (Role)" lines.
  • agenda_imported carries needs_role_count and custom_role_count for EasySpeak too.
  • A device with the built-in roles sees no change except the two rows that are no longer dropped.

Code. parseEasySpeakText(text, roleNames) takes the role list (the built-ins when left out) and returns roleText, the role as the agenda words it. matchAgendaFormat passes its list on, so the Worker's read of an uploaded EasySpeak document follows the same rule with no Worker change. importEasySpeakSpeakers in both apps builds rows the way importBulkSpeakers does. roleFinder in simpleFormatParser.js works out each role name's words once per parse.

Security

None. No new route, no new data sent or stored. The Worker runs the changed parser on an uploaded file's text; the role lookup was measured on the worst text it accepts (below).

Production impact

  • Users on the built-in roles: two more rows from agendas like the demo, nothing else.
  • Users who removed built-ins or added roles: EasySpeak rows can now land on their own roles, and rows with no role show the agenda's wording instead of a built-in's name. Rows already in an agenda are not touched.
  • A row with no role is saved without timings (it used to carry Standard Speech's). It cannot be timed until a role is picked, as before.
  • No flag, no migration. Rollback is a revert.
  • Cost in the Worker: with 60 custom roles, the role lookup on a 20,000-character text took 110–130 ms when it went through the list for every line. It is about 3 ms now, and a test holds it there.

Testing

  • npm test: pass, 167 files, 3,370 tests (on the tree with Agenda import: one paste box for every format, with an AI read and an upload for Pro (#111) #184's latest commits merged in)
  • npm run test:e2e: pass, 161 tests
  • npm run test:specs: pass, 18 specs valid
  • Oracle: none, this is not a factory issue. The tests were written first and run against the unchanged code: 15 new parser tests failed before the dropped-rows fix, and with the role-matching code taken out again 26 tests failed across 8 files.

Evidence (real Zoom client)

Run 2026-12-01, test-runs/2026-12-01-easyspeak-import-roles/run.md (the run folder is not in git; it sits beside the other runs in the main checkout). This branch at 88a2845, dev version bbefa644, FLAGS_FORCE "0" as committed, Zoom on macOS, the usual test device: no built-in role, 17 roles of its own, none named as the agenda names one.

Step Result
agenda-import IM-04 ✅ clean device before and between the two steps
IM-07, rewritten ✅ "EasySpeak agenda: 9 speakers found. 9 need a role: you pick it after import." Toast "Imported 9 speaker(s). 9 need a role". Nine rows in the agenda's order, Michael Lee and Jordan Blake among them (seven on 2026-11-30). All nine highlighted in the agenda's words on this device: "(Grammarian)", "(1st Speaker - Ice Breaker)", "(2nd Speaker)" … "(General Evaluator)", "(Ah Counter)"
IM-14, new ✅ with Grammarian (15/30/45 s) and Joke Master added: "3 speakers found. 1 needs a role". Priya Sharma on the device's own Grammarian, not Short Roles; Sam Lee on Joke Master; no row for the Word of the Day; Sarah Chen highlighted as "(1st Speaker)". Priya's row opened the Live tab on Grammarian with "Green: 15 seconds, Yellow: 30 seconds, Red: 45 seconds"
Extra ✅ a highlighted EasySpeak row refuses the timer: "Pick a role for Sarah Chen first"

The device was left as found: agenda empty, the two test roles removed, no speech started.

Not verified

  • PostHog evidence for IM-07 and IM-14 (agenda_imported with items_count, needs_role_count, custom_role_count). The dev build came from a worktree checkout, which has no PostHog key, so it sent no events. The unit tests assert the payload. Dev stays without analytics until the next deploy from the main checkout or Workers Builds' next dev push.
  • A device with the built-in roles was not run in the real client: the test device has none. That case (nine rows, each on its built-in) is covered by the unit tests and e2e/zoom.agenda-import.spec.js.
  • The rest of agenda-import was not rerun, so the spec stays status: stale and verified_at is unchanged. That is Agenda import: one paste box for every format, with an AI read and an upload for Pro (#111) #184's pending rerun of IM-09 to IM-11 and IM-13, which this branch carries.
  • new-look NL-13: its EasySpeak count is now nine. Not rerun; the spec was already stale and none of its covers files changed. e2e/zoom.new-look.spec.js pastes the same file in design B.
  • timer-core covers TimerContext.jsx: reviewed, no step moves, not rerun (note added to its Not covered).
  • Still left out by EasySpeak import, all older than this change and now listed in the spec: the five roles the timer skips stay out even when the user has a role of that name; "Moment of Humor" in the American spelling is not read; a role with nobody in it, pasted with the role on one line and the name on the next, still takes the role line below it as its name.

Look here first

  1. packages/shared/easySpeakParser.js: listedRole (the three-step rule) and the two look-aheads that now leave a role row alone (roleRow in the speech-details check, nameFollows).
  2. importEasySpeakSpeakers in apps/zoom-app/src/context/TimerContext.jsx (the web app's is the same): a row with no role gets no timings.
  3. AH_COUNTER_OR_TIP in the parser: the two new role words match the whole cell or line, unlike the older ones, which match anywhere in it.

…upload for Pro (#111)

The import dialog had two tabs, EasySpeak Format and Simple Format, and the
user had to pick one before pasting. It now has one text box. matchAgendaFormat
(packages/shared/agendaImport.js) works out which format a text is in and reads
it with that format's own parser, so a paste lands as it did under its tab.
A plain list of short lines is still taken one name per line. Text in no known
format adds nothing: the dialog says so and offers "Add each line as a
speaker", which is what Simple Format used to do with it.

Behind the new agenda_ai flag, and for Pro:
- "Read with AI" sends a text no format matched to POST /api/agenda/import.
- "Upload a photo or file" sends a PDF, a Word or Excel file, a CSV, a text
  file or a picture. A tall picture is cut into two or three overlapping
  bands first, because a vision model sees a whole page too coarsely and
  mixed up its rows. A screenshot pasted into the box, or a file dropped on
  the dialog, is read the same way.
- What comes back is listed for review, each role beside the slot as the
  agenda worded it, and is added only on confirm. A row whose role is not one
  of the user's roles is added highlighted, as for Simple Format (#91).
A free plan sees both controls locked, opening the upgrade. With agenda_ai or
pro off, nothing of them shows.

The dialog's body is one component in packages/ui, used by the Zoom app's
modal, design B's paste sheet and the web app's modal.
…ext, a document or a photo (#111)

Pro, behind the agenda_ai flag. Takes a pasted text no format matched, or an
upload:
- a photo (one picture, or the bands of a tall one) goes to a vision model;
- a PDF, Word or Excel file is converted to text by Workers AI toMarkdown,
  tried against the formats the dialog reads (only a match on structure
  counts), and read by the model when none fits; a .csv or .txt is read as it
  is.
The model picks each role by its number in the list the client sent, so it
cannot invent one, and the slots the timer does not time (Toastmaster, Timer,
Table Topics Master, Sergeant at Arms, chair) are dropped even when it lists
them.

Workers AI first (Gemma 4 26B through a new AI binding; no retention, no
training, 10,000 free neurons a day), then OpenRouter's free models, the
Table Topics setup, when it errors or answers nothing usable.

Limits: session, flag and Pro entitlement in that order; AGENDA_AI_LIMITER at
10 a minute and a KV counter at 50 model reads a day, both per account;
20,000 characters, 5 MB, 60 rows. Nothing of an agenda is stored or logged.
…e paste box and AI import (#111)

- Privacy page: what AI Agenda Import sends and where (Cloudflare Workers AI,
  OpenRouter as the backup), and that an agenda the app reads by itself is
  never sent. Four service providers, no longer three.
- Documentation page: one box for both formats.
- FEATURE_FLAGS.md: agenda_ai.
- agenda-import spec: IM-02, IM-05 and IM-06 no longer pick a tab; IM-07 to
  IM-13 added (EasySpeak in the same box, an unknown format, Read with AI,
  the file dialog with a PDF and a picture, the free-plan lock, a pasted
  screenshot), with a sample agenda under fixtures/. Not run yet.
- timer-core and new-look reworded where they opened the Simple Format tab;
  new-look gains NL-24. pro-launch and club-membership note the Upgrade
  dialog's new line.
- The Worker reads a request body chunk by chunk and stops at the limit, so a
  body with no Content-Length, or a false one, is not held in memory whole.
- Only the first 80,000 characters of a document's text are looked at before
  it is cut to the 20,000 the reader takes.
- The format matcher claims nothing for text with a line over 2,000
  characters: the parsers scan a line more than once, and no agenda row is
  that long.
…ocked screen (#111)

The run on 2026-11-30 stopped before the first click: the Mac's screen was
locked. No step has run on the one-box dialog yet.
…is locked

A locked screen let screencapture write a black file and Zoom launch with no
window, so a run deployed and announced itself before it found out. preflight
now reports it as a blocker and zoom-up exits 2 before launching Zoom.
#111)

The read is meant never to reject. If it ever does, the dialog showed "Reading…" for good; it now shows "That could not be read." and keeps the text.
…ds it in one pass (#111)

From the code review of this change:
- EasySpeak is known by its own header, by one "1st Speaker" row, or by its
  other role rows in numbers with no foreign table row beside them. One speaker
  pasted with the speech details, and speakers with six lines of details each,
  are EasySpeak again (they had become "Name (Role)" and nothing). A club's
  own "Speaker 1 <tab> Bob" table is no longer read for its Grammarian alone,
  and "Role  Name" is not EasySpeak's header.
- A format that reads nobody claims nothing, so the dialog is never left with
  a greyed-out Import and no way on.
- A schedule whose lines end in "(5-7 min)" is not "Name (Role)".
- `strict`, for a file's text in the Worker: only EasySpeak's own header, or
  "Name (Role)" lines where most roles are the user's, count.
- The EasySpeak parser's project-reference pattern backtracked cubically (2 s
  on 18 KB). hasProjectRef answers the same in one pass; 300,000 random
  strings agree with the old pattern. Trailing whitespace is trimmed with
  trimEnd for the same reason.
- A text over 20,000 characters is refused before it is sent, as too long, not
  as "a file over 5 MB". A decoded photo is released on every path.
…#111)

From the code review of this change:
- An uploaded file's text is matched strictly. A club's own role table and a
  schedule came back as "Found N speakers" with people missing or junk rows,
  and a file had no way to the model. `mode=ai` in the form skips the match:
  the dialog sends it when the user asks for the AI's reading after all.
- markdownToPlain and csvToTabbed no longer use patterns that rescan a run
  from every start (3.2 s and 2.4 s on 80,000 characters; now under 3 ms).
- The day's count is written before the model is asked, and the limiter is 6
  a minute. The count is still approximate, as KV must be; the comments now
  say what it can and cannot hold.
- Failure logs never carry a raw error, including one with no name.
- A paste over the limit answers `text_too_long`.
…s Tab and Escape (#111)

From the code review of this change:
- A format that claims a paste and reads nobody gets the same ways out as an
  unknown format: the AI read, or each line as a speaker.
- A file a format read offers "Read it with AI" in its review, and sends the
  same file again.
- A 402 shows its message and locks the controls. It no longer opens the
  upgrade by itself, and on the web the upgrade opens in a new tab: going to
  /account in the same one unmounted the timer, a running speech included.
- A row the reader gave no role never borrows one from its wording ("Custom",
  "Ice Breaker"), which let it pass for that role with no rules behind it.
- Design B: the paste sheet is not drawn while the Upgrade dialog it opened is
  up, so Escape there cannot close it and wipe the text; and the sheet's Tab
  loop no longer ends on a hidden file input (the Cards sheet had that too).
- The classic dialogs no longer claim aria-modal without moving focus.
- Tests state their expected rows instead of reading them back from the
  matcher under test.
A read is normally 5 s. On the final code's live check one stalled past 35 s and OpenRouter then answered it in 2 s; 20 s keeps the slow-but-working reads (15 to 18 s seen) and halves the wait for a stalled one.
…in the real Zoom client (#111)

agenda-import is current on 8ca49d0: IM-01 to IM-11 and IM-13 passed on
FLAGS_FORCE "1,new_look=0", IM-08 with agenda_ai off; IM-12 (human) not run.
new-look: NL-13 and NL-24 passed on FLAGS_FORCE "1"; the spec stays stale
for its other steps. The skill's gotchas gain what the run taught: check
each dialog click, pbcopy needs a UTF-8 locale, the file dialog over Zoom.
…between roles by length (#111)

A read now sends each listed role's green, yellow and red times beside the
role names. Workers AI's model sees them as "1min Role (runs 30 sec to
1 min)": a role a user made had only its name to go by, so one-minute
reports landed on "1-2min Role", and a list of names that say nothing
got no role at all.

Measured on a remote preview against the real models (2026-12-01), same
agenda, five reads each way: with a club's own list the three one-minute
reports go to "1min Role" (5 of 5; "1-2min Role" before); with names that
say nothing 10 of 10 rows get the role of their length (0 of 10 before);
with the built-in list nothing changes.

The OpenRouter fallback keeps reading by names: its free models took the
times as a reason to give every slot a role ("Awards and close" on an
evaluation role of the same length). Take a Break's times are left out:
they count a break down and say nothing of a slot's length.

The privacy page says the role names and times are sent.
… read; stale until rerun (#111)

No step's Do or Expect moves. IM-09 gains what to read in the request with
the inspector on. The spec is stale again: the change was measured against
the real models on a remote preview, and the Zoom rerun is put off.
…nd the Ah Counter

parseEasySpeakText read 7 of the 9 timed rows of demo-agenda-easyspeak.txt
and said nothing about the other two.

- With speech details shown, the row after a tab-separated role row was taken
  as that row's speech details whenever it was over 20 characters long.
  "General Evaluator<TAB>Michael Lee" became the details of the 3rd Evaluator
  above it. A line that is itself a role row is never speech details now.
- "Ah Counter" and "Public Speaking Tip" were in the list that maps a short
  role, but in neither list that recognises a role row, so their rows were
  never read. Both are recognised now, tab-separated and with the name on the
  next line, and "Ah-Counter" with its hyphen too. They match as the whole
  cell or line: a speech called "Public Speaking Tips for Beginners" and a
  speaker called Sarah Counter are not roles.
- A role with nobody in it yet took the role row below it as its name.
  Reading "Ah Counter" would have made that visible for one more role, so
  the name look-ahead leaves a role row alone as well.

The roles the timer skips (Toastmaster, Chairperson, Timer, Table Topics
Master, Sergeant at Arms) are unchanged.
…for one

EasySpeak import was the one way onto the agenda that did not look at the
user's role list. Its parser gave every row one of five built-in role names,
and the import stored that name with Standard Speech's rules when the user had
removed the role. A club running only its own roles got every row highlighted
as "(Short Roles) is not one of your roles", whatever the agenda called it.

A row now gets its role from the roles the user can pick, as "Name (Role)"
lines and AI reads already do:

1. the user's own role with the name the agenda uses ("Grammarian",
   "Ah Counter"), ahead of the built-in mapping. Same words, case and
   punctuation aside, and nothing looser: "1st Speaker" is not "Speaker";
2. else the built-in the row maps to, while the user still has it;
3. else no role. The row keeps the agenda's wording and no rules, and the
   Agenda tab asks, as it does for any other row (#91). An Ice Breaker speech
   is not put on Standard Speech when only that one is left.

A row whose role the parser has no word for ("Joke Master") is read when a
role the user added has exactly that name, and is left out otherwise, as
before. The roles the timer skips stay out whatever the user has.

The line under the paste box and the toast now say how many EasySpeak rows
need a role, in the words they use for "Name (Role)" lines, and the
agenda_imported event carries needs_role_count and custom_role_count for
EasySpeak too. On a device with the built-in roles nothing changes but the
rows the previous commit stopped dropping.

parseEasySpeakText takes the role list as a second argument (the built-in
roles when left out) and returns `roleText`, the role as the agenda words it.
matchAgendaFormat passes its list on, so the Worker's read of an uploaded
EasySpeak document follows the same rule.
…g on the device's own role

agenda-import: IM-07's count goes from seven to nine (the General Evaluator
and the Ah Counter), and it says what a device with no built-in role left
shows now: rows ready only on a role of that name, the others highlighted in
the agenda's words, the count of rows that need a role in the line under the
box and in the toast. IM-14 is new: a Grammarian row lands on the device's
own Grammarian instead of Short Roles, a Joke Master row is read because the
device has that role, and a Word of the Day row is not. The note about the
two rows the parser dropped comes out of Not covered; what EasySpeak import
still leaves out goes in.

new-look: NL-13's EasySpeak count is nine.
timer-core: reviewed against importEasySpeakSpeakers; no step moves.

Not run yet: verified_at is unchanged.
…n the real client

The run was blocked on 2026-12-01: the Mac was in use. verified_at stays at
the last real run (8ca49d0), which predates the rewritten IM-07 and the new
IM-14.
…h the list each time

The EasySpeak parser asked findRoleByName about every line, and that splits
every role name into words again on each call. With 60 roles of the user's
own, a 20,000-character text in the shortest lines it can have took 110 to
130 ms, against 5 ms with the built-in roles alone. The Worker runs this on
the text of an uploaded file.

roleFinder (simpleFormatParser.js) works out each name's words once and
answers as findRoleByName does; the parser builds one per parse. The same
text now takes about 3 ms, and a test holds it there on a text ten times as
long.
Brings in 7ec6ec8 (the AI read is told how long each role runs) and 5e3e5a9
(its spec review). Two conflicts, both resolved by keeping both sides:

- e2e/zoom-client/agenda-import.md: #111's "Stale since 2026-12-01" note,
  then this branch's own stale note and IM-14.
- e2e/zoom-client/INDEX.md: one agenda-import row carrying both reasons the
  spec is stale.
@ShuhaoZQGG ShuhaoZQGG added needs:zoom-test Factory: waiting for the real-Zoom station zoom:testing Factory: the Zoom station holds the dev lock for this PR and removed zoom:testing Factory: the Zoom station holds the dev lock for this PR labels Dec 1, 2026
…l Zoom client

2026-12-01, this branch at 88a2845 on dev bbefa644 (FLAGS_FORCE "0"), with
IM-04 before and between them:

- IM-07: "EasySpeak agenda: 9 speakers found." and nine rows, the General
  Evaluator and the Ah Counter among them. The test device has no built-in
  role and none named as the agenda names one, so all nine were highlighted
  in the agenda's words and counted as needing a role.
- IM-14: with Grammarian and Joke Master added, a Grammarian row landed on
  the device's own Grammarian (15/30/45 s in the Live tab), a Joke Master
  row was read, a Word of the Day row was not, and the 1st Speaker was
  highlighted.

PostHog was not read: a dev build from a worktree carries no key. The spec
stays stale for #111's pending reads, so verified_at is unchanged. IM-14's
cleanup line now says what the client needs (Remove applies at once).

Log: test-runs/2026-12-01-easyspeak-import-roles/run.md
@ShuhaoZQGG
ShuhaoZQGG marked this pull request as ready for review December 2, 2026 15:50
@ShuhaoZQGG
ShuhaoZQGG merged commit e78ff80 into dev Dec 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant