Repository navigation
refactor: split internal/mcpserver/mcpserver.go into topical files (pure declaration moves) - #744
Merged
Merged
Conversation
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>
Merged
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.
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.
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