Repository navigation
refactor: codebase review cleanup — dead code, duplication, complexity, unified patterns - #740
Merged
Merged
Conversation
…y, unified patterns Fixes from a review of the codebase for unused code, overly complex code, duplication and patterns worth unifying. Bugs - POSIX CWD-release cleanup shares one runner with Windows: errors and surviving processes are reported to the deletion instead of swallowed - Timeouts always clear their timer (raceTimeout/withTimeout): sessions, process wait, OpenCode connect, the dialog mock - .cmd shims quote every argument (runAgentBinary, OpenCode launcher) - appctrl expand-sidebar retries like the e2e fixture - DialogView walls off its form with an ErrorBoundary; Form's orphan-focus timer is cleared on unmount - delete pipeline reports the kill-blockers step when the removal fails - rule violations: node:fs stat, string paths, path log-context keys, direct process.platform; ElectronBuildInfo's sync git call documented Interface changes - ApiResult (with category) declared once in shared/ - one workspace-identity shape in workspace event payloads; agent:status-updated flattened - workspace:open decides fresh-vs-reopen once (`fresh`, `workspaceName` on every hook context and on workspace:created) - yield frames validated against per-hook-point `frames` schemas - UiState row keys are workspace refs; the agent runtime is keyed by ref - modules declare handlers with defineHooks/defineEvents (src/intents/declarations.ts) — the event/ctx/intent casts are gone Simplification and deduplication - presentation module split (startup-surface, running-hooks, navigation, view-model); creation FormState; claude hook status as a pure reducer - delete pipeline state, idempotency (singleton = per-key, `wait` kept), open-project, app-start retry, dispatcher, git-worktree identify, ide-server lifecycle, api-server socket handling - plugin module binds hook points from the hook maps; one script runner - sidekick extension split by concern - shared helpers: tagKey/encodeTag, prependPath, errorCode/toError, streamDownloadProgress, escapeHtml, FieldShell, .ch-icon-button, workspace status cache with transitions, activeWorkspaceRef - dead code removed (global dialog CSS, mock factories, test-only guards, unused deps `ignore` and `@testing-library/user-event`) - test setup deduplicated (~3.4k lines) - docs: error-surfacing rule, shutdown handler rule, stale references Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stefanhoelzl
enabled auto-merge (rebase)
October 2, 2026 19:42
buildServeEnv now takes the injected platform (linux in the mock deps) and the OpenCode server's cwd is the native path, so these expectations failed only on a Windows host. serve-env.test.ts covers the Windows env. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes from a review of the codebase for unused code, overly complex code, duplication and patterns worth unifying. Squashed from the review branch and merged with main's concurrent-hooks / single-writer-fold changes.
Bugs
cwd-release-kill.ts) with Windows: errors and surviving processes are reported to the deletion instead of swallowed by a barecatch {}raceTimeout/withTimeoutinsrc/utils/timeout.ts): dialog sessions,ProcessRunner.wait, OpenCodeconnect, the dialog mock.cmdshims quote every argument (runAgentBinary, OpenCode launcher; sharedcmd-quote.ts)expand-sidebarretries like the e2e fixture (one sharedexpandSidebarOn)DialogViewwalls off its form with anErrorBoundarylikePanelView; Form's orphan-focus timer is cleared on unmountnode:fsstatin api-server, string paths, path log-context keys, directprocess.platform;ElectronBuildInfo's sync git call documented as an exceptionInterface changes
ApiResult(withcategory) declared once inshared/api-protocol.tsworkspaceIdentityPayloadSchema) in workspace event payloads;agent:status-updatedflattenedworkspace:opendecides fresh-vs-reopen once:fresh+workspaceNameon every hook context and onworkspace:created(plugin stdin keepsreopened)framesschemasUiStaterow keys are workspace refs; the agent runtime is keyed byWorkspaceRefdefineHooks/defineEvents(src/intents/declarations.ts): ~170event as/ctx as/intent ascasts removed, mistyped handlers fail to compileresolveWorkspaceIdentitySimplification and deduplication
FormStatehandleHookstatus rules extracted into a purederiveStatusreducer with focused testswaitkept), open-project, app-start retry, git-worktree identify, ide-server lifecycle, api-server socket handlingOPEN_WORKSPACE_HOOKS/DELETE_WORKSPACE_HOOKS; hooks and automations share one script runnertagKey/encodeTag,prependPath,errorCode/toError,streamDownloadProgress,escapeHtml,FieldShell,.ch-icon-button, status cache with(ref, previous, next)transitions,activeWorkspaceRefstoreText, unused depsignoreand@testing-library/user-eventLeft alone on purpose:
extensions/markdown-review-editor/, migration code.