Add test enablers: MockPageMutator, MockWorkflowMutator, registry completeness#244
Add test enablers: MockPageMutator, MockWorkflowMutator, registry completeness#244retran wants to merge 7 commits intomendixlabs:mainfrom
Conversation
When setting PAGE on a workflow activity where the TaskPage BSON key is absent (not just nil), dSet silently failed because it only updates existing keys. Added replaceActivity helper that appends the key to the activity document and replaces it in the BSON tree by match. Three cases now handled correctly: - TaskPage exists with value: update Page field in place - TaskPage exists with nil value: replace via dSet - TaskPage absent: append key, replace activity in tree
…ss test Add mock implementations of PageMutator (16 methods) and WorkflowMutator (15 methods) using the same Func-field delegation pattern as MockBackend. Both include compile-time interface checks. Fix allKnownStatements() to include 8 missing agent editor statement types (CreateAgent, DropAgent, CreateModel, DropModel, CreateConsumedMCPService, DropConsumedMCPService, CreateKnowledgeBase, DropKnowledgeBase). Add handler count snapshot test.
AI Code ReviewWhat Looks Good
RecommendationApprove. This PR adds valuable test enablers that will unblock subsequent test coverage PRs, fixes an actual bug in workflow mutator handling, and maintains consistency with existing patterns in the codebase. No checklist violations apply to this test infrastructure-focused change. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
There was a problem hiding this comment.
Pull request overview
Adds test infrastructure and strengthens registry/workflow mutation correctness checks to unblock broader MDL subsystem test coverage work.
Changes:
- Add
MockPageMutatorandMockWorkflowMutatortest doubles that implement the corresponding backend mutator interfaces via Func-field delegation. - Fix
allKnownStatements()completeness for agent editor statement types and add a handler-count parity test vs. known statement types. - Fix workflow PAGE mutation when
TaskPagekey is absent by appending the key and replacing the activity document in the BSON tree; add regression coverage (including nested sub-flow case).
Reviewed changes
Copilot reviewed 7 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| mdl/types/id_test.go | Test formatting/alignment tweak. |
| mdl/types/edmx_test.go | Test struct field alignment tweak. |
| mdl/executor/widget_registry.go | Minor formatting alignment in WidgetRegistry fields. |
| mdl/executor/registry_test.go | Expand known statement list and add handler-count parity test. |
| mdl/backend/mpr/workflow_mutator_test.go | Update/strengthen regression coverage for PAGE mutation (missing key + nested sub-flow). |
| mdl/backend/mpr/workflow_mutator.go | Ensure PAGE mutation works when TaskPage key is absent by replacing the activity in the BSON tree. |
| mdl/backend/mpr/convert_roundtrip_test.go | Remove trailing whitespace line. |
| mdl/backend/mpr/backend.go | Formatting/go-fmt style adjustments. |
| mdl/backend/mock/mock_workflow_mutator.go | New WorkflowMutator mock for tests. |
| mdl/backend/mock/mock_page_mutator.go | New PageMutator mock for tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AI Code ReviewWhat Looks Good
RecommendationApprove - The PR successfully delivers test infrastructure that unblocks future coverage work, fixes a real bug in workflow mutation, and adds preventive measures to maintain registry consistency. All changes are focused, follow existing patterns, and include appropriate test coverage. No critical or moderate issues identified. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 10 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Review: PR #244 — Add test enablers: MockPageMutator, MockWorkflowMutator, registry completenessVerdict: Approve with notes — solid test infrastructure. The mocks are cleanly implemented and the registry snapshot test adds real value. One convention question worth discussing. OverviewThree distinct additions:
Note: this diff also includes the MockPageMutator / MockWorkflowMutator
Convention gap: CLAUDE.md specifies that mock stubs should have a descriptive error default ( func (m *MockPageMutator) SetWidgetProperty(...) error {
if m.SetWidgetPropertyFunc != nil {
return m.SetWidgetPropertyFunc(...)
}
return nil // ← CLAUDE.md convention says this should be a named error
}For mutator mocks this is actually a defensible design choice — silent no-ops let test authors stub only what they care about. But it's inconsistent with the existing Registry Completeness FixThe 8 added statement types (
|
Summary
Test infrastructure that unblocks subsequent test coverage PRs:
allKnownStatements()was missing 8 agent editor statement types that were registered but not validatedContext
Part of stacked PR series for MDL subsystem test coverage (PR A). Depends on PR #243 (
fix/dset-silent-failure). Retarget base tomainafter #243 merges.