Repository navigation
refactor(backend): separate responsibilities with a frozen client contract - #320
Merged
Merged
Conversation
This was referenced Sep 30, 2026
…y-unblock fix(deps): repair security blockers before backend reorganization 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.
The backend mixed provider setup, native clients, host operations, startup wiring and resource ownership inside the daemon and session store. Separate those responsibilities while preserving the existing SDK, protocol, persisted data and runtime behavior.
This consolidates all 30 original commits from the 20-PR stack plus its consolidation documentation, based on development
271c0f8d2a35648d1b45056d57432590b783483c. The original reorganization implementation is unchanged. The security/toolchain repair in #329 was merged into this branch before landing indevelopment.Review map
internal/provider; host MCP import and icon state stay server-owned. Existing configuration atomicity, lock order and cancellation are preserved.internal/clientowns the existing Go client;internal/daemonconnandinternal/commandpresentationhold shared primitives. CLI/TUI/ACP imports change mechanically without a forwarding service.The combined diff also includes the separately proposed prerequisite repairs: narrow brace-expansion lockfile patches (#299), credential-isolated test fixtures (#301), UI focus readiness (#307), gateway fixture synchronization (#313), snapshot-aware performance measurement (#314), and the TUI title fixture (#316). These remain distinct commits; the PR is not solely file moves.
Preserved contract
Validation
64e37008d48b55ee520d0acbc087738fccf6bcabpassed all 22 checks, including full CI, security, Linux/macOS compatibility, desktop lifecycle/SSH, and distribution checks. The refactor(backend): separate responsibilities with a frozen client contract #320 merge tree was verified byte-for-byte identical to that tested tree before landing.d29344dcf638a9b992fe6640b74e17d832efd5d3differs from the tested original stack tip only indocs/backend-reorganization-plan.md; subsequent security repairs are isolated in fix(deps): repair security blockers before backend reorganization merge #329. Frozen SDK/protocol/migration paths remain identical to development;git diff --checkpasses.task acceptancepassed on the unchanged implementation, including 49 SDK acceptance cases with zero failures/skips, native CLI/TUI/ACP/runtime checks and packed-consumer checks. Web check and packaging passed.noctxfinding; required default lint passes. Historical canceled workflow entries on test: guard backend reorganization compatibility #302/refactor(daemon): separate host MCP import ownership #304/refactor(daemon): prepare provider operation boundary #305 remain recorded and are not represented as passes.Architecture · Plan and detailed preservation evidence
Supersedes the review chain #299 → #300 → #301 → #307 → #302 → #304 → #305 → #306 → #308 → #309 → #310 → #311 → #312 → #313 → #314 → #315 → #316 → #317 → #318 → #319. Those PRs are retained as historical focused reviews, with their branches and evidence preserved. This does not include or merge the abandoned backend-redesign or frontend-restoration stacks.
Note
High Risk
Large-scale Go package moves and daemon construction changes touch auth, clients, persistence wiring, and release CI gates; behavior is intended to be preserved but regressions would affect core runtime and merge blocking.
Overview
Splits backend responsibilities out of
internal/daemonwhile keeping protocol 6.9, schema 21, and external behavior unchanged. Native Go clients move tointernal/client; shared paths, dial/launch, and socket helpers move tointernal/daemonconn; provider discovery/configuration/login moves tointernal/provider; stored command text formatting moves tointernal/commandpresentation. CLI/TUI/ACP/gateway code updates imports and types (protocol.*,session.CreateSession) instead ofdaemon.*client APIs.Daemon startup is slimmed in
cmd/whip/daemon.go: runtime session construction (model resolution, MCP, compaction, tool services) lives in newcmd/whip/daemon_runtime.go,session.Opentakes a workspace coordinator, anddaemon.Newreceives a shared process manager.CI and local gates add a matrix
compatibilityjob (scripts/backend-compat/run.mjs) wired into the requiredgoaggregate, extend runtime/acceptance coverage fordaemonconn/client/command presentation/TUI integration, run web performance-probe unit tests, bump golangci-lint to v2.14.0, and trigger CI/security oncodex/backend-reorg-*branches. Toolchain/security: Go 1.27.2, docs TanStack bumps, SDK job usesnpm run audit:productioninstead of rawnpm audit.Web performance inlines probe logic into
performance-probes.mjs(desktop + WebSocket), with tests for snapshot vs notification commit timing, deduplication, and bounds;performance.mjsimports that module.Docs refresh
architecture.md(gateway vs daemon, package map, resource lifetimes) and adddependency-security.md;backend-redesign-plan.mdis marked superseded.Reviewed by Cursor Bugbot for commit 7501aa5. Bugbot is set up for automated code reviews on this repo. Configure here.