Skip to content

Enhance CI workflow error handling and reporting #77

@unclesp1d3r

Description

@unclesp1d3r

Issue Description

Implement enhanced CI workflow error handling and reporting as specified in Requirement 8 of the CI/CD Pipeline Enhancement epic. Currently, CI workflows provide minimal error context and lack systematic error categorization, making troubleshooting difficult for developers.

Current State Analysis

  • Limited Error Handling: Most workflows rely on GitHub Actions' default error handling
  • No Actionable Messages: Current failures don't use GitHub Actions annotations (::error, ::notice, ::warning)
  • Generic Failure Reports: No specific guidance on how to fix different types of failures
  • Missing Error Categorization: No systematic approach to different failure types (security, formatting, platform-specific)

Requirements (from Requirement 8)

User Story: As a developer, I want clear error reporting so that CI failures are easy to understand and fix.

Acceptance Criteria

  1. WHEN CI jobs fail THEN they SHALL provide clear, actionable error messages using standard GitHub Actions output
  2. WHEN security scans fail THEN they SHALL use standard GitHub Security tab integration for clear reporting
  3. WHEN quality gates fail THEN they SHALL show exactly which files and lines need to be fixed
  4. WHEN platform-specific failures occur THEN the workflow name SHALL clearly indicate which platform failed
  5. WHEN troubleshooting failures THEN error messages SHALL be clear enough to understand without deep GitHub Actions knowledge

Implementation Plan

1. Enhanced Shell Error Handling

Add systematic error handling to all workflow shell steps:

- name: Step with Enhanced Error Handling  
  shell: bash
  run: |
    set -euo pipefail  # Exit on error, undefined vars, pipe failures
    
    # Implement step logic with specific error codes
    if ! just fmt-check; then
      echo "::error title=Code Formatting Violation::Format violations detected"
      echo "::notice::Run 'just fmt' to automatically fix formatting issues"
      exit 2  # Specific exit code for formatting failures
    fi

2. Actionable Error Message Categories

  • Format Violations (exit 2): echo "::error title=Format Violation::Run 'just fmt' to fix"
  • Security Issues (exit 3): echo "::error title=Security Alert::Check Security tab for details"
  • Platform Failures (exit 4): echo "::error title=Platform Failure::Failed on ${{ matrix.os }}"
  • Quality Gates (exit 5): echo "::error title=Quality Gate::Address clippy warnings in specified files"

3. Enhanced Justfile Recipes

Add CI diagnostic recipes with detailed error reporting:

# Enhanced CI check with detailed error reporting
ci-check-verbose:
    #!/usr/bin/env bash
    set -euo pipefail
    echo "🔍 Running comprehensive CI checks with detailed reporting..."
    
    if ! just fmt-check; then
        echo "❌ Format check failed - run 'just fmt' to fix"
        exit 2
    fi
    # Additional checks with specific error codes...

Validation Steps

  1. Error Message Testing: Trigger different types of CI failures and verify proper error annotations
  2. Cross-Platform Testing: Ensure error handling works consistently across Windows, macOS, and Linux
  3. Security Integration: Verify security scan failures properly integrate with GitHub Security tab
  4. Developer Experience: Test that error messages provide clear, actionable guidance

Files to Modify

  • .github/workflows/ci.yml - Add error handling to quality gates
  • .github/workflows/cross-platform.yml - Add platform-specific error reporting
  • .github/workflows/security.yml - Enhance security failure messages
  • justfile - Add diagnostic recipes with proper error handling
  • Documentation - Update troubleshooting guides

DoD (Definition of Done)

  • All 5 acceptance criteria from Requirement 8 implemented
  • GitHub Actions annotations (::error, ::notice, ::warning) used consistently
  • Specific exit codes for different failure categories
  • Cross-platform error handling tested on Windows, macOS, Linux
  • Security scan failures integrate with GitHub Security tab
  • Quality gate failures show specific files/lines to fix
  • Error messages understandable without deep GitHub Actions knowledge
  • CI green on all platforms with enhanced error handling
  • Updated justfile recipes for CI diagnostics

Priority

P0 - Must for v1.0 - Critical for developer experience and CI/CD pipeline reliability.


Epic: #50 - CI/CD Pipeline Enhancement Epic
Requirement: REQ-8 - Clear error reporting for CI failures

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions