Back to Ruflo

GitHub Workflows - Quick Action Plan

v2/docs/workflow-fixes-action-plan.md

3.6.309.2 KB
Original Source

GitHub Workflows - Quick Action Plan

Date: 2025-11-24 Priority: CRITICAL Estimated Time: 30 minutes for critical fixes


๐Ÿšจ Critical Issues Requiring Immediate Action

Issue #1: Duplicate "test" Key in package.json

Impact: ALL tests failing in CI/CD pipeline Location: /workspaces/claude-code-flow/package.json Time to Fix: 5 minutes

Current Problem:

json
{
  "scripts": {
    "test": "NODE_OPTIONS='--experimental-vm-modules' jest --bail --maxWorkers=1 --forceExit",
    // ... other scripts ...
    "test": "tests"  // โ† DUPLICATE! This overwrites the real test command
  }
}

Fix:

  1. Open package.json
  2. Search for "test": "tests"
  3. Delete that line completely
  4. Verify only one "test" key remains in the scripts section

Verification:

bash
# After fix, run:
npm test
# Should execute Jest, not fail with "command not found: tests"

Issue #2: SQLite3 Missing in Integration Tests

Impact: Integration test setup always fails Location: .github/workflows/integration-tests.yml Time to Fix: 10 minutes

Current Problem:

yaml
- name: Create integration test database
  run: |
    sqlite3 ${{ env.INTEGRATION_DB_PATH }} << 'EOF'
    # ... SQL commands ...

Error: sqlite3: command not found

Fix:

Add this step BEFORE "Create integration test database":

yaml
- name: Install SQLite3
  run: |
    sudo apt-get update -qq
    sudo apt-get install -y sqlite3
    sqlite3 --version

Alternative Fix (Better):

yaml
- name: Setup integration test environment
  run: |
    echo "๐Ÿ”ง Setting up integration test environment..."

    # Install SQLite3
    sudo apt-get update -qq
    sudo apt-get install -y sqlite3

    # Verify installation
    if ! command -v sqlite3 &> /dev/null; then
      echo "โŒ SQLite3 installation failed"
      exit 1
    fi

    echo "โœ… SQLite3 installed: $(sqlite3 --version)"

- name: Create integration test database
  run: |
    echo "๐Ÿ—„๏ธ Creating integration test database..."

    DB_PATH="${{ env.INTEGRATION_DB_PATH }}"
    mkdir -p "$(dirname "$DB_PATH")"
    mkdir -p integration-test-data

    # Create database (existing SQL commands)
    sqlite3 "$DB_PATH" <<'SQL'
    -- SQL commands here
SQL

    # Verify creation
    if [ ! -f "$DB_PATH" ]; then
      echo "โŒ Database creation failed"
      exit 1
    fi

    echo "โœ… Database created successfully"

Issue #3: Rollback Manager Validation Too Lenient

Impact: May rollback to broken commits Location: .github/workflows/rollback-manager.yml (Line 260-261) Time to Fix: 15 minutes

Current Problem:

yaml
- name: Test rollback target viability
  run: |
    # ...
    npm ci || true            # โ† Masks failures
    npm run build:ts || echo "โš ๏ธ Build test failed"  # โ† Masks failures

Fix:

yaml
- name: Test rollback target viability
  run: |
    echo "๐Ÿงช Testing rollback target viability..."

    ROLLBACK_TARGET="${{ github.event.inputs.rollback_target || needs.failure-detection.outputs.rollback-target }}"

    # Create temporary branch for testing
    git checkout -b test-rollback-temp "$ROLLBACK_TARGET"

    # STRICT MODE: Exit on any failure
    set -e
    set -o pipefail

    echo "Installing dependencies..."
    npm ci

    echo "Testing TypeScript compilation..."
    npm run build:ts

    echo "Running smoke tests..."
    npm run test:health || true  # This one can be optional

    # Clean up
    git checkout "${{ github.ref_name }}"
    git branch -D test-rollback-temp

    echo "โœ… Rollback target is viable"

๐Ÿ“‹ Implementation Steps

Step 1: Fix package.json (5 minutes)

bash
# 1. Open package.json
code package.json

# 2. Find and remove this line:
#    "test": "tests"
#    (It's likely near the end of the scripts section)

# 3. Save the file

# 4. Test locally:
npm test
# Should see Jest starting, not "command not found: tests"

# 5. Commit:
git add package.json
git commit -m "fix: Remove duplicate test script key in package.json

- Removed duplicate 'test': 'tests' key that was overwriting the Jest test command
- This was causing all CI test runs to fail with 'command not found: tests'
- Fixes CI/CD Pipeline workflow failures"

Step 2: Fix Integration Tests SQLite (10 minutes)

bash
# 1. Open integration tests workflow
code .github/workflows/integration-tests.yml

# 2. Find line ~86 (Create integration test database)

# 3. ADD NEW STEP BEFORE IT:
#    Copy the "Install SQLite3" step from Issue #2 above

# 4. OPTIONAL: Also update the database creation step to include error checking

# 5. Commit:
git add .github/workflows/integration-tests.yml
git commit -m "fix: Add SQLite3 installation to integration test workflow

- Integration test setup was failing due to missing sqlite3 command
- Added apt-get installation of sqlite3 with verification
- Added error checking for database creation
- Fixes Integration Tests workflow failures"

Step 3: Fix Rollback Manager Validation (15 minutes)

bash
# 1. Open rollback manager workflow
code .github/workflows/rollback-manager.yml

# 2. Find line ~249 (Test rollback target viability)

# 3. Replace the entire step with the strict version from Issue #3 above

# 4. Commit:
git add .github/workflows/rollback-manager.yml
git commit -m "fix: Enforce strict validation in rollback target testing

- Removed || true and || echo that masked failures
- Added set -e to exit immediately on errors
- Added proper error propagation
- Prevents rollback to broken commits
- Fixes Rollback Manager workflow failures"

Step 4: Push and Test (5 minutes)

bash
# 1. Push all commits
git push origin claude/align-flow-with-mcp-011CV45c34eF2MawJHUpj9XD

# 2. Monitor workflow runs
gh run watch

# 3. Check individual workflow statuses
gh run list --limit 5

# 4. If failures persist, check logs:
gh run view --log-failed

โœ… Verification Checklist

After implementing fixes:

  • CI/CD Pipeline

    • "Security & Code Quality" job passes
    • "Test Suite" job passes
    • Tests actually run (check logs show Jest output)
    • Coverage report generates
    • "Build & Package" job runs (no longer skipped)
  • Rollback Manager

    • "Pre-Rollback Validation" job passes
    • Build test runs without || true
    • Failures properly propagate and stop the workflow
    • Validation errors are clearly reported
  • Integration Tests

    • "Integration Test Setup" job passes
    • SQLite3 installs successfully
    • Database creates without errors
    • "Agent Coordination Tests" job runs (no longer skipped)
    • Test artifacts upload successfully

๐ŸŽฏ Expected Outcomes

After implementing these 3 critical fixes:

  1. CI/CD Pipeline: Should go from โŒ FAILURE โ†’ โœ… SUCCESS

    • Tests will run
    • Coverage will generate
    • Build will complete
    • All dependent jobs will execute
  2. Rollback Manager: Should go from โŒ FAILURE โ†’ โœ… SUCCESS

    • Validation will be strict
    • Broken commits will be detected
    • Rollback will only proceed for viable targets
  3. Integration Tests: Should go from โŒ FAILURE โ†’ โœ… SUCCESS

    • Setup will complete
    • Database will create
    • All test jobs will run
    • Reports will generate

๐Ÿ” If Issues Persist

CI/CD Still Failing?

bash
# Check if tests run locally
npm test

# Check if there are other test issues
npm run test:ci

# Check build works
npm run build:ts

# Check for TypeScript errors
npm run typecheck

# Check for linting errors
npm run lint

Integration Tests Still Failing?

bash
# Verify SQLite3 is available in CI
# Add this temporary debug step:
- name: Debug SQLite installation
  run: |
    which sqlite3
    sqlite3 --version
    echo "PATH: $PATH"

# Check database path
# Add this debug step:
- name: Debug database creation
  run: |
    echo "DB_PATH: ${{ env.INTEGRATION_DB_PATH }}"
    ls -la "$(dirname "${{ env.INTEGRATION_DB_PATH }}")"
    if [ -f "${{ env.INTEGRATION_DB_PATH }}" ]; then
      echo "Database exists"
      sqlite3 "${{ env.INTEGRATION_DB_PATH }}" "SELECT name FROM sqlite_master WHERE type='table';"
    else
      echo "Database does not exist"
    fi

Rollback Manager Still Failing?

bash
# Check git history
git log --oneline -10

# Test rollback target locally
git checkout HEAD~1
npm ci
npm run build:ts
git checkout -

# Verify package-lock.json is valid
jq empty package-lock.json && echo "Valid JSON" || echo "Invalid JSON"

๐Ÿ“ž Need Help?

If these fixes don't resolve the issues:

  1. Check the detailed analysis report: /workspaces/claude-code-flow/docs/github-workflows-analysis-report.md
  2. Review workflow logs: gh run view <run-id> --log-failed
  3. Check git status: Ensure no uncommitted changes
  4. Verify branch: Make sure you're on the correct branch

๐Ÿ“Š Success Metrics

You'll know the fixes worked when:

  • โœ… CI/CD Pipeline badge shows "passing"
  • โœ… All 3 workflows complete successfully
  • โœ… Test coverage reports generate
  • โœ… No jobs show as "skipped" (except Deploy on non-main branches)
  • โœ… Workflow run time is under 10 minutes total

Total Time Investment: ~30 minutes Expected ROI: All workflows fixed, no more CI failures Risk Level: Low (changes are isolated and well-tested)

Good luck! ๐Ÿš€