Skip to content

chore: upgrade declscope to 0.13.1 and adopt declscope shrink - #42

Merged
mpyw merged 6 commits into
mainfrom
chore/declscope-0.13.0
Sep 25, 2026
Merged

mpyw merged 6 commits into
mainfrom
chore/declscope-0.13.0

Conversation

@mpyw

@mpyw mpyw commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Summary

Change Detail
Version bump declscope 0.12.0 → 0.13.0 in mise.toml. CI installs it through jdx/mise-action, so there is no other pin
Skill update .claude/skills/declscope-adoption/ reinstalled from the 0.13.0 binary (declscope skill install -agent claude-code -f)
Migration edits None needed. main was already on 0.12.0, and the 0.13.0 analyzer reports nothing on the unchanged tree
shrink adoption 32 declarations unexported, 1 kept with a reason (below)
CI declscope shrink ./... runs before declscope ./... in the declscope job

shrink results

Item Count Detail
Unexported by shrink -fix 32 8 packages: cli/commands, config, db, executor, js, mock, server, server/body
Crossings stated 9 One //declscope:package each, with a "Shared on purpose: <file>.go (<func>) ..." line in the doc comment, as the rest of the repo does
Ignores added 1 commands.Version: .goreleaser.yaml sets it with -X, which names it by its exported path. shrink offered no fix for it
Not judged 0 shrink printed no not judged line
Crossing stated Used from
executor.compileTransforms, executor.compileMock mutation.go (NewMutationExecutor), query.go (NewQueryExecutor)
js.newReadonlyHeaders request.go (newRequest)
js.newWritableHeaders response.go (newResponse)
js.newRequest, js.newResponse apply.go (NewTransformContext)
js.errJSTimeout apply.go (runCallable), pool.go (PooledVM.Call)
mock.ValueParser.parse csv.go (parseCSVReaderWithOptions)
body.errBadRequest form.go, json.go

Doc comments that still named a renamed declaration by its old name were fixed by hand. This includes the core-file notes in config.go and body/parser.go, which listed config.Parse and body.MaxBodySize as the package's API.

Note

server.QueryHandler and server.MutationHandler are now unexported types. NewQueryHandler and NewMutationHandler stay 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

Order Step in the declscope job
1 new declscope shrink ./...
2 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

Check Result
gofmt -l . empty
go build ./... pass
go vet ./..., and with each driver tag (postgres, mysql, sqlite, mssql, mock) pass
declscope shrink ./... exit 0
declscope ./... clean
golangci-lint run ./... (2.13.1) 0 issues
go test -race ./internal/... and ./e2e/... pass
actionlint v1.7.7 on test.yml pass (release.yml has shellcheck findings that were already there on main)

🤖 Generated with Claude Code

https://claude.ai/code/session_01KtUXCXiWE99YCb9ZcLmSsn

mpyw and others added 3 commits September 25, 2026 13:25
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

codecov Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.31034% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.90%. Comparing base (00a765b) to head (2d4b931).

Files with missing lines Patch % Lines
internal/cli/commands/app.go 0.00% 4 Missing ⚠️
internal/executor/executor.go 42.85% 4 Missing ⚠️
internal/server/body/form.go 50.00% 2 Missing ⚠️
internal/executor/mutation.go 66.66% 1 Missing ⚠️
internal/executor/query.go 66.66% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #42   +/-   ##
=======================================
  Coverage   82.90%   82.90%           
=======================================
  Files          38       38           
  Lines        1685     1685           
=======================================
  Hits         1397     1397           
  Misses        288      288           
Files with missing lines Coverage Δ
internal/config/config.go 86.66% <100.00%> (ø)
internal/config/error.go 94.56% <ø> (ø)
internal/config/types.go 90.19% <100.00%> (ø)
internal/db/db.go 75.00% <100.00%> (ø)
internal/executor/compile.go 100.00% <ø> (ø)
internal/js/apply.go 90.36% <100.00%> (ø)
internal/js/headers.go 91.57% <100.00%> (ø)
internal/js/pool.go 92.68% <100.00%> (ø)
internal/js/request.go 100.00% <100.00%> (ø)
internal/js/response.go 100.00% <100.00%> (ø)
... and 16 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mpyw mpyw changed the title chore: upgrade declscope to 0.13.0 and adopt declscope shrink chore: upgrade declscope to 0.13.1 and adopt declscope shrink Sep 25, 2026
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.
@mpyw
mpyw merged commit d77c656 into main Sep 25, 2026
7 of 8 checks passed
@mpyw
mpyw deleted the chore/declscope-0.13.0 branch September 25, 2026 06:27
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