Files
oh-my-pi/packages
Leo Kimandcan1357 7190870f49 test(tui): regression guards — no-2k literals + render emit snapshots + IME jamo cursor
Three regression layers covering the failure modes that have already cost us multiple iterations:

1. **no-2k-anywhere.test.ts** — scans `packages/tui/src/` for `\x1b[2K` literals outside comments. The streaming-flicker fix (commit `498e9c2cc`) re-introduced the BSU-split blank-flash bug by moving `\x1b[2K`-before-content from `fullRender` to `viewportRefresh` (same anti-pattern, new location). A grep-style lint catches that class of regression at CI time so a 'convenient' reintroduction can't ship.

2. **render-emit-snapshot.test.ts** — four scenario-based byte-snapshot guards: single-line mutation, streaming append, above-viewport mutation (forces `viewportRefresh`), trailing-line clear on shrink. Asserts STRUCTURAL invariants on the EMITTED BYTES from `terminal.write(…)`: no `\x1b[2K`, no `\x1b[2J`, the new content appears, the BSU close `\x1b[?2026l` is present. The existing visual-regression suite (`render-regressions.test.ts`, `overlay-scroll.test.ts`) asserts only the FINAL viewport state — a render path that achieves the right final state via a transient blank frame passes those tests, which is exactly how the typing-flicker bug slipped past CI before a user recording surfaced it.

3. **ime-jamo-cursor.test.ts** — six cases asserting the Input component's hardware cursor marker column does not grow at 2× per typed Korean compatibility jamo. Before commit `79e3170c6` typing 14 jamo produced a 14-cell gap between the visible text and the IME candidate window; the test caps the cursor column at `PROMPT_WIDTH + N_jamo` and asserts the per-keystroke delta is at most 1. The Rust `pi-natives` `sliceWithWidth` still treats jamo as 2 cells (binary-only package; follow-up), so there is a small residual offset which the test tolerates — but the doubling regression is hard-blocked.

Together these lock in the three specific failure boundaries we crossed in the recent streaming-flicker / IME-cursor work. We can't prevent ALL render bugs but we CAN prevent the same ones from coming back.

Verified: full tui suite 450 tests, 8 pre-existing failures unchanged. 11 new passing tests. `bun --cwd=packages/tui run check` clean (biome + tsgo).
2026-05-25 12:08:36 +02:00
..
2026-05-22 17:48:11 +09:00
2026-05-22 17:48:11 +09:00
2026-05-22 17:48:11 +09:00