Problem
Adding a new backend method requires four coordinated edits: interface definition, MPR implementation, mock stub, and compile-time interface check. The mock (mdl/backend/mock/) is hand-written and the most error-prone step — an agent or contributor can miss it, causing compilation failures in unrelated tests.
The mock currently has 17 files for 26 sub-interfaces in FullBackend, indicating it is already drifting from the interface definitions.
Proposed solution
Replace the hand-written mock with one generated by mockgen (or moq) from the backend interfaces. The generated mock is always correct by construction — it can never drift.
Implementation steps
- Add
mockgen or moq as a Go tool dependency (go install in tools.go)
- Add
//go:generate mockgen ... directives to each interface file in mdl/backend/
- Add
make mocks target that runs go generate ./mdl/backend/...
- Add generated mock files to
.gitignore (same rationale as the generated parser: derived from source)
- Add
make mocks step to CI before make test
- Delete hand-written mock files in
mdl/backend/mock/
Expected outcome
Adding a new backend method requires only two edits: the interface and the MPR implementation. The mock is regenerated automatically. Interface drift is impossible.
See proposal: docs/11-proposals/PROPOSAL_agentic_architecture_improvements.md (Change 4)
Problem
Adding a new backend method requires four coordinated edits: interface definition, MPR implementation, mock stub, and compile-time interface check. The mock (
mdl/backend/mock/) is hand-written and the most error-prone step — an agent or contributor can miss it, causing compilation failures in unrelated tests.The mock currently has 17 files for 26 sub-interfaces in
FullBackend, indicating it is already drifting from the interface definitions.Proposed solution
Replace the hand-written mock with one generated by
mockgen(ormoq) from the backend interfaces. The generated mock is always correct by construction — it can never drift.Implementation steps
mockgenormoqas a Go tool dependency (go installintools.go)//go:generate mockgen ...directives to each interface file inmdl/backend/make mockstarget that runsgo generate ./mdl/backend/....gitignore(same rationale as the generated parser: derived from source)make mocksstep to CI beforemake testmdl/backend/mock/Expected outcome
Adding a new backend method requires only two edits: the interface and the MPR implementation. The mock is regenerated automatically. Interface drift is impossible.
See proposal:
docs/11-proposals/PROPOSAL_agentic_architecture_improvements.md(Change 4)