Fix main process typecheck coverage and IPC registration#56
Merged
Conversation
Cut main-src/ipc/register.ts from 4236 lines to 1980 (-53%) by extracting
~75 IPC handlers into focused modules and lifting the chat pipeline out
of the dispatcher.
New modules:
- agentRuntime.ts: cross-handler helpers (senderWorkspaceRoot,
workspaceRootsEqual, parseAppWindowSurface, broadcastPluginsChanged)
- chatRuntime.ts: runChatStream + 6 shared state Maps (abortByThread,
agentRevertSnapshotsByThread, toolApprovalWaiters, mistakeLimitWaiters,
preflightAbortByThread, threadTitleGenerationVersion) and helpers
(recordTurnTokenUsageStats, persistAssistantStreamError,
queueThreadTitleGeneration, resolveManagedAgentLoopOptions,
activeUsageStatsDir, appendSystemBlock)
- handlers/{app,workspace,fs,shell,git,browser,mcp,plugins,settings,
terminalExec}Handlers.ts: one file per IPC namespace
Behaviour is unchanged: handlers were moved verbatim and rewired through
register.ts:registerIpc(). Also clears 67 newly-unused imports left
behind in register.ts.
Fix + regression test for ReferenceError shipped in ref/app:
- register.ts referenced workspaceRootsEqual without importing it after
the helper moved to agentRuntime.ts. esbuild does not catch free
identifiers and main-src is outside tsconfig.json `include`, so the
bug only surfaced when threads:listAgentSidebar fired in production.
- Add main-src/ipc/registerSmoke.test.ts: mocks `electron`, loads every
register*Handlers() module plus registerIpc(), then invokes every
captured handler body. Any ReferenceError from a missing import now
fails CI (verified by temporarily reverting the fix - the test caught
it). 16 new test cases, 561/562 total pass.
Resolve TypeScript errors after including main-src in typecheck. Add missing team settings and task status typing, fix team orchestrator narrowing, update Electron dialog overload calls, and align plugin, Feishu, Anthropic, MCP, browser, and SFTP code with current SDK types. Keep tests isolated from native Electron ABI bindings and extend the IPC smoke timeout to match its actual runtime.
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
main-srcand fixed the resulting main-process type errors.Investigation Notes
teamTaskQueueblockedis an active task status, not a stale enum.enableSimpleGoalShortCircuitandtaskSchedulingStrategyare active team settings and now have defaults.ShellSettings.mcp.serversis accepted and merged intomcpServers.Verification
npm run typechecknpm run buildnpm testnpx vitest run main-src/ipc/registerSmoke.test.ts