Skip to content

[task] Add JSON Schema conditionals for command trigger conflicts #2975

@github-actions

Description

@github-actions

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

  1. Study the conditional pattern used in pkg/parser/schemas/mcp_config_schema.json
  2. Add if/then/else or not conditionals to main_workflow_schema.json
  3. Enforce that when on.command is present, the conflicting events cannot be used
  4. 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 logic
  • pkg/parser/schemas/mcp_config_schema.json - Gold standard conditional examples

Acceptance Criteria

AI generated by Plan Command for discussion #2969

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions