Factor the internal packages - #168
Merged
Merged
Conversation
Nothing outside the deleted files referenced them. Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Only asteval imported it, and that use is gone. Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Removes HTTPHeader, IterateGenDecl, IterateValueSpecs, IterateFieldTypes, FieldIndex and TimeParseCall, and the test that only covered IterateFieldTypes. Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
The two differed only in the directory. Callers compute it, so load no longer imports generate or analysis. Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
cli writes it with header.Format; generate's FileArguments becomes header.Scan and analysis reads the two lines with header.Parse. Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
NewModule now asks a callback over analysis' own types to parse header arguments, so analysis no longer imports pflag or generate. The flag parsing and defaulting move to cli. Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Only internal/muxt calls them. Definition.IsSignalsCallback stays exported: the unexported name is taken by a helper that wraps it. Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports
Move-only: declarations keep their text and move to handler_statements.go, parse_arguments.go, parse_scalar.go and parse_form.go. Assisted-by: Claude:claude-sonnet-5-5 gofumpt goimports
Move-only: declarations keep their text and move to definition_duplicates.go, handler_expression.go, response_state.go and redirect.go. Assisted-by: Claude:claude-sonnet-5-5 gofumpt goimports
Move-only: declarations keep their text and move to argument.go, argument_bind.go, body_wrappers.go and result_shape.go. call.go keeps call resolution. Assisted-by: Claude:claude-sonnet-5-5 gofumpt goimports
Move-only: declarations keep their text and move to generate_command.go, analysis_commands.go, mutation_command.go, module_commands.go, flags.go, flag_names.go and output.go. commands.go keeps Commands, runners and the root and version commands. Assisted-by: Claude:claude-sonnet-5-5 gofumpt goimports
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
…erdictOf Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
… struct Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
…tate checks Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
Assisted-by: Claude:claude-sonnet-5-5 gopls gofumpt goimports staticcheck gremlins
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.
Refactors
internal/for the next round of features. The CLI, the generated output and every integration test are unchanged: nothing undercmd/changes and no snapshot archive changes.Dependencies
loadno longer importsgenerateoranalysis. Oneload.PackageWithReceiverreplacesGenerateSourceandRoutesSource.analysisno longer importspflagorgenerate.NewModuletakes a callback overanalysis's ownPackageConfigand is split into listing the module, scanning for headers, and building each package's info.internal/header, owns the generated-file header comment:Format,ParseandScan.cliwrites it,analysisreads it, andgenerate.FileArguments(which ignored one of its two parameters) is gone.generatehas nogo/typesimport outside tests.source.StringTypecovers its one use.mutationno longer reachesgenerateandanalysisthroughload.Structure
The largest files are split by concept, moving whole declarations and changing nothing inside them:
generate/routes.go,muxt/definition.go,muxt/call.goandcli/commands.go. A fingerprint of every top-level declaration was identical before and after.Code that repeated itself is shared: the two route-function builders in
generate, the template-data method boilerplate, the variable-declaration builders, the strconv builder families inastgen, the two result-shape classifiers inmuxt, and the list-command helpers incli. Dead code is removed:asterr, unusedastevalandastgenhelpers, and the redundant parts of several checks.Complexity
loadtesthelperThe largest were
appendParseArgumentStatements(35),analysis.NewModule(28),resolveCall(25),walkTemplateCommands(24) andnewArgumentFromIdentifier(23); all are now under 10.Tests
Aggregated statement coverage across
internal/goes from 82.9% to 92.8%:cli68% to 93%,muxt85% to 94%,fakeserver0% to 92%, and theastgenbuilders are covered directly. Gremlins now leaves no surviving mutant in changed code inmuxt,generate,analysis,astgen,headerorfakeserver. Where a mutant was equivalent, the code was simplified instead. Theclisurvivors are the version checks that depend on real build info.Behavior changes
Small, each in its own commit:
header.Scanaccepts headers with\r\nline endings.generate.FileArgumentsrejected them andanalysisaccepted them.appendParseArgumentStatementsreturns an error for an argument expression that is neither an identifier nor a call. Resolution already rejects those, so it cannot be reached today.FuzzCalculateIdentifiersfails on the base commit too, for two templates on/whose handlers arecreateandCreate(both get the identifierCreate). This PR does not change it.Reviewing
The 92 commits are ordered: deletions, dependency changes, move-only splits, per-package refactors with their tests, then complexity and mutation follow-ups. Reading them in order is easier than the combined diff.
🤖 Generated with Claude Code