[Schema Consistency] Schema Consistency Check: Conditional Logic Validation Gaps (2025-11-26) #4800
Closed
Replies: 1 comment
-
|
⚓ Avast! This discussion be marked as outdated by Schema Consistency Checker. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🔍 Schema Consistency Check - 2025-11-26
Overview
This analysis focused on conditional logic and feature flag interactions across the schema, parser, compiler, documentation, and real workflows. The investigation revealed significant gaps where runtime validation enforces rules not represented in the JSON Schema, making external validation tools unable to catch configuration errors.
Key Discovery: The compiler implements sophisticated conditional validation (like the label-only event exception for command triggers) that cannot be expressed in JSON Schema, creating a validation gap for IDE tooling and external validators.
Full Report Details
Summary
Analysis Methodology
pkg/workflow/compiler.godocs/troubleshooting/errors.mdand reference docsCritical Issues
1. Command Trigger Conflicts Not Schema-Validated
Location:
pkg/workflow/compiler.go:1334-1343Issue: The compiler enforces mutual exclusivity between
commandtriggers and comment-related events (issues,issue_comment,pull_request,pull_request_review_comment), but this rule is not encoded in the JSON Schema.Code Evidence:
Impact:
Documentation Status: ✅ Partially documented in
errors.md:353andcommand-triggers.md:402. Label-Only Event Exception Not Documented
Location:
pkg/parser/schema.go:553-590andpkg/workflow/compiler.go:1338Issue: The implementation includes a nuanced exception -
issuesandpull_requestevents CAN be combined withcommandtriggers IF they only containlabeledorunlabeledtypes. This exception is implemented but not documented.Code Evidence:
Impact:
Documentation Gap:
command-triggers.md:40states categorical prohibition without exception3. branches vs branches-ignore Mutual Exclusivity Missing
Location: Edge case test 20 revealed
Issue: GitHub Actions specifies that
branchesandbranches-ignoreare mutually exclusive, but gh-aw provides no validation for this GitHub Actions constraint.Impact:
Real World: 5+ workflows use
branches, none usebranches-ignore(no conflicts found in practice)Recommendation: Add compile-time warning or error for this GitHub Actions anti-pattern
4. Logical Conflicts Not Detected (draft + ready_for_review)
Location: Edge case test 24 revealed
Issue: Logically contradictory PR filter combinations compile without warning:
draft: true- only draft pull requeststypes: ["ready_for_review"]- only PRs marked ready for reviewThese conditions are mutually exclusive by definition (draft PRs cannot be ready for review), creating a filter that will never match.
Impact:
Real World: 12 workflows use
draft: true, none combine withready_for_review(good practices in actual usage)Moderate Issues
5. Empty Schedule Array Accepted
Location: Edge case test 19
Issue: Schema accepts
schedule: []without validationImpact: Workflow compiles but will never run on schedule
Fix: Add
minItems: 1constraint to schedule array in schema6. Conditional Default Not Schema-Documented
Location:
pkg/workflow/compiler.go:1328-1332Issue: Command name defaults to filename only when
commandfield exists butnamenot specified. This conditional default behavior is not documented in schema metadata.Impact: IDE autocomplete cannot hint at automatic behavior
Code:
Positive Findings
✅ Well-Documented Conflicts
Command trigger conflicts documented in:
docs/troubleshooting/errors.md:353(error message explanation)docs/reference/command-triggers.md:40(usage warning)MCP container/command exclusivity documented in:
docs/troubleshooting/errors.md:437✅ Clean Real Workflows
Real workflow analysis revealed excellent practices:
branches/branches-ignoreconflictsdraft/ready_for_reviewcontradictionsbranchesfiltersdraftfiltering✅ Sophisticated Implementation
The
IsLabelOnlyEvent()function demonstrates thoughtful implementation handling edge cases correctly, even if not fully documented.Schema Limitations
JSON Schema cannot express:
These limitations mean some validation MUST remain in the compiler, but should be documented in schema
$commentfields or descriptions.Recommendations
High Priority
Add schema $comment annotations for conditional rules:
Document label-only exception in
command-triggers.md:command+issues.types: [labeled]combinationAdd compile-time warnings for logical conflicts:
branches+branches-ignorecombinationdraft: true+types: [ready_for_review]combinationAdd minItems constraints:
schedule:minItems: 1runs-on(array form):minItems: 1Medium Priority
Enhance schema descriptions with conditional behavior:
Add validation testing for conditional rules:
Low Priority
Conclusions
The analysis revealed a validation gap between compile-time enforcement and schema-time validation. While the compiler correctly implements sophisticated conditional logic, the JSON Schema cannot express these rules, creating challenges for:
Key Insight: The label-only event exception exemplifies the limits of JSON Schema - the rule is too nuanced for declarative schema expression, requiring imperative validation logic.
Positive Note: Real workflows demonstrate excellent practices with zero instances of the identified anti-patterns, suggesting user documentation and error messages are effective despite schema gaps.
Strategy Performance
Novel Discoveries: This run integrated edge case testing insights (tests 19, 20, 24) with conditional analysis, revealing new issues beyond previous runs. The label-only exception discovery is particularly valuable for advanced users.
Next Steps
Analysis Date: 2025-11-26
Workflow Run: §19690567479
Strategy: Conditional Logic & Feature Flag Analysis
Effectiveness: Very High (8 findings, 4 critical)
Beta Was this translation helpful? Give feedback.
All reactions