Skip to content

[CI] test: speed terminal comparisons and retry-policy checks - #26396

Merged
nwparker merged 1 commit into
mainfrom
nwparker/terminal-test-helper-performance
Oct 8, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/terminal-test-helper-performance

Conversation

@nwparker

@nwparker nwparker commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​24 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23

ELI5

Two terminal test helpers do avoidable work: a replay comparison formats every trailing blank cell, and a pure retry-policy test sleeps between mocked attempts. Direct blank-cell checks reduce the four-file replay command from 36.35 to 23.55 seconds; scoped virtual timers reduce the retry test command from 4.80 to 2.39 seconds. Each keeps its original coverage.

What Changed

The existing terminal comparison helper now recognizes the frozen default blank descriptor through its public cell fields. It keeps the original descriptor formatter for diagnostics and other comparisons. Terminal parsing, serialization, replay input, checkpoints, assertions and runtime routing remain unchanged.

The separate retry-policy unit test advances only its owned timeout timers through the existing retry delays. Its seven original expanded cases, evaluator calls and assertions remain intact, and real timers are restored after each test. The production retry helper, attempt limit and delays are unchanged; this file exercises injected evaluators, with no Electron application or native lifecycle.

Why

Profiling pointed to repeated blank-cell formatting. This removes those temporary strings while preserving the existing blank-cell policy, including backgrounds, inverse attributes, clipped widths and decorated spaces. It extends the existing comparison helper rather than adding a second terminal implementation or reducing replay coverage. The retry tests check policy using controlled timers, which avoids waiting on their injected delays while retaining every retry and failure assertion. Real socket, PTY and shutdown timing contracts retain their configured Node routes.

Linked Issue

Part of the authorized test-suite speed work; no existing issue.

Visual Proof

N/A — test comparison helper only; no rendered product changes.

Testing

The original and changed helper ran under Node and Bun with two shuffle seeds each: 130 original cases, 128 passed and two existing skipped fuzz cases, in every command. An additional comparison of the existing replay output retained all 1,792 runs and 9,838 complete checkpoints, with all 29,514 resulting strings byte-for-byte identical.

A separate uninstrumented benchmark used the shipping filesystem cache, four workers, isolation and all six setup files on one held ARM runner. All six whole pnpm test commands count, including the first; there were no warmups, retries or discarded samples.

Pair Before After Time reduction
1 35.7220 s 22.5991 s 36.7361%
2 35.9601 s 23.4022 s 34.9217%
3 37.3581 s 24.6621 s 33.9847%
Mean 36.3467 s 23.5545 s 35.1951%

This is a 1.5431× speedup for these four files, not a whole-suite or fleet claim. Counted commands can warm shared Bun and operating-system caches; the arms are not independently cold.

Correctness: 37708535460. Timing: 37711326761. Original raw reports, failures and every measured sample are retained and independently checked.

The separate retry file also passed all eight original/candidate Node/Bun commands at the same two shuffle seeds: seven original cases passed in every command. Its own shipping-cache held benchmark retained all six whole commands, with no warmup, retry or discarded sample:

Pair Before After Time reduction
1 4.7937 s 2.3938 s 50.0624%
2 4.8188 s 2.4099 s 49.9897%
3 4.7821 s 2.3688 s 50.4653%
Mean 4.7982 s 2.3908 s 50.1719%

This is a 2.0069× speedup for that one file. Its benchmark has the same first-command, shared-cache and single-host limits stated above. Correctness: 37711634618. Timing: 37714488664. Both scopes were measured separately; these gains are not multiplied or presented as a combined/full-suite result. A fresh full CI run checks their integration together.

  • Original cases, assertions and complete replay strings preserved.
  • Node and Bun qualification with two seeds each.
  • All three measured pairs improved.
  • Formatting, changed-code quality and Node typecheck on the product branch.
  • Shipping PR CI passed on final head fb42f75c59a13ef2e5d8692a0b203f96b9683af3: all ten full unit shards, actual Node relay contracts, static/type checks, required verify and applicable platform checks.

Review

Missing cells, ordinary blank cells and undecorated spaces keep exactly the original default-blank classification. The existing scratch cell remains local to the comparison; no mutable buffer cache is introduced.

Agent skill upstream boundary

  • Not applicable; no upstream skill source copied.

Notes

Test helper only; no production serializer, remote protocol, native runtime boundary, platform behavior or fixture corpus changes. The branch starts from repaired main b0fbcfd6a7e919743856dcd96198897baa92593e. Both changed files exactly match the separately qualified before/after bytes. All 21 replay source guards, all four original consumers and both fixture trees (231 and 12 entries) match the measured source. All 41 reported check contexts succeeded or were appropriately skipped. CodeRabbit covered this exact head and reported no actionable comments; zero unresolved threads. Current-main integration preserves both qualified payloads, all 21 measured source guards and both fixture trees exactly. The two individually measured gains remain scoped to their original commands, without a combined or whole-CI claim.

Checklist

  • Small and focused.
  • Before/after behavior, mechanism and alternatives explained.
  • Visual proof N/A with reason.
  • Self-reviewed equivalence and replay coverage.
  • Cross-platform and SSH impact considered.
  • Final branch checks and PR CI complete; no unresolved review comments.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 32228703-8cd8-42f7-a019-160707014e31
📥 Commits

Reviewing files that changed from the base of the PR and between b0fbcfd and fb42f75.

📒 Files selected for processing (2)
  • src/main/daemon/serialize-grid-cell-descriptors.ts
  • tests/e2e/helpers/electron-main-evaluate-retry.unit.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The grid serializer adds an isDefaultBlank predicate and uses it when trimming row endings. The transient-retry tests use fake timers, advance time for success and exhausted-retry cases, and restore real timers after each test.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to fb42f

The changes are limited to the grid helper and retry tests, with no identified behavior regression. Normal final-head checks remain appropriate.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description is detailed and covers the required change, rationale, testing, scope, and checklist items. However, the required Linked Issue section explicitly states that no existing issue is linke… Link the actual issue addressed by this pull request in the Linked Issue section. If no issue exists, create or identify the required issue before merging.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the two test-helper performance improvements.
Full details: Description check

Explanation

The description is detailed and covers the required change, rationale, testing, scope, and checklist items. However, the required Linked Issue section explicitly states that no existing issue is linked.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@nwparker
nwparker merged commit 00a8250 into main Oct 8, 2026
41 checks passed
@nwparker nwparker changed the title test: speed terminal comparisons and retry-policy checks [CI] test: speed terminal comparisons and retry-policy checks Oct 9, 2026
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