Skip to content

fix(mcp): teach the assistant test stub the scheduling methods - #11318

Merged
mudler merged 1 commit into
masterfrom
fix/mcp-stubclient-scheduling
Aug 3, 2026
Merged

fix(mcp): teach the assistant test stub the scheduling methods#11318
mudler merged 1 commit into
masterfrom
fix/mcp-stubclient-scheduling

Conversation

@localai-bot

Copy link
Copy Markdown
Collaborator

Problem

master does not compile its test suite. lint and tests are both red on the three most recent commits (8f74f74b, fd4ec083, 8a68f357) and green on cd62e8ff, the one before.

core/http/endpoints/mcp/localai_assistant_test.go:150:28: cannot use stubClient{}
  (value of struct type stubClient) as localaitools.LocalAIClient value in argument
  to h.Initialize: stubClient does not implement localaitools.LocalAIClient
  (missing method DeleteScheduling)

Cause

#11228 added four methods to the localaitools.LocalAIClient interface:

ListScheduling(ctx context.Context) ([]ModelSchedulingConfig, error)
GetScheduling(ctx context.Context, modelName string) (*ModelSchedulingConfig, error)
SetScheduling(ctx context.Context, req SetSchedulingRequest) (*ModelSchedulingConfig, error)
DeleteScheduling(ctx context.Context, modelName string) error

The two real implementations (inproc and httpapi) 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 names DeleteScheduling alone.

Fix

Add the four methods with the same inert bodies the rest of the stub already uses. The real implementations are covered by the localaitools suites; this double exists only so the holder can be constructed.

Verification

  • go vet clean 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.
  • Checked for other implementers repo-wide: inproc, httpapi and the fakeClient in localaitools/fakes_test.go all already satisfy the interface. stubClient was the only gap.

#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]
@localai-bot localai-bot added the bug Something isn't working label Aug 3, 2026
@mudler
mudler merged commit 95bd59d into master Aug 3, 2026
18 of 23 checks passed
@mudler
mudler deleted the fix/mcp-stubclient-scheduling branch August 3, 2026 17:01
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants