fix(worker): dedupe MCP SDK + fix agent.ts type errors, add CI tsc gate#239
Merged
liplus-lin-lay merged 1 commit intoJun 25, 2026
Conversation
… add tsc gate to CI worker の tsc 型エラー 2 件を解消し, 再発防止に CI へ型ゲートを追加する (#238). - agent.ts:31 TS2344: `interface TenantProps` を `type TenantProps =` に変更. interface は暗黙の index signature を持たず `Record<string, unknown>` 制約に不適合だったため. - agent.ts:32 TS2416: `@modelcontextprotocol/sdk` が依存ツリーに 2 コピー (worker 直下 1.27.1 / agents@0.8.2 nested 1.26.0) 存在し, 別コピーの McpServer private `_serverInfo` が非互換だった. worker/package.json の overrides に `@modelcontextprotocol/sdk` を追加し, agents が要求する 1.26.0 (より制約の強い consumer) に単一版へ寄せた. 既存の `@cloudflare/workers-types` override と同じ self-reference 形式を使う. - 再発防止: worker に `typecheck` script (`tsc --noEmit`) を追加し, ci.yml の worker job で `npm ci` の直後に実行. 型エラーで CI が fail するゲートにした. 順序遵守: (1) dedupe + (2) type 化を先に適用し tsc を完全クリア (エラーゼロ) にしてから (3) のゲートを有効化した. dedupe 後に nested コピーが消えたこと, 全テスト (tsx 54 + vitest 35) + Workers build (dry-run deploy) が green であることを確認済み. runtime 挙動は不変 (型/ビルド 健全性のみ). Closes #238 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
5 tasks
liplus-lin-lay
commented
Jun 25, 2026
liplus-lin-lay
left a comment
Member
Author
There was a problem hiding this comment.
AI セルフレビュー (auto mode / 親)
差分確認、完了条件すべて達成。
- dedupe (error 2): package.json overrides に @modelcontextprotocol/sdk: $ref 追加 + dep を 1.26.0 に固定。package-lock から nested agents/node_modules/@modelcontextprotocol/sdk が消え単一コピー化を確認。agents@0.8.2 要求版 (1.26.0) に合わせる安全側。
- type 化 (error 1): interface TenantProps -> type TenantProps。
- CI 型ゲート: worker に typecheck script 追加、ci.yml で npm ci の後・dry-run deploy の前に npm run typecheck を実行。run 28189413249 step 6 で実走 success = ゲート稼働 + tsc クリアを確認。
- 順序: 既存 2 エラー解消 -> ゲート追加が同一 PR で成立、CI green が tsc ゼロを証明。
- Workers Builds は本 PR 未付与 (型/依存のみの変更) だが mergeStateStatus=CLEAN かつ CI 内 wrangler deploy --dry-run でビルド検証済み。マージ後 main push で通常実行。
- runtime 挙動不変、PR/commit title ASCII。
判定: PASS。auto mode につき squash merge。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
worker の型チェック (
tsc --noEmit) が CI で走っておらず,agent.tsに型エラー 2 件が静かに蓄積していた (PR #237 のセルフレビュー中に発見). 2 件を修正し, 再発防止に tsc 型ゲートを CI に追加する.影響スコープ = worker (型/ビルド健全性のみ, runtime 挙動・MCP ツール意味論は不変).
変更内容
@modelcontextprotocol/sdkが依存ツリーに 2 コピー (worker 直下 1.27.1 /agents@0.8.2nested 1.26.0) 存在し, 別コピーのためMcpServerの private フィールド_serverInfoが非互換になっていた. 版差ではなく「2 コピーある」こと自体が原因.worker/package.jsonのoverridesに@modelcontextprotocol/sdkを追加し,agents@0.8.2が要求する 1.26.0 (より制約の強い consumer, 安全側) に単一版へ寄せた. 既存の@cloudflare/workers-typesoverride と同じ self-reference 形式を踏襲.TenantPropsの type 化 (TS2344 解消): TypeScript のinterfaceは暗黙の index signature を持たずRecord<string, unknown>制約に不適合だったため,interface TenantPropsをtype TenantProps =に変更.typecheckscript (tsc --noEmit) を追加し,.github/workflows/ci.ymlの worker job でnpm ci直後にnpm run typecheckを実行. 型エラーで CI が fail するゲートにした.順序遵守
(1) dedupe + (2) type 化を先に適用し
tsc --noEmitを完全クリア (エラーゼロ) にしてから (3) のゲートを有効化した. ゲートを先に入れると既存エラーで CI が赤くなるため.検証
cd worker && npx tsc --noEmit→ エラーゼロ (exit 0).@modelcontextprotocol/sdkは単一コピー (1.26.0) のみ, nested コピーは消失.npm lsもagents側が1.26.0 deduped表示.npm run typecheckが exit 2 (CI 赤), revert で exit 0 に復帰.wrangler deploy --dry-run) green.対象ファイル
worker/package.json(overrides + typecheck script)worker/package-lock.json(dedupe 反映)worker/src/agent.ts.github/workflows/ci.ymlCloses #238