fix(mcp): teach the assistant test stub the scheduling methods - #11318
Merged
Conversation
#11228 added ListScheduling, GetScheduling, SetScheduling and DeleteScheduling to localaitools.LocalAIClient but did not update stubClient, the hand-written test double in the mcp endpoints package. The package therefore fails to typecheck, which takes out both lint and tests on master: cannot use stubClient{} as localaitools.LocalAIClient value in argument to h.Initialize: stubClient does not implement localaitools.LocalAIClient (missing method DeleteScheduling) Red on 8f74f74, fd4ec08 and 8a68f35; green on cd62e8f, the commit before. Add the four methods with the same inert bodies the rest of the stub uses. The real implementations are covered in the localaitools suites; this double only exists so the holder can be constructed. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude Code:claude-opus-5 [Read] [Edit] [Bash]
mudler
added a commit
that referenced
this pull request
Aug 3, 2026
master does not compile:
vet: core/http/endpoints/mcp/localai_assistant_test.go:157:19:
method stubClient.ListScheduling already declared at
core/http/endpoints/mcp/localai_assistant_test.go:87:19
Two fixes for the same breakage landed. The four Scheduling methods were
already present at lines 87-99, in interface order after ListNodes, by
the time #11318 merged; #11318 appended its own copy after
GetRouterDecisions. The two blocks sit in different parts of the file, so
git merged both without a conflict and nothing flagged it.
Remove the appended copy and keep the one in interface order. Pure
deletion, no behaviour change.
Verified: go vet clean on ./core/http/endpoints/mcp/, and
go test ./core/http/endpoints/mcp/ passes.
Assisted-by: Claude Code:claude-opus-5 [Read] [Edit] [Bash]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
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.
Problem
master does not compile its test suite.
lintandtestsare both red on the three most recent commits (8f74f74b,fd4ec083,8a68f357) and green oncd62e8ff, the one before.Cause
#11228 added four methods to the
localaitools.LocalAIClientinterface:The two real implementations (
inprocandhttpapi) were updated.stubClient, the hand-written test double in the mcp endpoints package, was not, so that package fails to typecheck. Go reports only the first missing method, which is why the error namesDeleteSchedulingalone.Fix
Add the four methods with the same inert bodies the rest of the stub already uses. The real implementations are covered by the
localaitoolssuites; this double exists only so the holder can be constructed.Verification
go vetclean on./pkg/mcp/localaitools/,./pkg/mcp/localaitools/inproc/,./pkg/mcp/localaitools/httpapi/,./core/http/endpoints/mcp/and./core/http/routes/, all of which failed or were at risk before.go test ./core/http/endpoints/mcp/ ./pkg/mcp/localaitools/...-> 4 packages ok.inproc,httpapiand thefakeClientinlocalaitools/fakes_test.goall already satisfy the interface.stubClientwas the only gap.