fix(image-gen-mcp): address follow-up review issues from #1243#1441
Merged
kaizhou-lab merged 1 commit intomainfrom Mar 19, 2026
Merged
fix(image-gen-mcp): address follow-up review issues from #1243#1441kaizhou-lab merged 1 commit intomainfrom
kaizhou-lab merged 1 commit intomainfrom
Conversation
- Move imageGenCore.ts from src/process/builtinMcp/ to src/common/
to fix architecture boundary violation (worker importing @process/)
- Replace dynamic require('fs') in img-gen.ts with static top-level import
- Fix mutations in initStorage.ts ensureBuiltinMcpServers — use spread
copies instead of in-place field assignment on existing MCP server entry
- Promote BUILTIN_IMAGE_GEN_ID to src/common/storage.ts; remove duplicate
local constants from renderer components (ToolsModalContent, McpManagement)
- Add 37 unit tests for imageGenCore covering safeJsonParse, isImageFile,
isHttpUrl, getFileExtensionFromDataUrl, processImageUri, and aborted-signal
path in executeImageGeneration
- Add src/common/imageGenCore.ts and src/agent/acp/mcpSessionConfig.ts
to vitest.config.ts coverage.include
kaizhou-lab
approved these changes
Mar 19, 2026
IceyLiu
approved these changes
Mar 19, 2026
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.
Summary
imageGenCore.tstosrc/common/to fix architecture boundary violation (worker importing@process/)initStorage.tsand duplicated constants in renderer; replace dynamicrequire('fs')with static importimageGenCoreand register it in coverage trackingChanges
Architecture
src/process/builtinMcp/imageGenCore.ts→src/common/imageGenCore.ts(renamed/moved)src/process/builtinMcp/imageGenServer.ts: update import pathsrc/agent/gemini/cli/tools/img-gen.ts: import from@/common/imageGenCore; replacerequire('fs')inside method with top-levelimport * as fs from 'fs'Immutability fix
src/process/initStorage.ts: replace all in-place field mutations on existingIMcpServerentry with spread-based immutable update (mcpServers[existingIdx] = { ...existing, ... })Shared constant
src/common/storage.ts: exportBUILTIN_IMAGE_GEN_IDas canonical sourcesrc/process/builtinMcp/constants.ts: re-export from@/common/storageinstead of re-declaringsrc/renderer/components/SettingsModal/contents/ToolsModalContent.tsx: import from@/common/storage, remove local constsrc/renderer/pages/settings/McpManagement/index.tsx: sameTests & coverage
tests/unit/imageGenCore.test.ts: 37 new tests coveringsafeJsonParse,isImageFile,isHttpUrl,getFileExtensionFromDataUrl,processImageUri(HTTP + local file paths),executeImageGeneration(aborted signal)vitest.config.ts: addsrc/common/imageGenCore.tsandsrc/agent/acp/mcpSessionConfig.tstocoverage.includeRelated
Follow-up to #1243 — addresses issues found in code review.
Test Plan
bun run test— all 849 tests passbunx tsc --noEmit— no type errors