[Schema Consistency] 🔍 Schema Consistency Check - Edge Case Compilation Testing (2025-11-25) #4714
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.
-
Executive Summary
This analysis used a novel edge case compilation testing strategy to identify validation gaps in the workflow schema. By creating 25 test workflows with boundary values and malformed inputs, then compiling them with
gh-aw compile, I discovered 10 critical validation gaps where the schema accepts illogical or problematic values that should be rejected.Key Finding: The schema is missing essential numeric range constraints (
minimum/maximum), array size constraints (minItems), and pattern validation for structured strings like cron expressions.Good News: No production workflows use any of these problematic edge cases, indicating healthy code practices. The parser's type validation is also stricter than previously believed - it correctly rejects string values for integer fields at parse time.
Critical Validation Gaps (10 Issues Found)
1. Negative Timeout Values ❌
Test:
timeout-minutes: -10Expected: Should fail (negative timeout is illogical)
Actual: ✓ PASSED (compiled successfully)
Impact: Workflows can specify negative timeouts which have no semantic meaning
Fix: Add
minimum: 1constraint totimeout-minutesin schemaSchema Location:
pkg/parser/schemas/main_workflow_schema.json:timeout-minutes2. Zero Timeout ❌
Test:
timeout-minutes: 0Expected: Should fail (0 timeout = instant termination)
Actual: ✓ PASSED (compiled successfully)
Impact: Workflows with zero timeout would terminate immediately
Fix: Add
minimum: 1constraint totimeout-minutesin schema3. Extremely Large Timeout⚠️
Test:
timeout-minutes: 999999999Expected: Should fail or warn (exceeds GitHub Actions practical limits)
Actual: ✓ PASSED (compiled successfully)
Impact: Unrealistic timeout values accepted without validation
Fix: Add
maximum: 2160(36 hours, GitHub Actions max) totimeout-minutesReference: GitHub Actions has a maximum timeout of 2160 minutes (36 hours)
4. Invalid Cron Syntax ❌
Test:
schedule[].cron: "invalid cron syntax"Expected: Should fail (invalid cron format)
Actual: ✓ PASSED (compiled successfully)
Impact: Workflows with invalid cron expressions fail at runtime, not compile time
Fix: Add
patternconstraint for cron format validationSuggestion: Pattern should match standard cron syntax:
^(\S+\s+){4}\S+$or more specific regex5. Empty Schedule Array ❌
Test:
on: { schedule: [] }Expected: Should fail (empty schedule is meaningless)
Actual: ✓ PASSED (compiled successfully)
Impact: Workflows with empty schedules will never run
Fix: Add
minItems: 1constraint toschedulearray6. Empty runs-on Array ❌
Test:
runs-on: []Expected: Should fail (no runner specified)
Actual: ✓ PASSED (compiled successfully)
Impact: Workflow would fail at runtime with no runner specified
Fix: Add
minItems: 1constraint toruns-onarray (when array form is used)7. Empty Concurrency Group ❌
Test:
concurrency: { group: "" }Expected: Should fail (empty group name defeats purpose)
Actual: ✓ PASSED (compiled successfully)
Impact: Empty concurrency group provides no actual concurrency control
Fix: Add
minLength: 1constraint toconcurrency.group8. Both branches and branches-ignore⚠️
Test:
push: { branches: ["main"], branches-ignore: ["dev"] }Expected: Should fail or warn (mutually exclusive in GitHub Actions)
Actual: ✓ PASSED (compiled successfully)
Impact: GitHub Actions behavior is undefined when both filters are present
Fix: Add schema constraint or validation rule for mutual exclusivity, or document expected behavior
Note: This may require conditional validation beyond JSON Schema capabilities
9. runs-on Group Without Labels⚠️
Test:
runs-on: { group: "my-group" }(nolabelsfield)Expected: Unclear (depends on whether labels is required)
Actual: ✓ PASSED (compiled successfully)
Impact: May work if group alone is sufficient, but lacks documentation
Fix: Document whether
labelsis optional when usinggroup, or add schema requirement10. Logically Contradictory Filters⚠️
Test:
pull_request: { draft: true, types: ["ready_for_review"] }Expected: Should warn (logically contradictory)
Actual: ✓ PASSED (compiled successfully)
Impact: Draft PRs cannot be ready for review - filter will never match
Fix: Add conditional validation warning or documentation about incompatible filter combinations
Validations Working Correctly (12 Confirmations)
Parser Validation Strengths ✓
The following tests confirm that the parser correctly enforces schema constraints:
name: ""(minLength: 1)^[a-zA-Z0-9_-]+$timeout-minutes: "300"(expects integer)timeout-minutes: 45.7(expects integer)additionalProperties: falseworks)on:keysonfieldImportant Finding: Type Validation is Stricter Than Believed
Previous Claim (Strategy-017): "String-to-number type coercion not documented - timeout accepts '300' strings"
Test 07 Result: ✗ Parser correctly rejects string
"300"fortimeout-minutesConclusion: The parser does NOT accept strings for integer fields at parse time. Type coercion may happen elsewhere in the system, but frontmatter parsing enforces strict type matching per JSON Schema.
Schema Improvement Recommendations
High Priority (Security/Reliability Impact)
1. Add Numeric Range Constraints
File:
pkg/parser/schemas/main_workflow_schema.json{ "timeout-minutes": { "type": "integer", "minimum": 1, "maximum": 2160, "description": "Timeout in minutes (1-2160, max 36 hours per GitHub Actions limit)" } }Apply to: All integer fields representing durations, counts, limits, etc.
2. Add Array Size Constraints
{ "schedule": { "type": "array", "minItems": 1, "items": { ... } }, "runs-on": { "oneOf": [ { "type": "string" }, { "type": "array", "minItems": 1, "items": { "type": "string" } }, { "type": "object", ... } ] } }Apply to:
schedule,runs-on(array form), and other arrays where empty is meaningless3. Add String Length Constraints
{ "concurrency": { "oneOf": [ { "type": "string", "minLength": 1 }, { "type": "object", "properties": { "group": { "type": "string", "minLength": 1 } } } ] } }Apply to:
concurrency.groupand other required identifier strings4. Add Pattern Validation for Structured Strings
{ "cron": { "type": "string", "pattern": "^(\\S+\\s+){4}\\S+$", "description": "Cron expression with 5 fields (minute hour day month weekday)" } }Note: Consider using a more comprehensive cron validation pattern or runtime validation
Medium Priority (Documentation/UX Impact)
5. Document Mutual Exclusivity
Add to schema descriptions or
$commentfields:branchesandbranches-ignoreare mutually exclusivepathsandpaths-ignoreare mutually exclusivetagsandtags-ignoreare mutually exclusiveConsider conditional validation if JSON Schema supports it, or add runtime validation.
6. Document Logical Conflicts
Add warnings in schema descriptions:
draft: trueis incompatible withtypes: ["ready_for_review"]7. Clarify Optional Fields
Document in schema description for
runs-on.group:labelsfield is required whengroupis specifiedgroupis provided withoutlabelsReal-World Impact Assessment
Production Workflow Analysis
✅ GOOD NEWS: No production workflows use any of the problematic edge cases identified:
timeout-minutes: 0foundtimeout-minutes: -N(negative) foundschedule: [](empty) foundruns-on: [](empty) foundSample from
.github/workflows/*.md:archie.md:timeout-minutes: 10artifacts-summary.md:timeout-minutes: 15audit-workflows.md:timeout-minutes: 30blog-auditor.md:timeout-minutes: 10brave.md:timeout-minutes: 10Risk Level: Low to Medium
Current Risk: Low - No production workflows affected by validation gaps
Future Risk: Medium - New workflows could accidentally use invalid values and fail at runtime instead of compile time
Recommendation: Implement schema improvements to catch issues at design time (IDE validation) rather than runtime
Methodology & Strategy Details
Strategy: Edge Case Compilation Testing
ID: strategy-020
Name: Edge Case Compilation Testing & Boundary Value Analysis
Type: Novel (30% exploration - day 329 mod 10 = 9)
Approach
main_workflow_schema.jsongh-aw compilecommandTools Used
jq: Schema parsing and field extractiongh-aw compile: Actual compilation testing (not simulation)grep: Production workflow analysisTest Coverage Matrix
Legend:
Key Insights
Comparison with Previous Strategies
Strategy-017 Claim Verification
Strategy-017 Claim: "String-to-number type coercion not documented in schema (timeout accepts '300' strings)"
Test 07 (This Analysis):
timeout-minutes: "300"got string, want integerUpdated Understanding:
Unique Contributions of This Strategy
Novel Aspects:
gh-aw compileinstead of static analysisComplements:
Next Steps & Action Items
Immediate Actions
1. Schema Updates (High Priority)
File:
pkg/parser/schemas/main_workflow_schema.jsonminimum: 1, maximum: 2160totimeout-minutesminimum: 1, maximum: 2160totimeout_minutes(legacy field)minItems: 1toschedulearrayminItems: 1toruns-onarray (in oneOf array variant)minLength: 1toconcurrency.groupschedule[].cron2. Documentation Updates
Files:
docs/src/content/docs/reference/frontmatter*.mdbranches/branches-ignorefiltersruns-on.group- whetherlabelsis optional3. Validation Enhancements (Medium Priority)
Consider:
4. Testing Infrastructure
Long-Term Improvements
Schema Validation Framework
Consider implementing:
branchesexists,branches-ignorecannot"Parser Enhancements
Potential improvements:
--strictflag to enable additional checksStrategy Performance
Strategy Used: Edge Case Compilation Testing & Boundary Value Analysis (strategy-020)
Findings: 10 critical validation gaps
Effectiveness: Very High
Should Reuse: Yes
Recommendation: Use every 6-8 analyses to test schema constraint completeness
Unique Value: Only strategy to actually compile workflows with edge cases. Reveals missing schema constraints invisible to static analysis. Verifies claims from previous strategies through empirical testing.
Best Paired With:
Conclusion
The schema validation is strong for documented constraints (type checking, enums, patterns) but missing essential boundary constraints (min/max, minItems, minLength). The good news is that production workflows don't use any problematic edge cases, indicating healthy development practices. However, adding the recommended schema constraints would improve the IDE experience and catch configuration errors at design time rather than runtime.
Priority: Medium - No urgent production issues, but important for preventing future problems and improving developer experience.
Beta Was this translation helpful? Give feedback.
All reactions