Skip to content

test(desktop): fail the typing benchmark over 16 ms locally and 25 ms on CI - #218

Merged
bketelsen merged 2 commits into
mainfrom
irulan/193-ci-typing-gate
Nov 12, 2026
Merged

bketelsen merged 2 commits into
mainfrom
irulan/193-ci-typing-gate

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #193.

BenchmarkTypingInALongNote (make desktop-bench) now fails when a keystroke in a 10,000-line note costs more than the typing gate. Before, it only printed the figure.

  • Local gate: 16 ms (localTypingBudget), one frame at 60 Hz. This is plan 0009's gate for source mode (Phase 2) and live preview (Phase 5).
  • CI gate: 25 ms (ciTypingBudget), selected only when CI is true. GitHub Actions sets CI=true.
  • TestTypingBudgets holds the two values apart: the local gate must be 16 ms, the CI gate must be above it, and only a true CI selects it.

ADR-0043 records the decision. Plan 0009 (Phases 2 and 5), AGENTS.md (Gates), the desktop job's comment and the desktop-bench help line say the same.

Why 25 ms on CI

The ubuntu-24.04 runner draws different CPUs. These are the BenchmarkTypingInALongNote figures from the Native desktop app job, in 19 runs of main and its branches from 2026-11-11 to 2026-11-12:

Runner CPU Runs Live preview Source mode
AMD EPYC 9V45 6 10.4 to 13.3 ms 2.4 to 3.1 ms
AMD EPYC 9V74 3 15.1 to 15.6 ms 3.6 to 3.7 ms
AMD EPYC 7763 7 17.1 to 21.1 ms 4.4 to 5.6 ms
Intel Xeon Platinum 8370C, 8573C 3 18.8 to 20.8 ms 4.9 to 5.2 ms

Runs: 43081519232, 43084464171, 43085427771, 43127310696, 43131798511, 43139223248, 43140903791, 43145932676, 43147531919, 43223038425, 43225303846, 43226635018, 43229048340, 43229921377, 43230554296, 43233097956, 43233241074, 43239778953, 43241551068 (main at c7d68a7, after #216: 17.5 ms on an EPYC 7763).

The slowest CPU is about twice as slow as the fastest, and 10 of the 19 runs are over 16 ms. 25 ms is the highest figure, 21.1 ms, plus a margin of about a fifth: runs on one CPU spread up to 8%, and a slower CPU can appear. On the slowest CPU seen, a keystroke that grows by about a fifth fails CI. On the fastest, it can nearly double first, so the 16 ms local gate stays the strict one.

Risk tier

Risk tier: 3 — risk:high paths, each with a comment or help-text change only:

  • .github/workflows/ci.yml (L2, governance: CI): only the comment above the existing make desktop-bench step changes. No step, permission, action pin or job name changes. The step can now fail, which is the gate's purpose.
  • Makefile (L2, governance: the gates): only the desktop-bench help text changes. The command is the same.

Docs housekeeping

  • New docs started from their category's TEMPLATE.md (ADR-0043)
  • Every new doc indexed in docs/README.md
  • Cross-links added in both directions (ADR-0043 ↔ plan 0009 Phases 2 and 5; AGENTS.md)
  • New significant decision recorded as an ADR first, in this PR
  • Conformance aliases and canonical symlinks are unchanged; canonical targets are edited instead

Verification

  • make check green (host), and make verify exit 0
  • make desktop-bench passes locally (AMD Ryzen 9 6900HX: source 3.4 ms, live 12.4 ms), with and without CI=true
  • The gate fails on purpose: with localTypingBudget set to 5 ms, go test -run '^$' -bench BenchmarkTypingInALongNote -benchtime 100x ./internal/desktop/editor/ fails BenchmarkTypingInALongNote/live with a keystroke took 12.41407ms, over the typing gate of 5ms (local 5ms, CI 25ms), and make desktop-bench fails TestTypingBudgets
  • Workflows changed: comment only; pins, permissions and persist-credentials unchanged

Review

Cross-review: openai/gpt-6.1-sol (coder anthropic/claude-opus-5-5), base c7d68a7.

  • Review at 003d2af: Ready, Blocking: none. 1 low finding: the ADR said only CI=true selects the CI gate, but strconv.ParseBool also takes 1, t and TRUE. Fixed in 1806b55 (wording only).
  • Re-review 1 at 1806b55: Ready, no findings.

Revert test: the change is a new gate, not a fix of code under test. The check is the forced failure above (the gate set to 5 ms fails BenchmarkTypingInALongNote/live and TestTypingBudgets).

… on CI

GitHub's runners draw different CPUs, and the same code measured 10.4 to
21.1 ms a keystroke in live preview across 19 runs, so a 16 ms gate on
CI passed or failed by the runner. make desktop-bench now fails over
localTypingBudget (16 ms), or over ciTypingBudget (25 ms) when CI=true.
TestTypingBudgets keeps the two values apart. ADR-0043 records the
limits and the figures.

Closes #193
@github-actions github-actions Bot added level:L2 Read the diff risk:high Touches a path in .github/risk-paths.json labels Nov 12, 2026
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 12, 2026
@bketelsen
bketelsen merged commit 02345c0 into main Nov 12, 2026
12 checks passed
@bketelsen
bketelsen deleted the irulan/193-ci-typing-gate branch November 12, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L2 Read the diff ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a path in .github/risk-paths.json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

desktop: live preview typing is over the 16 ms gate on the CI runner with per-line styles

2 participants