Repository navigation
fix(maintainer): add .ts extensions so node can load the sweep - #1943
AlemTuzlak merged 2 commits into
Conversation
Node's type stripper does not resolve extensionless relative imports, so the scheduled sweep exits before it assigns anyone.
|
|
View your CI Pipeline Execution ↗ for commit f8bb6a1
☁️ Nx Cloud last updated this comment at |
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Maintainer imports and TypeScript configuration scripts/maintainer/actions.ts, scripts/maintainer/classify.ts, scripts/maintainer/collect.ts, scripts/maintainer/comments.ts, scripts/maintainer/config.ts, scripts/maintainer/discord.ts, scripts/maintainer/fixtures.ts, scripts/maintainer/metrics.ts, scripts/maintainer/route.ts, scripts/maintainer/scorecard.ts, scripts/maintainer/sweep.ts, tsconfig.json, packages/ai-angular/tsconfig.json |
Relative imports in maintainer modules now use .ts specifiers. Root tsconfig.json enables allowImportingTsExtensions. The ai-angular configuration now extends tsconfig.base.json. |
Import test updates and Node loading check scripts/maintainer/classify.test.ts, scripts/maintainer/metrics.test.ts, scripts/maintainer/route.test.ts, scripts/maintainer/sweep.test.ts |
Test imports and dynamic imports now use .ts specifiers. A subprocess test checks that Node can load sweep.ts. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
- TanStack/ai#1941: The issue describes Node failing to resolve extensionless imports in Maintainer Sweep. This pull request adds the requested
.tssuffixes and enables the TypeScript compiler option.
Possibly related PRs
- TanStack/ai#1890: That PR changed Maintainer Sweep and Scorecard to run with Node. This pull request updates the imports used by those scripts.
Suggested reviewers: alemtuzlak
Merge Risk: 
Minimal · up to f8bb6
-
The maintainer scripts can load under the repository’s configured Node runtime, with no verified merge-blocking risk.
Pre-merge checks: 
5
-
Full details: Linked Issues check
-
Explanation
Issue
#1941has one active direct link. Its coding requirements are: (1) add a.tssuffix to every relative import underscripts/maintainer/, including dynamic imports insweep.test.ts; (2) setallowImportingTsExtensions: truein the roottsconfig.json; (3) keep package scripts onnode; (4) do not changepackages/.Evidence at head
e5699246:- Req 1:
sweep.tsimports./actions.ts,./classify.ts,./collect.ts,./comments.ts,./config.ts,./github.ts,./route.ts,./env.ts, and./types.tswith.tssuffixes.sweep.test.tsstatic imports and dynamicimport()calls (./collect.ts,./github.ts,./classify.ts,./metrics.ts,./discord.ts) all use.ts.env.tsandgithub.tscontain no relative imports. The change summary reports.tssuffixes in the remaining changed modules.types.tsandglob.tsdo not appear in the changed-file summary. I did not read their full contents, so this is inferred from the summary. - Req 2:
tsconfig.jsonsetscompilerOptions.allowImportingTsExtensions: trueand extendstsconfig.base.json. The issue states that base already setsnoEmit: true. I did not readtsconfig.base.jsondirectly. - Req 3:
package.jsonis not in the changed-file summary, so its scripts remain at base. - Req 4: No file under
packages/appears in the changed-file summary. - Checks:
sweep.test.tsadds a subprocess test that importssweep.tsthrough Node in module mode and expectssweep-module-linked. This test covers the reportedERR_MODULE_NOT_FOUNDpath. The author reports vitest (95 tests), oxlint, and tsc results. I did not re-run these commands.
All explicit coding requirements in
#1941are met by the code at head. - Req 1:
Full details: Out of Scope Changes check
-
Explanation
The whole-PR change set (merge base
669fd31d9to heade5699246) touches onlytsconfig.jsonand files underscripts/maintainer/. Changed files areactions.ts,classify.ts,classify.test.ts,collect.ts,comments.ts,config.ts,discord.ts,fixtures.ts,metrics.ts,metrics.test.ts,route.ts,route.test.ts,scorecard.ts,sweep.ts,sweep.test.ts, andtsconfig.json.The summary reports import-only edits in the source modules. It also reports minor reformatting in
route.test.tswhere an import block spans multiple lines. This formatting supports the import edits and does not change behavior. The new subprocess test insweep.test.tsverifies the#1941module-loading fix. No package, docs, runtime-logic, orpackages/changes appear in the summary. The change set does not include unrelated work.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 15 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · 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.
Comment @coderabbitai help to get the list of available commands.
Coverage✅ Coverage held across 75 compared package(s). Each package is measured twice in this job — on this PR and on its merge-base with
|
The root tsconfig now sets allowImportingTsExtensions for scripts/. ng-packagr emits, so inheriting that flag fails the build with TS5096.
@tanstack/ai
@tanstack/ai-acp
@tanstack/ai-angular
@tanstack/ai-anthropic
@tanstack/ai-bedrock
@tanstack/ai-byteplus
@tanstack/ai-claude-code
@tanstack/ai-client
@tanstack/ai-cloudflare
@tanstack/ai-code-mode
@tanstack/ai-code-mode-snippets
@tanstack/ai-codex
@tanstack/ai-cohere
@tanstack/ai-compaction
@tanstack/ai-computer-local
@tanstack/ai-computer-playwright
@tanstack/ai-computer-sandbox
@tanstack/ai-computer-use
@tanstack/ai-devtools-core
@tanstack/ai-durable-stream
@tanstack/ai-elevenlabs
@tanstack/ai-event-client
@tanstack/ai-fal
@tanstack/ai-gemini
@tanstack/ai-grok
@tanstack/ai-grok-build
@tanstack/ai-groq
@tanstack/ai-harness
@tanstack/ai-harness-cli
@tanstack/ai-isolate-cloudflare
@tanstack/ai-isolate-daytona
@tanstack/ai-isolate-e2b
@tanstack/ai-isolate-node
@tanstack/ai-isolate-quickjs
@tanstack/ai-isolate-quickjs-bun
@tanstack/ai-llmgateway
@tanstack/ai-lovable
@tanstack/ai-mcp
@tanstack/ai-memory
@tanstack/ai-mistral
@tanstack/ai-neon
@tanstack/ai-octane
@tanstack/ai-ollama
@tanstack/ai-ollaya
@tanstack/ai-openai
@tanstack/ai-opencode
@tanstack/ai-openrouter
@tanstack/ai-perplexity
@tanstack/ai-persistence
@tanstack/ai-preact
@tanstack/ai-react
@tanstack/ai-reactor
@tanstack/ai-remix
@tanstack/ai-sandbox
@tanstack/ai-sandbox-blaxel
@tanstack/ai-sandbox-boxd
@tanstack/ai-sandbox-cloudflare
@tanstack/ai-sandbox-daytona
@tanstack/ai-sandbox-docker
@tanstack/ai-sandbox-e2b
@tanstack/ai-sandbox-local-process
@tanstack/ai-sandbox-railway
@tanstack/ai-sandbox-sprites
@tanstack/ai-sandbox-upstash-box
@tanstack/ai-sandbox-vercel
@tanstack/ai-skills
@tanstack/ai-solid
@tanstack/ai-svelte
@tanstack/ai-typesafe
@tanstack/ai-utils
@tanstack/ai-vercel-gateway
@tanstack/ai-vertex
@tanstack/ai-vue
@tanstack/ai-worldlabs
@tanstack/openai-base
@tanstack/preact-ai-devtools
@tanstack/react-ai-devtools
@tanstack/solid-ai-devtools
@tanstack/svelte-ai-devtools
commit: |
Run the import command in Testing. The scheduled Maintainer Sweep fails before it assigns anyone. Node cannot load
scripts/maintainer/sweep.tsbecause each relative import has no.tssuffix. This PR adds that suffix and allows.tsimports in the root tsconfig.ai-angularnow extendstsconfig.base.json, so its build does not get that flag.Fixes #1941
🎯 Changes
Relative imports under
scripts/maintainer/now end in.ts. Node resolves the specifier as written. These source files use that suffix. The roottsconfig.jsonsetsallowImportingTsExtensions.tsconfig.base.jsonalready hasnoEmit: true.packages/ai-angular/tsconfig.jsonextended the roottsconfig.json. It was the only package to do that. The other 76 extendtsconfig.base.json. The Angular build emits files, so the new flag failed it with TS5096. It now extendstsconfig.base.json. The root file only addsinclude, andai-angularsets its owninclude. Its compiler options do not change.No docs change. These scripts are not a published package, so there is no changeset. The
package.jsonscripts stay onnode.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.docs/for this change, or this change is not user-facing.pnpm changeset), or this PR does not change a published package.🚀 Release Impact
Root cause
Issue. Since #1890, every scheduled Maintainer Sweep run fails. The job exits before
main()inscripts/maintainer/sweep.tsassigns anyone.Cause.
sweep.tsimports./actionswith no file suffix. Node's type stripper does not add.tsduring module resolution. The same gap is in the rest ofscripts/maintainer/.Fix. Each relative import in that directory now includes
.ts. The root tsconfig allows the suffix, sotscdoes not report TS5097.ai-angularstops extending the root tsconfig, so its emitting build does not get the flag.Possible alternatives
tsx.tsxresolves an import with no suffix. This PR does not do that. Issue feat(maintainer): assign a PR to the assignee of the issue it closes #1890 changed these scripts tonode..jssuffix. Node resolves the specifier as written. There is no.jsfile on disk for these modules..ts. That is more code for the same result.Testing
Commands run
669fd31d9), a dynamic import ofscripts/maintainer/sweep.tsfailed withERR_MODULE_NOT_FOUND.sweep-module-linked.pnpm exec vitest run --root scripts/maintainerpassed (95 tests).pnpm exec oxlint scripts/maintainerpassed, andoxfmt --checkpassed after a format.@tanstack/ai-angular:buildwith TS5096. After the tsconfig change,nx run @tanstack/ai-angular:build --skip-nx-cachepassed locally.pnpm exec tsc -p tsconfig.json --noEmit --pretty falsereports zero TS5097 errors. The command still exits 1 for other errors outside this change.I did not run
pnpm test:pr. I did not run the E2E suite. This change does not touch chat behavior.The import does not call
main(). Fornode --eval,process.argv[1]is empty, so the direct-run guard insweep.tsstays false.Fail transcript on main (
worktrees/bugfix-4031C6C38308-main, commit669fd31d9):Pass transcript on this branch:
Manual test
669fd31d9.node --input-type=module --eval 'const { pathToFileURL } = await import("node:url"); const href = pathToFileURL(process.cwd() + "/scripts/maintainer/sweep.ts").href; await import(href); console.log("sweep-module-linked");'ERR_MODULE_NOT_FOUNDforscripts/maintainer/actions.sweep-module-linked. Then runpnpm exec vitest run --root scripts/maintainer.How this PR makes testing easy.
scripts/maintainer/sweep.test.tsloadssweep.tsthrough Node and expectssweep-module-linked.Risk / rollback
Risk is low. The change is limited to maintainer-script imports, one tsconfig flag, and the base that
ai-angularextends. A revert of this PR restores the old import paths. The sweep stays broken until another fix is on main.Summary by CodeRabbit