Skip to content

chore(typescript): bump to TypeScript 7.0.2 (native port) - #1262

Merged
Wibias merged 2 commits into
lidge-jun:devfrom
Wibias:typescript-7-update
Aug 8, 2026
Merged

chore(typescript): bump to TypeScript 7.0.2 (native port)#1262
Wibias merged 2 commits into
lidge-jun:devfrom
Wibias:typescript-7-update

Conversation

@Wibias

@Wibias Wibias commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Bump the root devDependency typescript 5.9.3 → 7.0.2 — the Go-based native port (8-12x faster full builds).
  • Fix the three type-level strictness differences TS 7 surfaces in the proxy runtime:
    • native-exec-common.ts: make execBytes generic over the message case so the value type is checked consistently (removes the as never escape hatch).
    • server/index.ts: new sendUpstreamFrame helper copies Buffer frames into an ArrayBuffer-backed Uint8Array before WebSocket.send (Bun's BufferSource rejects SharedArrayBuffer-backed buffers); the live-sideband frame sends now use it.
    • server/index.ts: readyState CLOSED checks use the numeric literal 3 (with explanatory comments) where Bun's type narrows readyState to 0|1|2.
  • No runtime behavior changes; the fixes are type-system-only accommodations.
  • GUI stays on TS ~6.0.2 (typescript-eslint's <6.1.0 peer bound); TS 7 support there waits on typescript-eslint 9.x.

Validation

  • bun run typecheck — pass (TS 7.0.2)
  • bun audit — pass, 0 vulnerabilities
  • bun test focused (cursor native exec + websocket live transport) — pass, 115 tests / 0 fail
  • Full suite runs on CI (Linux shards); the Windows-local Bun crash is a documented pre-existing environment issue

Review notes

  • execBytes is called from native-exec.ts and native-exec-tools.ts with create(SomeSchema, {...}) values; the generic signature type-checks each call site exactly.
  • The readyState numeric-literal comparisons are runtime-identical to WebSocket.CLOSED (which is 3).

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of binary live updates to ensure frames are transmitted reliably.
    • Preserved text-based live updates while improving connection close-state handling.
    • Strengthened command message validation and serialization for more reliable execution.
    • Improved handling of success, metadata, and diagnostic responses.
  • Compatibility

    • Improved support for environments with stricter WebSocket type definitions.

@github-actions github-actions Bot added chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). intake: hygiene-blocked Deterministic PR hygiene checks failed labels Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates TypeScript, ties execution payload types to discriminated message cases, adds serialization tests, and normalizes binary forwarding for live-sideband upstream frames. It also updates TypeScript contract checks for version 7 compatibility.

Changes

Compatibility updates

Layer / File(s) Summary
Typed exec message payloads
src/adapters/cursor/native-exec-common.ts, tests/cursor-native-exec-common.test.ts
execBytes derives the payload type from the selected ExecClientMessage case. Tests cover MCP success, request-context, and diagnostics result round-trips.
TypeScript 7 compatibility
package.json, tests/install-scripts.test.ts, tests/translator-budget.test.ts
The TypeScript development dependency and package assertion change to 7.0.2. The standalone fixture check passes --ignoreConfig.
Live-sideband frame forwarding
src/server/index.ts
sendUpstreamFrame copies binary frames into an ArrayBuffer-backed Uint8Array. Pending and client frames use the helper. Closed-state checks use numeric state 3.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: lidge-j, ingwannu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the TypeScript 7.0.2 upgrade and the native port, which are the primary changes in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

TypeScript 7 is the Go-based native port (8-12x faster full builds).
Bump the root devDependency from 5.9.3 to 7.0.2 and fix the three
type-level strictness differences it surfaces:

- native-exec-common: make execBytes generic over the message case so
  the value type is checked consistently (removes the as never hack)
- server: sendUpstreamFrame copies Buffer frames into an ArrayBuffer-
  backed Uint8Array for WebSocket.send (BufferSource rejects
  SharedArrayBuffer-backed buffers)
- server: readyState CLOSED comparisons use the numeric literal 3 where
  Bun's type narrows readyState to 0|1|2

Adds focused regression tests for the execBytes serialization (3 cases:
mcpResult, requestContextResult, diagnosticsResult).

Verified: bun run typecheck (TS 7.0.2), bun audit clean, 70 focused
tests pass.
@Wibias
Wibias force-pushed the typescript-7-update branch from a1a52fd to 4c986e4 Compare August 8, 2026 05:36
@github-actions github-actions Bot removed the intake: hygiene-blocked Deterministic PR hygiene checks failed label Aug 8, 2026
- install-scripts: the hardcoded devDependency expectation for typescript
  moves 5.9.3 -> 7.0.2 with the bump
- translator-budget: TS 7 refuses files-on-command-line when a tsconfig is
  present (TS5112); pass --ignoreConfig so the fixture is typechecked
  standalone and the TS2554 contract assertion still fires

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/cursor-native-exec-common.test.ts`:
- Around line 65-80: Extend the test around diagnosticsResult and the decoded
value from AgentClientMessageSchema to assert the diagnostics result
discriminator is "error" and its payload contains path "/tmp/x" and error
"unsupported". Keep the existing outer message-case assertions unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 42db1251-8c6a-4b79-8bb0-8831f359d7ae

📥 Commits

Reviewing files that changed from the base of the PR and between a1a52fd and ccf85d3.

📒 Files selected for processing (3)
  • tests/cursor-native-exec-common.test.ts
  • tests/install-scripts.test.ts
  • tests/translator-budget.test.ts

Comment on lines +65 to +80
test("diagnosticsResult round-trips an error result", () => {
const bytes = execBytes(
execServerMessage({ case: "diagnosticsArgs", value: create(DiagnosticsResultSchema, {}) }),
"diagnosticsResult",
create(DiagnosticsResultSchema, {
result: {
case: "error",
value: create(DiagnosticsErrorSchema, { path: "/tmp/x", error: "unsupported" }),
},
}),
);

const decoded = fromBinary(AgentClientMessageSchema, bytes);
expect(decoded.message.case).toBe("execClientMessage");
expect(decoded.message.value.message.case).toBe("diagnosticsResult");
});

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Assert the decoded diagnostics error payload.

The test only verifies the outer message cases. It does not verify result.case, path, or error. A serializer that drops the diagnostics payload would still pass. Assert the error discriminator and both fields.

Proposed fix
     const decoded = fromBinary(AgentClientMessageSchema, bytes);
+    const result = decoded.message.value.message.value.result;
     expect(decoded.message.case).toBe("execClientMessage");
     expect(decoded.message.value.message.case).toBe("diagnosticsResult");
+    expect(result.case).toBe("error");
+    if (result.case !== "error") {
+      throw new Error(`Expected diagnostics error result, got ${result.case}`);
+    }
+    expect(result.value.path).toBe("/tmp/x");
+    expect(result.value.error).toBe("unsupported");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test("diagnosticsResult round-trips an error result", () => {
const bytes = execBytes(
execServerMessage({ case: "diagnosticsArgs", value: create(DiagnosticsResultSchema, {}) }),
"diagnosticsResult",
create(DiagnosticsResultSchema, {
result: {
case: "error",
value: create(DiagnosticsErrorSchema, { path: "/tmp/x", error: "unsupported" }),
},
}),
);
const decoded = fromBinary(AgentClientMessageSchema, bytes);
expect(decoded.message.case).toBe("execClientMessage");
expect(decoded.message.value.message.case).toBe("diagnosticsResult");
});
test("diagnosticsResult round-trips an error result", () => {
const bytes = execBytes(
execServerMessage({ case: "diagnosticsArgs", value: create(DiagnosticsResultSchema, {}) }),
"diagnosticsResult",
create(DiagnosticsResultSchema, {
result: {
case: "error",
value: create(DiagnosticsErrorSchema, { path: "/tmp/x", error: "unsupported" }),
},
}),
);
const decoded = fromBinary(AgentClientMessageSchema, bytes);
const result = decoded.message.value.message.value.result;
expect(decoded.message.case).toBe("execClientMessage");
expect(decoded.message.value.message.case).toBe("diagnosticsResult");
expect(result.case).toBe("error");
if (result.case !== "error") {
throw new Error(`Expected diagnostics error result, got ${result.case}`);
}
expect(result.value.path).toBe("/tmp/x");
expect(result.value.error).toBe("unsupported");
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/cursor-native-exec-common.test.ts` around lines 65 - 80, Extend the
test around diagnosticsResult and the decoded value from
AgentClientMessageSchema to assert the diagnostics result discriminator is
"error" and its payload contains path "/tmp/x" and error "unsupported". Keep the
existing outer message-case assertions unchanged.

@Ingwannu Ingwannu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The focused implementation looks coherent, and I independently passed the 23 touched tests, bun run typecheck, and bun run privacy:scan on ccf85d3c with CPU affinity limited to two cores.

I am holding approval for two merge gates rather than a code defect:

  • this dependency/native-toolchain change is now 13 commits behind current dev (d55b903d), beyond the repository readiness window, so please rebase it onto the current integration head;
  • the macOS required check is still pending, and this TypeScript package ships platform-native binaries, so that platform result is part of the dependency-boundary review.

After the rebase, please rerun the focused serialization/install/translator tests plus typecheck/privacy and let the full cross-platform CI complete. I will re-review the exact new head once those gates are green.

@Wibias
Wibias merged commit fdc47db into lidge-jun:dev Aug 8, 2026
40 of 42 checks passed
@Wibias
Wibias deleted the typescript-7-update branch August 8, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants