Skip to content

Issue #9: enforce the 500 ms chapter-change budget and close the issue - #191

Merged
anantham merged 2 commits into
mainfrom
claude/issue9-chapter-change-perf
Sep 25, 2026
Merged

anantham merged 2 commits into
mainfrom
claude/issue9-chapter-change-perf

Conversation

@anantham

@anantham anantham commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Closes local issue #9 (issues/09-chapter-change-perf-logging). The fix, racing the URL and stableId lookups, shipped on 2026-05-15. What remained was the closing gate's browser check.

Changes

  • New spec: tests/e2e/chapter-change-perf.spec.ts.
    • Seeds four translated chapters through the app's own session import. There is no network access and no provider call.
    • Times three Next clicks from the click until the new chapter's text is painted (two frames after it enters the DOM).
    • Asserts each change takes ≤ 500 ms, citing CORE-006's featureLoading: '< 500ms from trigger'.
    • Asserts each change emits ≤ 2 console.log lines. Logs are timestamped in the page, and only those between the click and the paint count, after startup has been quiet for 1 s.
  • Issue docs: the feat(db): add migration safety storage layer #9 closing gate is checked off.

Review fix (independent Codex review of 492ff1d)

The first version counted every log that arrived while a change was being timed. On the reviewer's machine, late startup and migration logs landed in that window, and 3 of 5 runs failed with counts of 4, 5 and 12. Commit f93c5c4 counts only logs attributed to the change. An injected burst of late startup logs no longer changes the count. The two attributed lines are the AutoTranslateMediator's "State change detected" and "Translation already cached".

Measurements

Setting Chapter change Console lines per change
Single run, dev server, no CPU throttle 47–80 ms 2
5 parallel workers 53–382 ms 2
Independent Node 24 review 30–75 ms —

A deliberately lowered time budget makes the spec fail.

Limits

  • Real large-novel, background-tab and physical-device timing were not re-run.
  • Playwright doesn't run in CI yet (roadmap T0.4), so this spec is a local gate. Run it with npx playwright test tests/e2e/chapter-change-perf.spec.ts.
  • Under heavy parallel load the timings approach the budget.

Verification

  • Spec: 5/5 passes with 5 parallel workers, and 3/3 with injected startup noise.
  • eslint and tsc -p tsconfig.playwright.json on the spec: clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_011d1MbSabs9nA9d9w8pxP1W

The lookup race that fixed #9 shipped on 2026-05-15, but the closing gate
still lacked a browser check. tests/e2e/chapter-change-perf.spec.ts seeds
four translated chapters through the app's session import and times each
Next click until the new text is painted: 47-80 ms across three dev-server
runs against CORE-006's 500 ms featureLoading budget. It also asserts at
most 2 console.log lines per change (measured: 2). A lowered budget fails it.

Issue #9 moves to issues/ARCHIVE.md; real-novel and device timing were not
re-run. Playwright is not in CI yet, so this is a local gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011d1MbSabs9nA9d9w8pxP1W
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexicon-forge Ready Ready Preview Sep 25, 2026 7:09am UTC

… them

Review of #191: the console budget counted every log arriving while a
change was timed, so late startup/migration logs landed in the window
(counts of 4, 5 and 12 on a slower machine). The spec now timestamps logs
in the page, waits for startup to be quiet for 1 s, and counts only logs
between the click and the paint. An injected burst of late startup logs no
longer changes the count; 5/5 runs pass with five parallel workers.

Issue #9's dossier and archive entry describe the method and the timings
under contention (up to 382 ms) instead of a bare '2 lines'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011d1MbSabs9nA9d9w8pxP1W
@anantham
anantham merged commit c9da4fd into main Sep 25, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Preview — f93c5c44 Deployed Sep 25, 2026 by vercel[bot]
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.

2 participants