Skip to content

[Code Quality] Add maxLength constraints to schema string fields #13373

@github-actions

Description

@github-actions

Description

The workflow schema in pkg/parser/schemas/main_workflow_schema.json has strong minLength validation (19 constraints) but weak maxLength validation (only 3 constraints). Core string fields like name, description, and tracker-id lack upper bounds, allowing unbounded strings that could cause API/database issues or performance problems.

Problem

Current State:

  • name: has minLength: 1 but NO maxLength
  • description: NO length constraints at all
  • tracker-id: has minLength: 8 and pattern validation but NO maxLength

Impact:

  • Could accept extremely long strings (50+ lines observed in production workflows)
  • No protection against accidentally pasting large text blocks
  • Database/API limits could be hit without validation feedback
  • Validation happens at runtime instead of parse time

Evidence from Schema Consistency Check:

  • Schema has 19 minLength constraints but only 3 maxLength constraints
  • Analysis of 198 production workflows shows conservative usage, but schema should enforce limits

Suggested Changes

Add maxLength constraints to core string fields in pkg/parser/schemas/main_workflow_schema.json:

{
  "name": {
    "type": "string",
    "minLength": 1,
    "maxLength": 256  // Add this
  },
  "description": {
    "type": "string",
    "maxLength": 10000  // Add this
  },
  "tracker-id": {
    "type": "string",
    "minLength": 8,
    "maxLength": 128,  // Add this
    "pattern": "^[a-zA-Z0-9_-]+$"
  }
}

Files Affected

  • pkg/parser/schemas/main_workflow_schema.json (schema definitions)
  • Potentially: Validation error messages in pkg/workflow/*_validation.go files

Success Criteria

  • name field has maxLength: 256 constraint
  • description field has maxLength: 10000 constraint
  • tracker-id field has maxLength: 128 constraint
  • Schema validation tests pass
  • Existing workflows continue to validate successfully
  • Error messages for violations are clear and actionable

Priority

High - Prevents potential API/database issues and improves schema robustness. Estimated effort: 1 day.

Source

Extracted from Schema Consistency Check - 2026-01-26 discussion #11976

Key finding: "Only 3 maxLength constraints across entire schema. Key fields (name, description, tracker-id) lack upper bounds, allowing unbounded strings."

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 17, 2026, 1:30 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions