Skip to content

chore(core,sdk): make the ai-v7 typecheck pass deterministic#3847

Merged
ericallam merged 1 commit into
mainfrom
fix/harden-ai-v7-typecheck
Jun 5, 2026
Merged

chore(core,sdk): make the ai-v7 typecheck pass deterministic#3847
ericallam merged 1 commit into
mainfrom
fix/harden-ai-v7-typecheck

Conversation

@ericallam
Copy link
Copy Markdown
Member

Summary

The SDK and core packages run a second, forward-compat typecheck pass (tsc --noEmit -p tsconfig.ai-v7.json) that remaps the "ai" import to the ESM-only AI SDK 7 canary, so we catch source that only compiles against one major. That pass inherited composite: true from the base tsconfig, which makes tsc write a .tsbuildinfo even under --noEmit.

Incremental buildinfo caches each file's resolved module format (CJS vs ESM) and module resolution. When that state goes stale or is replayed, the v7 pass can report spurious TS1479 ("CommonJS module ... cannot require an ECMAScript module") errors on the "ai" import even though the source is fine in a clean checkout. Because this pass shares the typecheck job that gates the Docker image publish, a spurious failure there blocks publishing.

Fix

Set composite: false and incremental: false on both tsconfig.ai-v7.json files. The pass is --noEmit only, so it never needed incremental state. Now each run is a clean, full check that writes no buildinfo and can't replay stale resolution.

Verified: both @trigger.dev/sdk and @trigger.dev/core typecheck green, and neither writes an ai-v7 .tsbuildinfo anymore.

The forward-compat ai-v7 typecheck pass ran under composite: true, so it wrote
incremental buildinfo even with --noEmit. Disabling composite/incremental for
this -p tsconfig.ai-v7.json pass removes a stale-state source that can surface
as spurious CommonJS-vs-ESM (TS1479) errors on the bare "ai" import.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 5, 2026

⚠️ No Changeset found

Latest commit: 8002cc0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ericallam ericallam marked this pull request as ready for review June 5, 2026 14:00
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7b15004a-7057-4a56-8ec4-45e95cfaf192

📥 Commits

Reviewing files that changed from the base of the PR and between 4711ade and 8002cc0.

📒 Files selected for processing (2)
  • packages/core/tsconfig.ai-v7.json
  • packages/trigger-sdk/tsconfig.ai-v7.json
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (33)
  • GitHub Check: audit
  • GitHub Check: audit
  • GitHub Check: internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: sdk-compat / Node.js 22.12 (ubuntu-latest)
  • GitHub Check: sdk-compat / Node.js 20.20 (ubuntu-latest)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: sdk-compat / Deno Runtime
  • GitHub Check: internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp
  • GitHub Check: sdk-compat / Cloudflare Workers
  • GitHub Check: sdk-compat / Bun Runtime
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
  • GitHub Check: Build and publish previews
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,jsx,css,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier for code formatting and run pnpm run format before committing

Files:

  • packages/core/tsconfig.ai-v7.json
  • packages/trigger-sdk/tsconfig.ai-v7.json
🧠 Learnings (14)
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: Applies to **/tsconfig.json : Use strict mode in TypeScript configuration

Applied to files:

  • packages/core/tsconfig.ai-v7.json
📚 Learning: 2026-03-02T12:43:34.140Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: packages/cli-v3/CLAUDE.md:0-0
Timestamp: 2026-03-02T12:43:34.140Z
Learning: Applies to packages/cli-v3/src/build/**/* : Build system in `src/build/` should use configuration from `trigger.config.ts` in user projects to determine bundling, build extensions, and output structure

Applied to files:

  • packages/core/tsconfig.ai-v7.json
  • packages/trigger-sdk/tsconfig.ai-v7.json
📚 Learning: 2026-03-25T15:29:25.889Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.889Z
Learning: Applies to trigger.config.ts : Configure build options including `external` packages, `jsx` settings, `conditions`, and `extensions` in the `build` option

Applied to files:

  • packages/core/tsconfig.ai-v7.json
  • packages/trigger-sdk/tsconfig.ai-v7.json
📚 Learning: 2026-05-01T15:45:12.777Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3499
File: packages/plugins/tsup.config.ts:3-3
Timestamp: 2026-05-01T15:45:12.777Z
Learning: In the triggerdotdev/trigger.dev codebase, `tsup.config.ts` files (and other build-tool config files such as `vitest.config.ts`, `vite.config.ts`) should use `export default defineConfig(...)` as per each tool's documented pattern. The repository coding guideline "use function declarations instead of default exports" applies only to application code (*.{ts,tsx,js,jsx}), not to build/tool config files. Do not flag `export default defineConfig(...)` in tsup, vite, or vitest config files as a violation of the named-export rule.

Applied to files:

  • packages/core/tsconfig.ai-v7.json
  • packages/trigger-sdk/tsconfig.ai-v7.json
📚 Learning: 2026-03-21T21:23:35.117Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3244
File: apps/webapp/app/components/runs/v3/ai/extractAISummarySpanData.ts:149-150
Timestamp: 2026-03-21T21:23:35.117Z
Learning: In `apps/webapp/app/components/runs/v3/ai/extractAISummarySpanData.ts` (and related AI span extraction files in `apps/webapp/app/components/runs/v3/ai/`), manual JSON.parse with typeof guards and type assertions is intentional. These functions are on the hot path for span rendering, so Zod validation is deliberately avoided for performance reasons. Do not suggest replacing manual JSON parsing with Zod schemas in these files.

Applied to files:

  • packages/core/tsconfig.ai-v7.json
📚 Learning: 2026-06-02T21:20:43.541Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-06-02T21:20:43.541Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Import subpaths only from `packages/core` (`trigger.dev/core`), never import from the root

Applied to files:

  • packages/core/tsconfig.ai-v7.json
📚 Learning: 2026-04-15T15:39:31.575Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2026-04-15T15:39:31.575Z
Learning: Applies to apps/webapp/**/*.test.{ts,tsx} : Do not import `env.server.ts` directly or indirectly into test files; instead pass environment-dependent values through options/parameters to make code testable

Applied to files:

  • packages/core/tsconfig.ai-v7.json
📚 Learning: 2026-06-02T21:20:48.921Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: packages/trigger-sdk/CLAUDE.md:0-0
Timestamp: 2026-06-02T21:20:48.921Z
Learning: Applies to packages/trigger-sdk/**/*.{js,ts,jsx,tsx} : Always import from `trigger.dev/sdk`. Never use `trigger.dev/sdk/v3` (deprecated path alias)

Applied to files:

  • packages/trigger-sdk/tsconfig.ai-v7.json
📚 Learning: 2026-03-02T12:43:34.140Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: packages/cli-v3/CLAUDE.md:0-0
Timestamp: 2026-03-02T12:43:34.140Z
Learning: Applies to packages/cli-v3/src/build/**/* : Bundle worker code using the build system in `src/build/` based on configuration from `trigger.config.ts`

Applied to files:

  • packages/trigger-sdk/tsconfig.ai-v7.json
📚 Learning: 2026-06-04T15:28:19.931Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3833
File: .changeset/ai-sdk-7-support.md:5-5
Timestamp: 2026-06-04T15:28:19.931Z
Learning: In triggerdotdev/trigger.dev, the `ai-sdk/otel` auto-registration caveats (skip-if-already-registered behaviour and the `TRIGGER_AI_SDK_OTEL_AUTOREGISTER=0` opt-out) are intentionally omitted from changeset copy to keep it concise. Full documentation lives in the AI Chat compatibility reference (docs PR `#3835`). Do not flag the changeset text as incomplete on this topic in future reviews.

Applied to files:

  • packages/trigger-sdk/tsconfig.ai-v7.json
📚 Learning: 2026-05-23T09:12:50.004Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3719
File: packages/trigger-sdk/src/v3/ai.ts:2154-2215
Timestamp: 2026-05-23T09:12:50.004Z
Learning: In triggerdotdev/trigger.dev, packages/trigger-sdk/src/v3/ai.ts mergeIncomingIntoHydrated must treat "output-denied" as a terminal tool state (alongside "output-available" and "output-error") and include a same-state early-return to deduplicate replay/retry wire arrivals, ensuring stale "approval-responded" parts never regress a hydrated denial.

Applied to files:

  • packages/trigger-sdk/tsconfig.ai-v7.json
📚 Learning: 2026-03-25T15:29:25.889Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.889Z
Learning: Applies to trigger.config.ts : Configure the Trigger.dev project using `defineConfig()` with properties like `project`, `dirs`, `retries`, `runtime`, and `build`

Applied to files:

  • packages/trigger-sdk/tsconfig.ai-v7.json
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: Applies to packages/trigger-sdk/**/*.{ts,tsx} : In the Trigger.dev SDK (packages/trigger-sdk), prefer isomorphic code like fetch and ReadableStream instead of Node.js-specific code

Applied to files:

  • packages/trigger-sdk/tsconfig.ai-v7.json
📚 Learning: 2026-06-02T21:20:43.541Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-06-02T21:20:43.541Z
Learning: Applies to **/*.{ts,tsx} : Import from `trigger.dev/sdk` when writing Trigger.dev tasks. Never use `trigger.dev/sdk/v3` or deprecated `client.defineJob`

Applied to files:

  • packages/trigger-sdk/tsconfig.ai-v7.json
🔇 Additional comments (2)
packages/core/tsconfig.ai-v7.json (1)

9-12: LGTM!

packages/trigger-sdk/tsconfig.ai-v7.json (1)

12-15: LGTM!


Walkthrough

This pull request updates TypeScript compiler configurations in two packages to disable composite and incremental build modes. The packages/core/tsconfig.ai-v7.json and packages/trigger-sdk/tsconfig.ai-v7.json files now set composite and incremental to false, preventing the creation and reuse of .tsbuildinfo files during the AI SDK v7 typecheck pass. This avoids stale module-resolution behavior that could occur when build information is replayed across CI runs.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description provides comprehensive context about the issue, the root cause, the fix, and verification steps. However, it does not follow the required template structure with Testing, Changelog, and Checklist sections. Fill out all required template sections: add a Checklist, describe testing steps in Testing section, and provide a brief changelog entry.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: disabling composite and incremental builds in tsconfig.ai-v7.json files to make the typecheck pass deterministic.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/harden-ai-v7-typecheck

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.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@ericallam ericallam enabled auto-merge (squash) June 5, 2026 14:06
@ericallam ericallam merged commit 96f4c1b into main Jun 5, 2026
52 checks passed
@ericallam ericallam deleted the fix/harden-ai-v7-typecheck branch June 5, 2026 14:13
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.

4 participants