You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
openapi: Scope.DeclaredAt, Scope.ModelAt and loops.into are called only from tests #983
Three methods exist for their tests. No production code calls them:
resolve.Scope.DeclaredAt and resolve.Scope.ModelAt, each a one-line forward to Locate(pointer).Declared() and Locate(pointer).Model(), called from 19 test lines;
load.loops.into, a wrapper over loops.read that drops its second result, called from 11 test lines.
Production reaches the same answers through Locate and read. Each forwarder carries a doc comment that holds reasoning the real method should hold (the mapping-value rule of #530 and #757 for DeclaredAt; the chain rule of #771 for into).
git grep -nE '\.(DeclaredAt|ModelAt|into)\(' -- '*.go' ':!*_test.go' finds no call; the same pattern over *_test.go finds 30.
Direction
A draft. The tests call Locate(pointer).Declared(), Locate(pointer).Model() and read, or a helper in the test file for into. The reasoning in the three doc comments moves to Location.Declared, Location.Model and loops.read, where the code is.
Out of scope
Other members that only tests call, each kept for a reason:
interface satisfiers, which a call through an interface hides from a use count;
defs.Reader.Reads, a work counter that the cost-bound tests read;
compile.Diags.Len and compile.Types.Len, accessors of the framework a second compiler will use. Decide whether they stay as API in their own issue if wanted;
openapi.DefaultStreamingMediaTypes and openapi.DefaultExtensionPromotions, part of the compiler's exported surface.
#1016 removes two of the three. load.loops, with into, went with the cycle check, and Scope.DeclaredAt went with the lookups the schema bindings replaced. resolve.Scope.ModelAt remains, still with no production caller: git grep -nE '\.ModelAt\(' -- '*.go' ':!*_test.go' gives no matches at e7d3c05.
Two more members that only tests call, both package functions rather than methods:
fragment.Of (compilers/openapi/internal/fragment/fragment.go:51) percent-encodes a pointer into a $ref fragment, the inverse of fragment.Pointer. Only fragment_test.go calls it, to build round-trip inputs.
oas.Kinds (compilers/openapi/internal/oas/types.go:45) lists the rule table's kinds. Only minor_test.go and table_test.go call it.
The direction is the same as for the three above. Each moves into its tests, through an export_test.go where an external test package needs it, and any reasoning in its doc comment moves to the function the production code does call.
One more member that only tests call: relation.dropped (compilers/openapi/internal/merge/typejudge.go:37), which reports whether the fold loses the second declaration's type. #1000 added it together with TestRelation_DroppedAndFlipped, and no production code has called it since. The fold decides what it drops from the relation itself.
git grep -nE '\.dropped\(' -- '*.go' ':!*_test.go' → no matches; the same pattern over *_test.go finds the two assertions in typejudge_internal_test.go (morphic @4ca2dc90).
Unlike the others, it has no doc-comment reasoning to move: the method and its two assertions go, and TestRelation_DroppedAndFlipped keeps its flipped checks.
Activity
OmarAlJarrah commentedon Oct 20, 2026
#1016 removes two of the three.
load.loops, withinto, went with the cycle check, andScope.DeclaredAtwent with the lookups the schema bindings replaced.resolve.Scope.ModelAtremains, still with no production caller:git grep -nE '\.ModelAt\(' -- '*.go' ':!*_test.go'gives no matches at e7d3c05.OmarAlJarrah commentedon Oct 22, 2026
Two more members that only tests call, both package functions rather than methods:
fragment.Of(compilers/openapi/internal/fragment/fragment.go:51) percent-encodes a pointer into a$reffragment, the inverse offragment.Pointer. Onlyfragment_test.gocalls it, to build round-trip inputs.oas.Kinds(compilers/openapi/internal/oas/types.go:45) lists the rule table's kinds. Onlyminor_test.goandtable_test.gocall it.git grep -nE 'fragment\.Of\(|oas\.Kinds\(' -- '*.go' ':!*_test.go'→ no matches (morphic @ff8330ba).The direction is the same as for the three above. Each moves into its tests, through an
export_test.gowhere an external test package needs it, and any reasoning in its doc comment moves to the function the production code does call.OmarAlJarrah commentedon Oct 22, 2026
One more member that only tests call:
relation.dropped(compilers/openapi/internal/merge/typejudge.go:37), which reports whether the fold loses the second declaration's type. #1000 added it together withTestRelation_DroppedAndFlipped, and no production code has called it since. The fold decides what it drops from the relation itself.git grep -nE '\.dropped\(' -- '*.go' ':!*_test.go'→ no matches; the same pattern over*_test.gofinds the two assertions intypejudge_internal_test.go(morphic @4ca2dc90).Unlike the others, it has no doc-comment reasoning to move: the method and its two assertions go, and
TestRelation_DroppedAndFlippedkeeps itsflippedchecks.