Skip to content

test(terminal): headless redraw-drain harness + real-parser coalescing proof#180

Merged
kjgbot merged 3 commits into
mainfrom
test/redraw-drain-harness
Jun 9, 2026
Merged

test(terminal): headless redraw-drain harness + real-parser coalescing proof#180
kjgbot merged 3 commits into
mainfrom
test/redraw-drain-harness

Conversation

@kjgbot

@kjgbot kjgbot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What

Two headless validations for the terminal renderer lag/duplication work — no live agent swarm required (running a swarm overloads the very renderer under test, which is what crashed the app during investigation). Finishes the scaffolded redraw-drain work and adds a real-parser correctness proof.

Test-only: writeChunks is left at the main baseline here; the production coalescing fix lives in its own PR (#179). The only production-code addition is a small read-only probe gated on VITE_PEAR_MOCK_IPC (web/mock build), tree-shaken from the Electron bundle.

1. Real-parser equivalence proof — pty-coalesce-equivalence.test.ts

Uses @xterm/headless (real VT parser + buffer, no DOM) to prove that writing a cursor-addressing redraw stream per-chunk is byte-for-byte identical to one coalesced write — including the hard case where a chunk boundary falls in the middle of a CSI sequence (\x1b[12 + ;1H). This is the correctness justification behind #179's coalescing; if a future xterm bump broke the streaming-parser property, this goes red.

Runs in vitest (node project) in ~170ms.

2. Headless drain harness — redraw-drain.spec.ts (npm run test:redraw)

Playwright drives real xterm + real predictive-echo in headless Chrome via window.__pearMock.injectPtyChunk, reading the parsed grid back through the new readRuntimeViewportText probe.

Finishes the team's burst mode (the config existed; the inject loop didn't use it): REDRAW_BURST_FRAMES injects N redraw frames into one rAF flush — the exact condition write-coalescing acts on. With one chunk per frame the change is invisible; burst mode isolates it.

Per-chunk vs coalesced (16 frames/flush × 120 = 1920 frames)

Metric Per-chunk (baseline) Coalesced (#179)
Max render lag 1773 frames 16 frames
Frames rendered 833 / 1920 (43%) 1920 / 1920 (100%)
Drained within 8s no (never) yes (26ms)
Longest frame 119.7ms 53.8ms

Under per-chunk writes the renderer falls ~1773 frames behind and never catches up; coalescing collapses the N predictive-echo headless-model parses + promise ticks into one per flush, so the grid keeps up — full drain, lag bounded to one burst. See REDRAW-DRAIN-RESULTS.md.

Notes

Gates: vitest 238/238, tsc --noEmit clean, build:web + test:redraw pass.

🤖 Generated with Claude Code

…g proof

Two headless validations for the terminal renderer lag/duplication work, with
no live agent swarm (which overloads the very renderer under test):

1. pty-coalesce-equivalence.test.ts — proves with the REAL xterm VT parser
   (@xterm/headless) that writing a redraw stream per-chunk is byte-for-byte
   identical to one coalesced write, including chunk boundaries that fall in
   the MIDDLE of a CSI sequence. This is the correctness justification for the
   write-coalescing change (PR "coalesce per-frame PTY chunks into one write").

2. redraw-drain.spec.ts — Playwright harness driving real xterm + predictive
   echo in headless Chrome via window.__pearMock, reading the parsed grid back
   through a new gated readRuntimeViewportText probe. Finishes the team's
   scaffolded burst mode: REDRAW_BURST_FRAMES injects N redraw frames into one
   rAF flush — the condition coalescing acts on. Per-chunk vs coalesced:
   max render lag 1773→16 frames, rendered 43%→100%, never-drains→drains in
   26ms, longest frame 120ms→54ms. See REDRAW-DRAIN-RESULTS.md.

The probe is gated on VITE_PEAR_MOCK_IPC (web/mock build only), tree-shaken
from the Electron bundle. writeChunks is left at the main baseline here; the
production coalescing fix lives in its own PR.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@codeant-ai

codeant-ai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@agent-relay-code[bot], we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 40 minutes and 21 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 191e96d1-7a03-4bd9-a953-de04ee380a2f

📥 Commits

Reviewing files that changed from the base of the PR and between 1a5bd5d and f9bbd6b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • package.json
  • playwright.redraw.config.ts
  • src/renderer/src/lib/pty-coalesce-equivalence.test.ts
  • src/renderer/src/lib/terminal-runtime-registry.ts
  • tests/playwright/.gitignore
  • tests/playwright/REDRAW-DRAIN-RESULTS.md
  • tests/playwright/redraw-drain.spec.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/redraw-drain-harness

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@agent-relay-code

Copy link
Copy Markdown
Contributor

ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed.

Reviewed PR #180 against .workforce/pr.diff, changed files, and context. I did not find a demonstrated code issue that required editing.

Addressed comments

  • No bot or reviewer comment artifacts were present in .workforce; there were no external review threads available to validate against the current checkout.

Local validation run:

  • npm install
  • npx vitest run src/renderer/src/lib/pty-coalesce-equivalence.test.ts src/renderer/src/lib/terminal-runtime-registry.dom.test.ts passed
  • npm run build:web passed
  • npx playwright install chromium
  • npm run test:redraw passed after installing the Playwright browser

I removed the local test-results artifact after the Playwright run. I am not ending with READY because GitHub CI status and mergeability were not available to verify from the provided local artifacts.

@codeant-ai

codeant-ai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI.

@agent-relay-code

Copy link
Copy Markdown
Contributor

Fixed one validated breakage: @xterm/headless is now declared as a direct dev dependency for the new Vitest file that imports it.

Changed:

Validation run:

  • npm exec -- vitest run src/renderer/src/lib/pty-coalesce-equivalence.test.ts src/renderer/src/lib/terminal-runtime-registry.dom.test.ts --reporter=verbose
  • npm run build:web
  • npm run test:redraw
  • npm test
  • npm exec -- tsc -p tsconfig.web.json --noEmit

All passed locally. I also removed the generated test-results artifact.

Addressed comments

  • gemini-code-assist[bot]: quota-limit warning, no code issue raised; no change needed.
  • codeant-ai[bot]: free trial review limit warning, no code issue raised; no change needed.
  • coderabbitai[bot]: review/rate limit warning, no actionable finding raised; no change needed.
  • agent-relay-code[bot]: said no file changes were needed; stale for the current checkout because src/renderer/src/lib/pty-coalesce-equivalence.test.ts failed to resolve @xterm/headless; fixed in package.json:68 and package-lock.json:49.

I queried PR metadata once: GitHub reported the PR mergeable at the checked head, and the only returned status was CodeRabbit: success. I’m not ending with READY because the local dependency edit still needs the harness push/CI cycle before post-edit CI can be considered complete.

@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #180 from .workforce/pr.diff, changed files, and context. I did not find a demonstrated code defect that required editing.

Addressed comments

  • No bot or reviewer comment artifacts were present in .workforce; there were no review threads to validate or fix.

Validation run locally:

  • npm install
  • npx vitest run src/renderer/src/lib/pty-coalesce-equivalence.test.ts
  • npm run build:web
  • npm run test:redraw
  • npx vitest run src/renderer/src/lib/terminal-runtime-registry.dom.test.ts src/renderer/src/lib/pty-coalesce-equivalence.test.ts
  • npm test
  • npm run build

All of the above passed after installing the required Playwright Chromium browser locally. I did not verify GitHub CI status, mergeability, or PR conflict state from GitHub, so I am not ending with READY.

@codeant-ai

codeant-ai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI.

@agent-relay-code

Copy link
Copy Markdown
Contributor

pr-reviewer applied fixes — committed and pushed f9bbd6b to this PR. The notes below describe what changed.

Reviewed PR #180 and made one small fix: corrected misleading wording in pty-coalesce-equivalence.test.ts that claimed writeChunks already coalesces writes. Current checkout still writes chunks in a loop, so the test now describes the coalescing behavior as the optimization/property under test.

Validation run:

  • npm install
  • npm exec -- vitest run src/renderer/src/lib/pty-coalesce-equivalence.test.ts src/renderer/src/lib/terminal-runtime-registry.dom.test.ts --reporter=verbose
  • npm exec -- tsc -p tsconfig.web.json --noEmit
  • npm run build:web
  • npm test
  • npx playwright install chromium
  • npm run test:redraw

All passed locally. I removed generated test-results, out, and tsconfig.web.tsbuildinfo artifacts afterward.

Addressed comments

  • gemini-code-assist[bot]: quota-limit warning only; no actionable code issue raised, so no change needed.
  • codeant-ai[bot] at 2026-06-09T06:55:25Z: trial-limit warning only; no actionable code issue raised, so no change needed.
  • coderabbitai[bot]: review/rate-limit warning only; no actionable code issue raised, so no change needed.
  • agent-relay-code[bot] at 2026-06-09T07:02:22Z: reported no demonstrated issue; stale because the current checkout did have misleading coalescing wording, fixed in src/renderer/src/lib/pty-coalesce-equivalence.test.ts:4.
  • codeant-ai[bot] at 2026-06-09T07:11:37Z: repeated trial-limit warning only; no actionable code issue raised, so no change needed.
  • agent-relay-code[bot] at 2026-06-09T07:11:38Z: noted @xterm/headless dependency resolution; current checkout already has it in package.json and package-lock.json, so no change needed for that stale finding.

I’m not ending with READY because post-edit remote CI and GitHub mergeability were not fully verifiable from the available connector state.

@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #180 against .workforce/pr.diff, changed files, current checkout, PR comments, and remote metadata. I did not find a current defect that required editing.

Validation run:

  • npm install
  • npm exec -- vitest run src/renderer/src/lib/pty-coalesce-equivalence.test.ts src/renderer/src/lib/terminal-runtime-registry.dom.test.ts --reporter=verbose
  • npm exec -- tsc -p tsconfig.web.json --noEmit
  • npm run build:web
  • npm test
  • npm run test:redraw

All local commands passed. I removed generated out, test-results, and tsconfig.web.tsbuildinfo artifacts afterward.

Addressed comments

  • gemini-code-assist[bot] at 2026-06-09T06:55:25Z: quota-limit warning only; no actionable code issue raised.
  • codeant-ai[bot] at 2026-06-09T06:55:25Z: free-trial review-limit warning only; no actionable code issue raised.
  • coderabbitai[bot] at 2026-06-09T06:55:29Z: review/rate-limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:02:22Z: reported no demonstrated code issue; current checkout still validates, no change needed.
  • codeant-ai[bot] at 2026-06-09T07:11:37Z: repeated free-trial review-limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:11:38Z: raised missing @xterm/headless; stale, already present in package.json:68 and package-lock.json:49.
  • agent-relay-code[bot] at 2026-06-09T07:20:46Z: reported no demonstrated code issue; current checkout still validates, no change needed.
  • codeant-ai[bot] at 2026-06-09T07:22:23Z: repeated free-trial review-limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:22:26Z: raised misleading coalescing wording; stale, already corrected in src/renderer/src/lib/pty-coalesce-equivalence.test.ts:4.

Remote metadata showed the PR as mergeable/clean, GitHub Actions check-runs completed successfully, CodeRabbit status succeeded, and the cubic · AI code reviewer check completed neutral due to its monthly review limit. I am not ending with READY because one returned check conclusion is neutral rather than passing.

@agent-relay-code

Copy link
Copy Markdown
Contributor

pr-reviewer could not complete review for #180 in AgentWorkforce/pear.
The review harness exited with code 1.
No review was posted; this needs operator attention.

@agent-relay-code

Copy link
Copy Markdown
Contributor

ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed.

pr-reviewer could not complete review for #180 in AgentWorkforce/pear.
The review harness exited with code 1.
No review was posted; this needs operator attention.

@agent-relay-code

Copy link
Copy Markdown
Contributor

Reviewed PR #180 against .workforce/pr.diff, changed files, current checkout, PR comments, and remote metadata. I found no current defect that required editing.

Local validation passed:

  • npm install
  • npm exec -- vitest run src/renderer/src/lib/pty-coalesce-equivalence.test.ts src/renderer/src/lib/terminal-runtime-registry.dom.test.ts --reporter=verbose
  • npm exec -- tsc -p tsconfig.web.json --noEmit
  • npm test
  • npm run build:web
  • npm run test:redraw

Generated out/, test-results/, and tsconfig.web.tsbuildinfo were removed afterward. GitHub API returned the PR as mergeable/clean and the current head as f9bbd6b99473b860f0fc984a79fdc7bc9b4dc88b; Actions checks were successful, CodeRabbit status was successful, and cubic · AI code reviewer completed with a neutral monthly-limit result. I am not ending with READY because that neutral check is not a passing conclusion.

Addressed comments

  • gemini-code-assist[bot] at 2026-06-09T06:55:25Z: quota-limit warning only; no actionable code issue raised.
  • codeant-ai[bot] at 2026-06-09T06:55:25Z: free-trial review-limit warning only; no actionable code issue raised.
  • coderabbitai[bot] at 2026-06-09T06:55:29Z: review/rate-limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:02:22Z: reported no demonstrated code issue; current checkout still validates, no change needed.
  • codeant-ai[bot] at 2026-06-09T07:11:37Z: repeated free-trial review-limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:11:38Z: raised missing @xterm/headless; stale, already present in package.json:68 and package-lock.json:49.
  • agent-relay-code[bot] at 2026-06-09T07:20:46Z: reported no demonstrated code issue; current checkout still validates, no change needed.
  • codeant-ai[bot] at 2026-06-09T07:22:23Z: repeated free-trial review-limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:22:26Z: raised misleading coalescing wording; stale, already corrected in src/renderer/src/lib/pty-coalesce-equivalence.test.ts:4.
  • agent-relay-code[bot] at 2026-06-09T07:30:36Z: reported no current defect and noted neutral cubic result; current checkout still matches that assessment.
  • agent-relay-code[bot] at 2026-06-09T07:35:04Z: harness exit/operator-attention notice only; no file-specific code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:35:24Z: repeated harness exit/operator-attention notice only; no file-specific code issue raised.

@agent-relay-code

Copy link
Copy Markdown
Contributor

ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed.

Reviewed PR #180 against .workforce/pr.diff, changed files, current checkout, and PR comments. I did not find a current defect requiring source edits. The prior actionable items are already present in this checkout.

Validation passed locally:

  • npm install
  • npm exec -- vitest run src/renderer/src/lib/pty-coalesce-equivalence.test.ts src/renderer/src/lib/terminal-runtime-registry.dom.test.ts --reporter=verbose
  • npm exec -- tsc -p tsconfig.web.json --noEmit
  • npm test
  • npm run test:redraw

Generated artifacts from validation were removed: out, test-results, tsconfig.web.tsbuildinfo, bin/relayfile-mount, and bin/.relayfile-mount-version.

Remote metadata checked via GitHub: PR is mergeable/clean; GitHub Actions checks and packaged-mcp-smoke passed; commit status CodeRabbit passed. The cubic · AI code reviewer check completed as neutral, so I am not ending with READY. Source: #180

Addressed comments

  • gemini-code-assist[bot] at 2026-06-09: quota-limit warning only; no actionable code issue raised.
  • codeant-ai[bot] at 2026-06-09T06:55:25Z: free-trial limit warning only; no actionable code issue raised.
  • coderabbitai[bot] at 2026-06-09: review/rate-limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:02:22Z: reported no demonstrated code issue; current checkout validates, no change needed.
  • codeant-ai[bot] at 2026-06-09T07:11:37Z: repeated free-trial limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:11:38Z: raised missing @xterm/headless; stale, already present in package.json:68 and package-lock.json:49.
  • agent-relay-code[bot] at 2026-06-09T07:20:46Z: reported no demonstrated code issue; current checkout validates, no change needed.
  • codeant-ai[bot] at 2026-06-09T07:22:23Z: repeated free-trial limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:22:26Z: raised misleading coalescing wording; stale, already corrected in src/renderer/src/lib/pty-coalesce-equivalence.test.ts:4.
  • agent-relay-code[bot] at 2026-06-09T07:27:xxZ and 2026-06-09T07:28:xxZ: harness exit-code/operator-attention comments only; current local validation completed successfully, no code change needed.

@agent-relay-code

Copy link
Copy Markdown
Contributor

ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed.

Reviewed PR #180 and found no current defect requiring edits in this checkout. The prior actionable findings are already handled in the PR.

Validation passed locally:

  • npm install
  • npm exec vitest -- run src/renderer/src/lib/terminal-runtime-registry.dom.test.ts src/renderer/src/lib/pty-coalesce-equivalence.test.ts --reporter=verbose
  • npm exec tsc -- -p tsconfig.web.json --noEmit
  • npm run build:web
  • npm run test:redraw
  • npm run build
  • npm test
  • npm run verify:mcp-resources-drift

I removed generated out/, test-results/, *.tsbuildinfo, and relayfile-mount binaries afterward. A broad tsc -b still fails on existing unrelated main-process/test typing issues, so I did not use it as PR validation.

Remote metadata fetched through the GitHub connector: PR is open and mergeable, the GitHub Actions workflow jobs checks and packaged-mcp-smoke completed successfully, and combined commit status returned CodeRabbit: success. Prior PR comments report a neutral cubic · AI code reviewer result, so I am not ending with READY.

Addressed comments

  • gemini-code-assist[bot] at 2026-06-09T06:55:25Z: quota-limit warning only; no actionable code issue raised.
  • codeant-ai[bot] at 2026-06-09T06:55:25Z: free-trial review-limit warning only; no actionable code issue raised.
  • coderabbitai[bot] at 2026-06-09T06:55:29Z: review/rate-limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:02:22Z: reported no demonstrated code issue; current checkout validates, no change needed.
  • codeant-ai[bot] at 2026-06-09T07:11:37Z: repeated free-trial review-limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:11:38Z: raised missing @xterm/headless; stale, already handled in package.json:68 and package-lock.json:49.
  • agent-relay-code[bot] at 2026-06-09T07:20:46Z: reported no demonstrated code issue; current checkout validates, no change needed.
  • codeant-ai[bot] at 2026-06-09T07:22:23Z: repeated free-trial review-limit warning only; no actionable code issue raised.
  • agent-relay-code[bot] at 2026-06-09T07:22:26Z: raised misleading coalescing wording; stale, already corrected in src/renderer/src/lib/pty-coalesce-equivalence.test.ts:4.
  • agent-relay-code[bot] at 2026-06-09T07:30:36Z: reported no current defect and noted a neutral external reviewer check; current checkout still matches that assessment.
  • agent-relay-code[bot] at 2026-06-09T07:35:04Z: harness exit/operator-attention notice only; local validation now completed successfully, no code change needed.
  • agent-relay-code[bot] at 2026-06-09T07:35:24Z: repeated harness exit/operator-attention notice only; local validation now completed successfully, no code change needed.
  • agent-relay-code[bot] at 2026-06-09T07:43:44Z: reported no current defect and neutral external reviewer check; current checkout still matches that assessment.
  • agent-relay-code[bot] at 2026-06-09T07:50:22Z: reported no current defect; current checkout validates, no change needed.

@agent-relay-code

Copy link
Copy Markdown
Contributor

pr-reviewer could not complete review for #180 in AgentWorkforce/pear.
The review harness exited with code 1.
No review was posted; this needs operator attention.

@kjgbot kjgbot merged commit c371ce7 into main Jun 9, 2026
4 checks passed
@kjgbot kjgbot deleted the test/redraw-drain-harness branch June 9, 2026 08:18
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