Repository navigation
chore: upgrade declscope to 0.13.1 and adopt declscope shrink - #42
Merged
Merged
Conversation
Reinstall the declscope-adoption skill from the 0.13.0 binary, which now teaches declscope shrink. The analyzer reports nothing new on this tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KtUXCXiWE99YCb9ZcLmSsn
…ge uses declscope shrink -fix unexported 32 declarations in 8 internal/ packages. Nine of them are used from another file of the same package, and say so with //declscope:package and a "Shared on purpose" line naming the user: compileTransforms and compileMock (executor), newReadonlyHeaders, newWritableHeaders, newRequest, newResponse and errJSTimeout (js), ValueParser.parse (mock), and errBadRequest (server/body). commands.Version stays exported with //declscope:ignore overexported: .goreleaser.yaml sets it with -X by its exported path. Doc comments that named a renamed declaration by its old name are updated, including the core-file notes in config.go and body/parser.go that listed config.Parse and body.MaxBodySize as the package's API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KtUXCXiWE99YCb9ZcLmSsn
Unexporting a declaration makes it private to its file's namespace, so a use from another file becomes a boundary crossing the analyzer reports. shrink therefore runs first in the declscope job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KtUXCXiWE99YCb9ZcLmSsn
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #42 +/- ##
=======================================
Coverage 82.90% 82.90%
=======================================
Files 38 38
Lines 1685 1685
=======================================
Hits 1397 1397
Misses 288 288
🚀 New features to boost your workflow:
|
declscope 0.13.1 carries an alias an exported constructor returns by its own name, so NewQueryHandler and NewMutationHandler keep returning a type their callers can name.
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.
Summary
mise.toml. CI installs it throughjdx/mise-action, so there is no other pin.claude/skills/declscope-adoption/reinstalled from the 0.13.0 binary (declscope skill install -agent claude-code -f)mainwas already on 0.12.0, and the 0.13.0 analyzer reports nothing on the unchanged treedeclscope shrink ./...runs beforedeclscope ./...in thedeclscopejobshrink results
shrink -fixcli/commands,config,db,executor,js,mock,server,server/body//declscope:packageeach, with a "Shared on purpose:<file>.go(<func>) ..." line in the doc comment, as the rest of the repo doescommands.Version:.goreleaser.yamlsets it with-X, which names it by its exported path. shrink offered no fix for itnot judgedlineexecutor.compileTransforms,executor.compileMockmutation.go(NewMutationExecutor),query.go(NewQueryExecutor)js.newReadonlyHeadersrequest.go(newRequest)js.newWritableHeadersresponse.go(newResponse)js.newRequest,js.newResponseapply.go(NewTransformContext)js.errJSTimeoutapply.go(runCallable),pool.go(PooledVM.Call)mock.ValueParser.parsecsv.go(parseCSVReaderWithOptions)body.errBadRequestform.go,json.goDoc comments that still named a renamed declaration by its old name were fixed by hand. This includes the core-file notes in
config.goandbody/parser.go, which listedconfig.Parseandbody.MaxBodySizeas the package's API.Note
server.QueryHandlerandserver.MutationHandlerare now unexported types.NewQueryHandlerandNewMutationHandlerstay exported, because the e2e tests call them. They now return*queryHandler/*mutationHandler. This is valid Go, and the e2e tests use only the handlers' methods, but it is worth a look.CI change
declscopejobdeclscope shrink ./...declscope ./...shrink goes first because a declaration it unexports becomes private to its file's namespace. A use from another file is then a boundary crossing that the analyzer reports.
Verification
gofmt -l .go build ./...go vet ./..., and with each driver tag (postgres,mysql,sqlite,mssql,mock)declscope shrink ./...declscope ./...golangci-lint run ./...(2.13.1)go test -race ./internal/...and./e2e/...test.ymlrelease.ymlhas shellcheck findings that were already there onmain)🤖 Generated with Claude Code
https://claude.ai/code/session_01KtUXCXiWE99YCb9ZcLmSsn