Skip to content

chore(sdk): set explicit rootDir for TS 6 compat#721

Merged
philanton merged 2 commits into
mainfrom
fix/ts-root-dir
May 5, 2026
Merged

chore(sdk): set explicit rootDir for TS 6 compat#721
philanton merged 2 commits into
mainfrom
fix/ts-root-dir

Conversation

@philanton
Copy link
Copy Markdown
Contributor

@philanton philanton commented May 5, 2026

Summary

  • Set "rootDir": "./src" in sdk/ts/tsconfig.json and sdk/ts-compat/tsconfig.json.
  • Add rootDir: '.' override in ts-jest inline tsconfig (jest.config.cjs) for both packages so tests outside src/ still compile.

Why

TypeScript 6 no longer infers rootDir from the common source dir and emits TS5011: The common source directory of 'tsconfig.json' is './src'. The 'rootDir' setting must be explicitly set... This blocks the TS 5.9 → 6.0 bump in #719 (Test (TS SDK) and Test (TS SDK Compat) jobs failing).

This change is a no-op under TS 5.9 (matches the previously inferred value) and unblocks the upgrade.

Test plan

  • cd sdk/ts && npm run typecheck — clean
  • cd sdk/ts && npm run build:ci — clean
  • cd sdk/ts && npm test — 104/105 pass; sole failure is pre-existing rpc-drift.test.ts referencing clearnode/api/rpc_router.go post clearnode→nitronode rename (unrelated, tracked separately)
  • cd sdk/ts-compat && npm run typecheck — clean
  • cd sdk/ts-compat && npm run build — clean
  • cd sdk/ts-compat && npm test — 5/5 pass

After merge: comment @dependabot rebase on #719 to retry CI under TS 6.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated SDK TypeScript and Jest configuration files to improve compilation settings and module resolution for more consistent build outputs.

TypeScript 6 no longer infers rootDir and emits TS5011 when not set.
Set rootDir=./src in sdk/ts and sdk/ts-compat base tsconfig, with
ts-jest inline override to '.' so test/ files outside src still
compile. No-op under TS 5.9; unblocks the TS 6.0 bump in #719.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@philanton has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 20 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a961d27a-c5b3-4a8d-a90e-95680bf22df8

📥 Commits

Reviewing files that changed from the base of the PR and between cdf8818 and effbfe2.

📒 Files selected for processing (1)
  • sdk/ts/test/unit/rpc-drift.test.ts
📝 Walkthrough

Walkthrough

The PR adds explicit rootDir configuration to TypeScript and Jest settings across two SDK packages (sdk/ts and sdk/ts-compat) to control source file resolution and output structure during compilation and testing workflows.

Changes

TypeScript & Jest rootDir Configuration

Layer / File(s) Summary
Jest ts-jest Transform
sdk/ts-compat/jest.config.cjs, sdk/ts/jest.config.cjs
Added rootDir: '.' to the inline tsconfig options within the ts-jest transformer configuration for TypeScript file processing in tests.
TypeScript Compiler Options
sdk/ts-compat/tsconfig.json, sdk/ts/tsconfig.json
Added rootDir: "./src" to compilerOptions to explicitly constrain where the compiler treats source files as rooted for output structure.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • layer-3/nitrolite#697: This PR adjusts ts-jest and TypeScript rootDir settings that were initially configured in that PR, refining source root and module resolution behavior.

Suggested reviewers

  • nksazonov
  • dimast-x

Poem

🐰 Roots run deep in config land,
Where .ts and ./src now stand,
Jest and TypeScript aligned,
Compiler paths refined!

🚥 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 PR title accurately summarizes the main change: explicitly setting rootDir in TypeScript configuration for TS 6 compatibility, which is the core objective of this changeset.
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/ts-root-dir

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
sdk/ts/jest.config.cjs (1)

12-21: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Upgrade ts-jest to v29.4.0 or later for Jest 30 compatibility.

ts-jest 29.1.2 does not support Jest 30. Jest 30 support was added in ts-jest v29.4.0 (released June 2025). Using 29.1.2 with Jest 30.2.0 will trigger peer dependency conflicts and warnings about untested versions. The test results passing don't validate this compatibility mismatch. Upgrade both sdk/ts and sdk/ts-compat to use ts-jest@^29.4.0 or later.

🤖 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 `@sdk/ts/jest.config.cjs` around lines 12 - 21, The project is using ts-jest
29.1.2 which is incompatible with Jest 30; update the ts-jest dependency to
^29.4.0 (or later) in both the sdk/ts and sdk/ts-compat package.json
devDependencies, run install to refresh the lockfile, and re-run tests to
confirm no peer-dependency warnings; ensure any custom ts-jest config in
jest.config.cjs (the transformer mapping '^.+\\.ts$' => ['ts-jest', {...}])
remains valid for the new ts-jest version.
🧹 Nitpick comments (1)
sdk/ts-compat/jest.config.cjs (1)

1-25: ⚡ Quick win

Build order is enforced through CI workflow orchestration and npm dependencies—no action needed, but consider adding TypeScript references for compile-time enforcement.

The monorepo already enforces sdk/ts building before sdk/ts-compat through:

  1. npm dependency: sdk/ts-compat/package.json declares @yellow-org/sdk as both a peerDependency and devDependency using file:../ts
  2. CI orchestration: .github/workflows/main-pr.yml and .github/workflows/main-push.yml use the bootstrap-project-path: 'sdk/ts' parameter in the test workflow, which explicitly builds sdk/ts before sdk/ts-compat

However, neither sdk/ts/tsconfig.json nor sdk/ts-compat/tsconfig.json includes a references field to encode this dependency at the TypeScript compilation level. Adding "references": [{ "path": "../ts" }] to sdk/ts-compat/tsconfig.json would make the build order explicit and enforceable during local development and CI builds.

🤖 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 `@sdk/ts-compat/jest.config.cjs` around lines 1 - 25, Summary: TypeScript
project dependency isn't encoded via tsconfig references, so add a "references"
link from sdk/ts-compat to sdk/ts and enable composite builds. Update
sdk/ts-compat/tsconfig.json to include "references": [{ "path": "../ts" }] so
the compiler knows it depends on the ../ts project, and ensure the referenced
project (sdk/ts/tsconfig.json) has "compilerOptions.composite": true (and
"declaration": true if not already) so TypeScript can build and check referenced
project artifacts; this will enforce build order during local and CI TypeScript
compilation.
🤖 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.

Outside diff comments:
In `@sdk/ts/jest.config.cjs`:
- Around line 12-21: The project is using ts-jest 29.1.2 which is incompatible
with Jest 30; update the ts-jest dependency to ^29.4.0 (or later) in both the
sdk/ts and sdk/ts-compat package.json devDependencies, run install to refresh
the lockfile, and re-run tests to confirm no peer-dependency warnings; ensure
any custom ts-jest config in jest.config.cjs (the transformer mapping
'^.+\\.ts$' => ['ts-jest', {...}]) remains valid for the new ts-jest version.

---

Nitpick comments:
In `@sdk/ts-compat/jest.config.cjs`:
- Around line 1-25: Summary: TypeScript project dependency isn't encoded via
tsconfig references, so add a "references" link from sdk/ts-compat to sdk/ts and
enable composite builds. Update sdk/ts-compat/tsconfig.json to include
"references": [{ "path": "../ts" }] so the compiler knows it depends on the
../ts project, and ensure the referenced project (sdk/ts/tsconfig.json) has
"compilerOptions.composite": true (and "declaration": true if not already) so
TypeScript can build and check referenced project artifacts; this will enforce
build order during local and CI TypeScript compilation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2084022d-97c9-4740-be60-804130f0ae4d

📥 Commits

Reviewing files that changed from the base of the PR and between 50b57bf and cdf8818.

📒 Files selected for processing (4)
  • sdk/ts-compat/jest.config.cjs
  • sdk/ts-compat/tsconfig.json
  • sdk/ts/jest.config.cjs
  • sdk/ts/tsconfig.json

The router-handler drift check still pointed at clearnode/api/rpc_router.go,
which was renamed to nitronode/api/rpc_router.go in c0a5850. Restores the
test under the new path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@philanton philanton merged commit ebb77e7 into main May 5, 2026
10 checks passed
@philanton philanton deleted the fix/ts-root-dir branch May 5, 2026 09:52
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.

2 participants