-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Labels
Description
Objective
Implement JSON Schema conditionals to enforce that command triggers cannot be used with certain event types (issues, issue_comment, pull_request, pull_request_review_comment).
Context
This addresses Issue #4 from discussion #2969. The compiler enforces this rule at runtime (pkg/workflow/compiler.go:1221), but the schema doesn't validate it. The MCP schemas already use JSON Schema conditionals correctly as a "gold standard" - this task applies that pattern to the main schema.
Approach
- Study the conditional pattern used in
pkg/parser/schemas/mcp_config_schema.json - Add
if/then/elseornotconditionals tomain_workflow_schema.json - Enforce that when
on.commandis present, the conflicting events cannot be used - Add clear error messages in schema annotations
Files to Modify
pkg/parser/schemas/main_workflow_schema.json- Add conditionals for command conflicts
Example Pattern
{
"if": {
"properties": {
"on": {"properties": {"command": {"type": "object"}}}
}
},
"then": {
"not": {
"properties": {
"on": {
"anyOf": [
{"required": ["issues"]},
{"required": ["issue_comment"]},
{"required": ["pull_request"]},
{"required": ["pull_request_review_comment"]}
]
}
}
}
}
}Reference Files
pkg/workflow/compiler.go:1221- Runtime enforcement logicpkg/parser/schemas/mcp_config_schema.json- Gold standard conditional examples
Acceptance Criteria
- Schema rejects workflows with command + conflicting events
- Schema accepts valid command configurations
- Error message is clear and helpful
- Pattern follows MCP schema best practices
- Run
make buildandmake testsuccessfully
Related to [Schema Consistency] 🔍 Schema Consistency Check - Required Fields & Error Documentation Gap (Nov 2, 2025) #2969
AI generated by Plan Command for discussion #2969
Copilot