Skip to content

[CI] test: reduce replay oracle time by 20.93% with scratch cell reuse - #26162

Merged
nwparker merged 1 commit into
mainfrom
nwparker/replay-oracle-cell-reuse
Oct 7, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/replay-oracle-cell-reuse

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The terminal replay tests inspect the same cells while creating fewer temporary objects. The application behaves the same.

What Changed

Two test-oracle scans reuse one existing xterm scratch cell per invocation. Every cell is read synchronously before that scratch cell is overwritten; no scratch object escapes or survives the scan. The scans keep their original bounds, blank-cell policy, clipping rules and background-row decisions.

Why

These scans previously allocated a new cell for each inspected coordinate. The oracle already uses xterm's supported scratch-cell API in its other comparisons, so this follows the existing implementation. It preserves fresh terminal instances and the full replay matrix instead of reducing transcripts, schedules, checkpoints or assertions.

Complete 112-case command Before After Reduction
Pair 1, before then after 19.468 s 15.107 s 22.40%
Pair 2, after then before 18.832 s 15.602 s 17.15%
Pair 3, before then after 19.140 s 14.710 s 23.15%
Mean 19.147 s 15.140 s 20.93%

Measurements use frozen source 6d90d51802ddacbbcddaf4af6eeee85972b23789, the same 112 cases, four workers, isolated Bun forks, all six setup files and fsModuleCache=false. Times cover the complete pnpm test process through exit. All contended attempts remain recorded in the noise ledger and raw archives. Only samples that failed the external-coordinator guard were repeated; every qualified sample, including its timing, was retained. Retries delayed the planned order without changing either arm. The mean improvement is 1.265×. Final-head CI passed; this cohort does not establish the whole-suite 2× goal.

Linked Issue

Maintainer-requested test performance follow-up.

Visual Proof

N/A — only test-oracle allocation changes; no application interaction or rendering change.

Testing

  • Automated tests exercised locally on macOS under both the Bun coordinator and stock Node.
  • Existing tests and assertions retained; no new assertions mirror the allocation implementation.

Both runtimes passed the same 127-case qualification: 125 passes and two existing optional old-addon skips, with shuffle seeds 104729 and 130363 respectively. This includes all 112 transcript cases, the original differential cases and 12 cell-descriptor policy cases.

Before timing, an identical temporary capture recorded every complete replay result before and after. All 1,792 runs (112 transcripts × four resize schedules × two ConPTY settings × two seeds), 9,838 checkpoints and 29,514 serialized strings matched byte-for-byte. The comparison retained every scope flag, grid/wrap mismatch, clipped-cell count and raw output string; it discarded or normalized no fields. The canonical captures share SHA-256 4b5c803a01fe3037dbbbf6f27110aab6bb8c2bed50b875c1d1c191b5ee64d67c. The temporary recorder is absent from the timed and shipping changes.

After rebasing onto main e6bcc5a6e0fd, all 227 frozen measured inputs remained byte-identical. The same 127-case qualification passed again under both Bun and stock Node with fsModuleCache=true, preserving every original case/status and all six setup files. pnpm tc:node, the changed-code quality gate, formatting and pre-commit lint passed. Final Linux CI run 37599249608 tested merge source 47b41f6df7bf with parents main e6bcc5a6e0fd and PR head 8a40b66a22cd; its entire tree matches the PR head. All 11,413 physical unit files ran exactly once: 11,278 passed, 135 existing skips, zero failures or unhandled errors. Cases: 110,720 passed, one expected failing case, 1,035 existing skips. Original routes remained 10,334 Bun / 1,078 actual Node runtime / one Node measurement. All incoming-main files were retained. All 35 contexts finished successfully or skipped, and no review threads are unresolved. No bot review was recorded; independent source review and full CI are the review evidence.

Review

The installed xterm implementation preserves undefined/out-of-range behavior and overwrites content, foreground, background, combined text and extended attributes on each scratch-cell load. Both helper changes were reconstructed from the frozen baseline and checked against the qualified candidate hashes. The existing provider transcripts, known variant failures, Hermes/DSB/freebuff diagnostic hashes and 600,000 ms per-case timeout are unchanged.

Passing assertions alone would not prove this oracle preserves which serializer defects it reports. Complete raw-result parity supplies that additional evidence; it does not fix existing serializer defects or establish native terminal latency.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer source copied or translated.

Notes

No production serializer, native process signalling, agent-status state, SSH boundary, wire format, runtime routing or application packaging changes. Final Linux unit CI passed; local qualification was on macOS. No Windows replay qualification is claimed. The terminal-session-reliability manifest has no matching gate for these two exact oracle-helper paths; the complete transcript matrix above is the relevant qualification. No native provider or real-PTY behavior changes.

Checklist

  • Small, focused change and mechanism explained
  • Visual proof is N/A with reason
  • Independent source review and complete replay-output parity
  • Cross-platform and SSH impact considered
  • Final three-pair measurements and current-head repository/CI checks complete

@coderabbitai

coderabbitai Bot commented Oct 7, 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: 9d094130-1489-436c-8832-2e502713bb3d
📥 Commits

Reviewing files that changed from the base of the PR and between e6bcc5a and 8a40b66.

📒 Files selected for processing (2)
  • src/main/daemon/serialize-grid-roundtrip.ts
  • src/main/daemon/serialize-grid-variant-scope.ts

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


📝 Walkthrough

Walkthrough

The grid serialization scans now obtain a reusable null cell from the active buffer. countClippedWideCells passes it to cellDescriptor. hasTrailingBackgroundRow passes the same scratch cell to getCell during its text and background scans.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 8a40b

The changes are limited to test-oracle scans, and available evidence establishes no actionable behavior difference or merge-blocking issue.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 identifies the test replay performance improvement and the scratch-cell reuse that drives it.
Description check ✅ Passed The description covers the required sections and explains the change, rationale, measurements, testing, visual-proof status, review, and compatibility considerations. The maintainer-requested follow-u…
  • 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 81ba5c3 into main Oct 7, 2026
35 checks passed
@nwparker nwparker changed the title test: reduce replay oracle time by 20.93% with scratch cell reuse [CI] test: reduce replay oracle time by 20.93% with scratch cell reuse 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