validateForDispatch method

List<String> validateForDispatch()

Returns dispatch-blocking validation errors.

Implementation

List<String> validateForDispatch() {
  final errors = <String>[];

  if (tracker.kind == null || tracker.kind!.isEmpty) {
    errors.add('tracker.kind is required for dispatch.');
  } else if (!supportedTrackerKinds.contains(tracker.kind)) {
    errors.add('Unsupported tracker.kind: ${tracker.kind}.');
  }

  if (tracker.kind == 'linear') {
    if (tracker.apiKey == null || tracker.apiKey!.isEmpty) {
      errors.add('tracker.api_key or LINEAR_API_KEY is required.');
    }
    if (tracker.projectSlug == null || tracker.projectSlug!.isEmpty) {
      errors.add('tracker.project_slug is required.');
    }
  }

  if (polling.interval.inMilliseconds <= 0) {
    errors.add('polling.interval_ms must be positive.');
  }
  if (hooks.timeout.inMilliseconds <= 0) {
    errors.add('hooks.timeout_ms must be positive.');
  }
  if (!supportedRunners.contains(agent.runner)) {
    errors.add(
      'Unsupported agent.runner: ${agent.runner}. '
      'Only "llm" is implemented ("codex" is reserved).',
    );
  }
  if (agent.maxConcurrentAgents <= 0) {
    errors.add('agent.max_concurrent_agents must be positive.');
  }
  if (agent.maxTurns <= 0) {
    errors.add('agent.max_turns must be positive.');
  }
  if (agent.maxRetryBackoff.inMilliseconds <= 0) {
    errors.add('agent.max_retry_backoff_ms must be positive.');
  }
  if (codex.turnTimeout.inMilliseconds <= 0) {
    errors.add('codex.turn_timeout_ms must be positive.');
  }
  if (codex.readTimeout.inMilliseconds <= 0) {
    errors.add('codex.read_timeout_ms must be positive.');
  }

  return errors;
}