Skip to content

refactor: split internal/mcpserver/mcpserver.go into topical files (pure declaration moves) - #744

Merged
dmmdea merged 2 commits into
mainfrom
refactor/split-mcpserver-file
Oct 30, 2026
Merged

dmmdea merged 2 commits into
mainfrom
refactor/split-mcpserver-file

Conversation

@dmmdea

@dmmdea dmmdea commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Intent

Desloppify backlog ("god files"): internal/mcpserver/mcpserver.go was 5273 lines. It is split into topical files of the same package by pure declaration moves; identical behaviour.

Scope

internal/mcpserver (mcpserver.go plus 8 new mcpserver_*.go files), four source-scanning tests re-keyed to the new layout (door_test.go, agentrun_wallgate_defers_test.go, root main_test.go manifest check, root bare_http_client_allowlist_test.go key), docs/systems/mcp-server.md pointers, the fragment. No declaration renamed or edited.

What changed

mcpserver_status.go 1047, mcpserver_media.go 868, mcpserver_agentrun.go 955, mcpserver_review.go 632, mcpserver_delegate.go 427, mcpserver_ask.go 398, mcpserver_research.go 221, mcpserver_text.go 118 lines; mcpserver.go 5273 -> 747 (keeps Server, New, serve, buildServer registration, runTaskAs, parseArgs). Second commit: the four tests that read mcpserver.go by name now glob the non-test mcpserver*.go files; the bare-http allowlist key for localSeatView moves to mcpserver_status.go with the same count.

 15 files changed, 4779 insertions(+), 4590 deletions(-)

The real run and its output

Declaration census (go/ast hash of every top-level declaration, comments stripped) before and after: 319 declarations, diff empty, run by the builder and again by an independent verifier in a throwaway worktree of origin/main. go build ./... ok; go vet ./internal/mcpserver ok; gofmt clean on every new file; the four re-keyed tests PASS by name (TestEveryToolHandlerRequestCarriesADoor, TestEveryAgentRunDeferralPastTheWallGateGoesThroughTheSizingStamp, TestPrintingPressManifestListsEveryTool, TestNoNewBareHTTPClient). CI runs the whole package.

Blast radius

None at runtime; file layout of one package.

Risk

Low. Tier: no_review (ordinary change (consequential 0.08, blast 1.05))

🤖 Generated with Claude Code

dmmdea and others added 2 commits October 29, 2026 20:10
Pure declaration moves inside the same package: mcpserver_status.go,
mcpserver_text.go, mcpserver_media.go, mcpserver_agentrun.go,
mcpserver_ask.go, mcpserver_review.go, mcpserver_delegate.go and
mcpserver_research.go; mcpserver.go keeps the server, construction,
registration and result helpers. Census before and after: 319
declarations, diff empty. Docs source map and changelog fragment added.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
mcpserver.go was split into mcpserver_*.go; the tests that read it by name now scan the split files too.

- TestEveryToolHandlerRequestCarriesADoor (internal/mcpserver/door_test.go): globs mcpserver*.go (non-test) and checks every core.Request literal in each; failure message names the file.
- TestEveryAgentRunDeferralPastTheWallGateGoesThroughTheSizingStamp (agentrun_wallgate_defers_test.go): concatenates the mcpserver*.go sources to find handleAgentRun (now in mcpserver_agentrun.go).
- TestPrintingPressManifestListsEveryTool (main_test.go): scrapes registered tool names from all internal/mcpserver/mcpserver*.go non-test files.
- TestNoNewBareHTTPClient (bare_http_client_allowlist_test.go): the localSeatView count of 1 moves to internal/mcpserver/mcpserver_status.go; total unchanged.

reviewdiff_test.go and reviewlane/review_test.go only mention mcpserver.go inside fixture strings and are left alone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@dmmdea
dmmdea merged commit 3a5f9cd into main Oct 30, 2026
6 checks passed
@dmmdea
dmmdea deleted the refactor/split-mcpserver-file branch October 30, 2026 01:33
@dmmdea dmmdea mentioned this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant