feat: ALTER WORKFLOW command with full activity manipulation#107
feat: ALTER WORKFLOW command with full activity manipulation#107ako merged 1 commit intomendixlabs:mainfrom
Conversation
AI Code ReviewWhat Looks Good
RecommendationApprove - The PR is ready for merge. The ALTER WORKFLOW feature is fully implemented following all project guidelines and requirements. No blocking issues were identified. The LSP wiring requirement is not applicable as the feature doesn't add new formatting, diagnostics, or navigation targets that would require LSP changes (it modifies existing workflow entities which are already handled by existing LSP support). Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
ako
left a comment
There was a problem hiding this comment.
Review
What's good
- Full-stack implementation: Grammar, AST, visitor, executor, tests, docs, examples — complete pipeline per the checklist
- readPatchWrite pattern: Correctly reuses the proven ALTER PAGE approach for BSON manipulation
@Npositional disambiguation: Addresses the activity name ambiguity concern from the PR #88 design review — activities can be referenced by name with@Nsuffix when duplicates exist- BSON fixes are well-motivated:
CustomSettings/Tracingmissing from ServerConfiguration andIsReusableComponentremoval fix realmx diffcrashes - Good test coverage: 22 executor tests + 17 visitor tests
- The
writer_units.gofix is important: Cleaning up orphan mxunit files on insert failure prevents corrupted projects
Concerns
Scope — system_module.go (454 lines) is unrelated. This adds a virtual System module builder with all System entities/associations defined in code. It's a substantial feature on its own. Per the review checklist: "Each PR is scoped to a single feature or concern." This should be a separate PR unless ALTER WORKFLOW specifically needs it.
Scope — BSON compatibility fixes are bundled. The writer_settings.go, writer_modules.go, and writer_units.go changes fix real bugs but are independent of ALTER WORKFLOW. These should ideally be their own commit(s) or PR for clean bisectability.
SerializeWorkflowActivity is exported for cross-package use. The writer_workflow.go change exports a previously-internal function. This adds to the public API surface — make sure it's intentional and not just a shortcut to avoid a proper internal interface.
Generated parser files include a visitor mode switch. The diff shows new mdlparser_visitor.go and mdlparser_base_visitor.go files (1185 + 1576 lines). Was the ANTLR generation changed to emit visitors in addition to listeners? This is a significant change to the parser generation and should be called out explicitly.
The plan document (1,092 lines) is included. docs/plans/2026-04-06-alter-workflow.md is the implementation plan used to build this. Should it be committed as-is, or trimmed now that the implementation is done?
Recommendation
The ALTER WORKFLOW implementation itself looks solid. I'd suggest:
- Split out
system_module.gointo its own PR - Split out the BSON fixes (
writer_settings.go,writer_modules.go,writer_units.go) into a separate commit or PR - Clarify the visitor-mode parser generation change
The core ALTER WORKFLOW code (grammar, AST, visitor, executor, tests, docs) is ready once the scope is cleaned up.
Add ALTER WORKFLOW support to modify existing workflows via MDL: - SET properties (Name, Description, AdminPage, ContextEntity) - INSERT/DROP/REPLACE activities (UserTask, Decision, ParallelSplit, etc.) - INSERT/DROP outcomes and paths on activities - SET conditions on decision outcomes - INSERT/DROP boundary events on user tasks - @n positional disambiguation for duplicate activity names - Version-gated to Mendix 9.12+ Includes grammar rules, AST nodes, visitor, executor with 22 unit tests, 17 visitor tests, and a 324-line doctype test example. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
91509b8 to
6c122cd
Compare
AI Code ReviewCritical Issues
Moderate Issues
Minor Issues
What Looks Good
RecommendationApprove with minor follow-up items Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
|
Thanks for the review @ako! Addressed all concerns:
PR is now a single clean commit with only ALTER WORKFLOW code (25 files). Rebased on latest upstream/main. |
|
CI failure in |
ako
left a comment
There was a problem hiding this comment.
Scope concerns addressed — system_module.go, BSON fixes, visitor-mode parser files, and plan document all removed. PR is now cleanly scoped to ALTER WORKFLOW only. LGTM.
Summary
ALTER WORKFLOWMDL command for modifying existing Mendix workflows via readPatchWrite BSON manipulation@Npositional disambiguation for nested activitiesIsReusableComponentremoval, mx diff alignmentChanges
alterWorkflowStmtrules inMDLParser.g4/MDLLexer.g4with OUTCOME, ACTIVITY, CONDITION tokensAlterWorkflowStmtand operation types inmdl/ast/ast_workflow.govisitor_workflow.go+ refactoredvisitor_alter.gofor ALTER dispatchcmd_alter_workflow.gowith version gating, nil sub-doc auto-creation, boundary event warningscmd_alter_workflow_test.go(22 tests),visitor_workflow_test.go(17 tests)CustomSettings/Tracing, orphaned mxunit cleanup, mx diff compatibilityTest plan
go build ./...passesgo test ./mdl/executor/ ./mdl/visitor/— 39 new tests passmxcli exec alter-workflow.mdl -p app.mprruns clean on Mendix 11.6.4 projectmx checkpasses on modified project🤖 Generated with Claude Code