docs: workflow improvements design proposal#88
docs: workflow improvements design proposal#88engalar wants to merge 1 commit intomendixlabs:mainfrom
Conversation
Proposes ALTER WORKFLOW with graph-aware operations (INSERT AFTER, INSERT OUTCOME/PATH/BRANCH, DROP ACTIVITY/OUTCOME) and workflow cross-reference tracking in the catalog refs table. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AI Code ReviewWe need to review this pull request based on the provided information. Looking at the PR details:
The diff shows only one file being added: This is a design proposal document, not actual code changes to the implementation. Now I need to review this against the checklist items from CLAUDE.md: Overlap & duplication
MDL syntax design
From the design document: Now checking against the MDL syntax design checklist:
Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
ako
left a comment
There was a problem hiding this comment.
Review
Part 2 (Cross-References) looks ready
The cross-reference addition to the catalog builder is straightforward, independent, and high-value. It plugs workflows into the existing SHOW CALLERS/CALLEES/IMPACT infrastructure with no new commands needed. P1 implementation priority is right.
Part 1 (ALTER WORKFLOW) - concerns
Merge point algorithm is fragile. The simplified algorithm assumes each branch is a linear chain (while current has exactly one outgoing edge). This breaks for nested splits — if a branch contains a Decision or ParallelSplit, the inner split's outgoing edges would cause the traversal to stop prematurely. The algorithm needs to handle nested structured blocks, either by tracking split/merge depth or using proper post-dominator analysis.
Activity references by bare name are ambiguous. The grammar uses IDENTIFIER to reference activities (SET ACTIVITY userTask1, INSERT AFTER activityName). Workflow activity names are user-assigned display labels, not guaranteed unique. Two activities could share the same name. The design should specify behavior for duplicates — error? First match? — or use a different addressing scheme (e.g., positional index, qualified path like parallelSplit1/branch1/userTask1).
DROP PATH by 0-based index is brittle. DROP PATH 2 ON parallelSplit1 depends on knowing the internal ordering of parallel paths. If a prior DROP shifts indices, scripts that drop multiple paths need careful reverse-ordering. Consider using a name or label instead, similar to DROP OUTCOME which uses a string name.
INSERT AFTER doesn't show how the new activity connects to existing context. The example INSERT AFTER activityName CALL MICROFLOW validate Module.Validate uses inline activity syntax, but the grammar rule references workflowActivity which isn't defined in this document. Should clarify whether this reuses the same activity syntax from CREATE WORKFLOW or is a subset.
No REPLACE operation. ALTER PAGE has REPLACE for swapping one widget for another. A REPLACE ACTIVITY oldName WITH ... would be a natural addition — currently you'd need DROP + INSERT AFTER the predecessor, which requires knowing the predecessor name.
Minor issues
- Author is
@anthropics/claude-code— should be the human author - The
workflowBlockgrammar rule uses'{'and'}'literal characters instead ofLBRACE/RBRACEtokens — should use the existing lexer tokens for consistency - No mention of how
DESCRIBE WORKFLOWoutput changes to support roundtripping ALTER operations (e.g., should DESCRIBE show activity names that can be used with ALTER?)
What looks good
- Clean separation of property ops (simple, low-risk) from graph ops (complex, high-risk)
- BSON transformation diagrams for each operation are clear and implementable
- "Operations NOT supported" section is honest about scope limits
- Testing strategy covers the right edge cases
- Phase ordering is sensible — cross-refs first, then properties, then graph ops by complexity
Verdict
Part 2 (cross-references) is solid and can proceed to implementation. Part 1 (ALTER WORKFLOW) needs the merge point algorithm and activity addressing concerns resolved before implementation — these are design-level issues that would be expensive to fix after building. The property operations (P2/P3) are fine as-is since they don't touch the graph.
Summary
refstable for SHOW CALLERS/CALLEES supportMotivation
Workflow support has full CREATE/DESCRIBE/DROP coverage, but two gaps remain:
CREATE OR MODIFYrebuildSHOW CALLERS,SHOW IMPACT)Design Highlights
ALTER WORKFLOW supports two categories of operations:
Cross-References extends the existing catalog builder to track workflow→microflow, workflow→workflow, workflow→entity, and workflow→page references.
See
docs/plans/2026-04-03-workflow-improvements-design.mdfor full proposal including BSON transformation details, merge point algorithm, ANTLR grammar, and 6-phase implementation plan.Test plan
🤖 Generated with Claude Code