refactor: decompose prune.go by protocol - #97
Merged
Conversation
At 799 lines it sat one under the ceiling, so the next change to it failed the gate. It splits three ways: resolving a call against the SDK that has to make it, settling how a list call reaches its elements, and what remains — the entry point and the four per-kind entities. No behaviour change. unsupported.json is byte-identical on all three pilots and every generated tree reproduces without drift. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
internal/sdkbind/prune.gosat at 799 lines against an 800-line ceiling, sothe next change to it failed
scripts/repo_hygiene_gate.sh.handoff.md:251names it as blocking work: the largest attribute-level refusal family left —
234
carries no Get… to read— lives in this package.The split
Three files, by protocol rather than by size:
prune.goPrune,pruner,resolveType,remove, the four per-kind entities (resource,datasource,listResource,action),settleUpdateBody,copyFieldBindings,unbuildableReasonprune_calls.goresolveCall,resolveFieldHop,repairBodySetter,settleCall,writeModelFor,settleParamTypes,repairIndexer,recordTypePackageprune_list.goresolveListElement,sliceGetters,sliceFields,pickByNameThe two new files carry a header saying what the group is for — a collection
comes back as a slice, as an envelope with a getter, or as an envelope with a
field, and which of those it is decides what the generated iteration reads.
Measured effect
None, and that is the acceptance test.
unsupported.jsonis byte-identical on all three pilots — verified withdiff, not by comparing totals:tfpfgen provider verifyreports no drift on all three (3358 / 2935 / 1420files), and
postcheckpasses.No function was renamed, no signature changed, and no comment was rewritten —
the declarations moved and nothing else, so the diff is reviewable as a move.
Gates
gofmt -l internal cmd— emptyscripts/repo_hygiene_gate.sh— pass (this is what it was failing)golangci-lint run— 0 issuesgo build ./... && go vet ./...— passgo test ./...— pass,internal/sdkbind85.0%, 91.4% total🤖 Generated with Claude Code