Skip to content

Use named types in the terminal write-spy unit fixture - #24600

Closed
nwparker wants to merge 1 commit into
mainfrom
nwparker/fix-terminal-pty-spy-ci-types-20261002
Closed

nwparker wants to merge 1 commit into
mainfrom
nwparker/fix-terminal-pty-spy-ci-types-20261002

Conversation

@nwparker

@nwparker nwparker commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

This PR is superseded by main and will be closed without merging. Main 1241ce1b49ac1dade61c371d96b235610f40ff65 already removes the three documented static findings with its own reviewed test fixture. Its fixture SHA-256 is b9f1b0d91f8bb374c39e2167953f89d6c8a05302cfd82c220ba9ed0d8a236caf, unchanged from the named main used in the independent integration review. Main deliberately passes undefined to the mocked first callback argument; this older PR must not overwrite that newer fixture.

The exact main fixture/helper strict compiler passes, and the fixture/retry controls pass 8 tests across 2 suites. No Electron application runs. The original PR's green CI and review remain historical evidence; other older-head PRs need their own current-head qualification. No branch is deleted and nothing is merged.

The original proposal and validation follow for history.

ELI5

The terminal test describes the values it uses, so the existing code checker can verify it without rejecting an otherwise working test.

What Changed

A fixture recently added on main caused three failures in the full static audit: a broad object argument and two reflected property reads. Its mock now names the partial Electron owner and declares the optional numeric test global, allowing direct typed reads. Callback arguments, both awaited calls, assertions, values and global cleanup are unchanged. This PR contains only that test fixture.

Why

The full audit correctly scans unchanged files when a code PR runs. Repairing the fixture preserves that rule and avoids suppressions or narrower coverage. This is a separate CI readiness fix needed by performance PRs such as #24557 and #24558, not an application optimization.

Linked Issue

Internal performance audit; no pre-existing issue. CI fixture repair relates to #24557 and #24558.

Visual Proof

N/A — cleanup or test-only types; live UI and interaction behavior remain unchanged.

Testing

Exact newer-main stock fixture reproduces the same three scanner errors; repaired fixture reports zero. Author and independent reviewer each pass nine tests across the stock/fixed fixture and existing retry suite, using an isolated alias to the exact newer-main helper. Strict focused TypeScript and ordinary/scoped lint/format pass. Compiled-token and VM parity preserve two callbacks with arguments and values 35/0, removal of the stub global, original Error identity, negative-to-zero, NaN and Infinity behavior. No Electron app or window launches. This branch is parented on newer main, where the two-argument helper already exists.

All test launches used ORCA_BACKGROUND_LAUNCH=1.

  • Before/after and compatibility checks added or existing fixture preserved
  • Full platform CI (local checks passed)

Review

Independent audit_renderer review approved the frozen file hashes, reproduced the original regression and checked final compatibility.

Agent skill upstream boundary

  • Not applicable; no upstream skill material changed.

Notes

Test-only type repair; no production helper, scanner rule, suppression, workflow, credentials, input/focus, transport, wire, remote host or workspace behavior changes. Local macOS unit and strict compiler evidence; full newer-main CI and native platform runs remain pending. Performance PRs blocked by these baseline errors should rerun against the repaired main after this independent PR lands; nothing has been merged.

Checklist

  • Small, focused change with ELI5 and before/after evidence
  • Visual proof N/A explained
  • Independently reviewed for correctness and performance
  • Cross-platform, SSH/remote and folder-workspace impact considered
  • Full platform CI

Use an erased named Electron owner type and optional numeric test-global declaration instead of a broad object parameter and reflected reads.
@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b7f22a19-88c0-4273-8b90-a8cfef7b6dc1

📥 Commits

Reviewing files that changed from the base of the PR and between 306b457 and d88a78e.

📒 Files selected for processing (1)
  • tests/e2e/helpers/terminal-pty-write-spy.unit.test.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Named Electron host type — type ElectronEvaluateHost = Partial<typeof Electron> replaces the broad object parameter annotation on the mocked evaluate callback, clearing anti-slop/no-object-parameters.
  • Typed global access — declare global { var __terminalPtyWriteDelayMs: number | undefined } lets the assertions read globalThis.__terminalPtyWriteDelayMs directly instead of via Reflect.get, clearing both anti-slop/no-reflect-get hits. Callbacks, arguments, assertions, vi.stubGlobal, and cleanup are unchanged.

Verified locally: the anti-slop audit and root oxlint report 0 findings, check-changed-code-quality.mjs passes all six scans, tsc -p config/tsconfig.e2e.json reports no error for the file, and the test still passes (1/1). The two direct reads are equivalent to the removed Reflect.get for the stubbed data property, so the test still fails if the helper stops writing the global.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

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