Repository navigation
Description
Summary
AGENTS.md (Testing) says never to hand-write fake or mock structs in _test.go, because every test double is counterfeiter output committed to tests/mocks/. Two test files still hand-roll doubles for interfaces whose generated fakes are already committed and kept current by task mocks:generate:
internal/presentation/tui/components/application_view_test.godeclaresstubModeState(foragentdomain.AgentModeState, passed toModeIndicator.SetStateManager),stubStatusView(tui.StatusComponent),stubInputView(tui.InputComponent) andstubHelpBar(tui.HelpBarComponent). The fakesagentdomainmocks.FakeAgentModeState,tuimocks.FakeStatusComponent,tuimocks.FakeInputComponentandtuimocks.FakeHelpBarComponentalready exist, and the file already importstuimocks. Three of the stubs satisfy their interface by embedding a nil interface value, so a call to any method they do not override panics with a nil dereference instead of returning a zero value.internal/presentation/shortcuts/model_test.godeclaresmockModelServicewith hand-writtenListModels,SelectModel,GetCurrentModel,IsModelAvailableandValidateModelforconvdomain.ModelService, whichconversationmocks.FakeModelServicealready covers.
Why it is a win: the hand-written copies duplicate code the repo already generates, and they drift silently when an interface grows (the embedded-interface stubs still compile but panic at runtime). Principle: clean-code "duplication" and "unit test quality" (tests speak the project's own testing language), plus the repo's counterfeiter-only rule. The fix is local to two test files, with no production change and no new mock generation.
Left out on purpose: stubShortcut in internal/presentation/shortcuts/noninteractive_test.go duplicates shortcutsmocks.FakeShortcut, but that test lives in package shortcuts and the fake imports that package, so swapping it needs an external test package first.
Acceptance Criteria
- Before:
application_view_test.godeclaresstubModeState,stubStatusView,stubInputViewandstubHelpBar. After: those types are gone and the tests configureagentdomainmocks.FakeAgentModeState(GetAgentModeReturns),tuimocks.FakeStatusComponent(RenderReturns),tuimocks.FakeInputComponentandtuimocks.FakeHelpBarComponentinstead. - Before:
model_test.godeclaresmockModelServiceand its five methods. After: the tests useconversationmocks.FakeModelServicethrough itsReturnsandStubfields, and assertSelectModelArgsForCallwhere they used to read the stub'scurrentModel. - No new counterfeiter line is added to
Taskfile.yml, since all five fakes are already generated. - Imports keep the six-group layout with the canonical
agentdomainmocks,tuimocksandconversationmocksaliases. - Existing tests still pass.
Activity
edenreich commentedon Nov 20, 2026
@infer can you work on this? use /ponytail:ponytail /domain-driven-design /go /go-concurrency
inference-gateway-maintainer commentedon Nov 20, 2026
Model:
ollama_cloud/glm-5.3-flash· Action:v0.59.11· CLI:v0.263.0· Gateway:v0.68.0· View JobTodos
Pull Request
#1924
✅ Infer Result: Success
Done. Issue #1920 is resolved by PR inference-gateway/cli#1924 (branch
fix/issue-1920, marked ready for review, board item moved to QA).What changed
Test-only refactor, +43/-97 across four test files, no production code:
internal/presentation/tui/components/application_view_test.go- deletedstubModeState,stubStatusView,stubInputViewandstubHelpBar.modeIndicatorFornow wiresagentdomainmocks.FakeAgentModeStatewithGetAgentModeReturns; the row test passes atuimocks.FakeStatusComponentwithRenderReturns; the subagent-row test passes baretuimocks.FakeStatusComponent/FakeInputComponent/FakeHelpBarComponent. This also removes the embedded-nil-interface stubs that would have panicked on any un-overridden method call.internal/presentation/shortcuts/model_test.go- deletedmockModelServiceand its five methods. Tests useconversationmocks.FakeModelService:GetCurrentModelReturns/ValidateModelReturnsin the table test, and the permanent-switch test now assertsSelectModelCallCount+SelectModelArgsForCall(0)where it used to read the stub'scurrentModelfield.internal/presentation/shortcuts/core_test.goandeffort_test.go- not named in the issue, but the same package compiles them together and they consumed the sharedmockModelService, so they were swapped to the fakes (GetCurrentModelReturns) too. Without this the package would not compile.Taskfile.ymlchange - all fakes were already generated (mocks:generatestayed "up to date" during pre-commit).Verification
task precommit:runpasses end to end (mod tidy, mocks up to date, fmt, import-alias lint, golangci-lint 0 issues, markdownlint) - it ran as the commit gate and again detached before push.go vetandgo testpass on both affected packages; working tree clean, branch pushed,Resolves #1920in the PR body.Kept out on purpose (as the issue scoped):
stubTokenEstimatorandstubShortcuthave no committed counterpart fake, so removing them would require new mock generation or an external test package.Skipped or unchecked: I did not convert
stubTokenEstimator/stubShortcutand did not run the fullgo test ./...suite (only the affected packages plus the full lint gate) - CI will cover the rest. Risk: net test-only change, so the only real exposure is if CI surfaces an unrelated flaky test.Model:
ollama_cloud/glm-5.3-flash· Action:v0.59.11· CLI:v0.263.0· Gateway:v0.68.0· Exit Code:0· Duration: 8m 34sTokens: 4,044,037 in · 51,710 out · 4,095,747 total (45 requests)
Tool calls: 78 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
inference-gateway-releaser commentedon Nov 20, 2026
🎉 This issue has been resolved in version 0.265.4 🎉
The release is available on:
Your semantic-release bot 📦🚀