Test
687bdb21e0
feat(routing): implement WorkflowSpec validator
Task 1.4 COMPLETE ✅
Comprehensive validation system for workflow specifications:
- validator.go: Main validator with methods:
- NewValidator(kb) - Create validator with knowledge base
- ValidateWorkflowSpec(spec) - Validate one-time workflows
- ValidateCronWorkflowSpec(spec) - Validate scheduled workflows
- validateState(state, path) - Validate individual states
- validateDuration(dur) - Validate Go duration strings
- validator_cron.go: Cron expression validation:
- validateCronExpression(expr) - 5-field cron validation
- validateCronField(field, min, max, name) - Individual field validation
- Supports: wildcards (*), ranges (0-59), steps (*/5), lists (0,15,30,45)
- validator_test.go: 30 comprehensive tests
- Valid/invalid workflow specs
- State name validation (duplicates, missing)
- State transitions (Next field references)
- Catch clause validation
- Task state validation (activity exists in KB)
- Pass/Fail state validation
- Timeout format validation
- Cron workflow validation
- Timezone validation
- Cron expression validation
- All tests PASS ✅ (39/39 total in routing package)
Acceptance criteria met:
✅ Detects invalid workflow specs
✅ Validates state references and transitions
✅ Checks activities exist in knowledge base
✅ Validates timeout durations
✅ Validates cron expressions
✅ Validates timezones
✅ All validation tests pass
✅ Ready for Phase 2 (llm-router)
Effort: 3 hours (estimated)
Files: validator.go (281 lines)
validator_cron.go (50 lines)
validator_test.go (367 lines)
Phase 1 COMPLETE ✅
- Task 1.1: Types ✅
- Task 1.2: Knowledge Base ✅
- Task 1.3: KB Loader ✅
- Task 1.4: Validator ✅
Total Phase 1 Effort: 10 hours (on track with 8-10 estimate)
2026-08-31 19:29:25 -07:00
..
2026-08-23 18:02:39 -07:00
2026-08-23 17:49:43 -07:00
2026-08-23 17:48:15 -07:00
2026-08-23 17:23:35 -07:00
2026-08-23 16:49:25 -07:00
2026-08-23 17:15:10 -07:00
2026-08-23 18:02:39 -07:00
2026-08-23 17:48:15 -07:00
2026-08-21 21:57:01 -07:00
2026-08-23 18:01:18 -07:00
2026-08-23 18:01:18 -07:00
2026-08-23 18:02:39 -07:00
2026-08-23 17:17:51 -07:00
2026-08-23 17:48:15 -07:00
2026-08-23 17:32:55 -07:00
2026-08-23 16:33:49 -07:00
2026-08-23 17:24:46 -07:00
2026-08-23 17:21:23 -07:00
2026-08-23 17:48:15 -07:00
2026-08-21 15:58:46 -07:00
2026-08-23 17:25:52 -07:00
2026-08-23 16:33:49 -07:00
2026-08-29 21:49:24 -07:00
2026-08-23 16:33:49 -07:00
2026-08-23 17:11:56 -07:00
2026-08-23 17:30:05 -07:00
2026-08-23 18:02:39 -07:00
2026-08-23 16:43:30 -07:00
2026-08-31 19:29:25 -07:00
2026-08-23 18:01:18 -07:00
2026-08-23 17:31:37 -07:00
2026-08-23 16:47:31 -07:00
2026-08-23 18:01:18 -07:00