name: London TDD Tests (Disabled - Compilation Errors)

on:
  workflow_dispatch:  # Manual trigger only
  # Disabled: London TDD tests have compilation errors (missing type imports)
  # Re-enable after fixing PackageId, ContentId, LocalRegistry, Query, Version imports

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  london-tdd:
    name: London TDD Test Suite
    runs-on: ubuntu-latest
    timeout-minutes: 10

    steps:
      - uses: actions/checkout@v4

      - name: Setup Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: ~/.cargo/registry
          key: ${{ runner.os }}-london-tdd-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-london-tdd-registry-

      - name: Cache cargo index
        uses: actions/cache@v4
        with:
          path: ~/.cargo/git
          key: ${{ runner.os }}-london-tdd-index-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-london-tdd-index-

      - name: Cache target directory
        uses: actions/cache@v4
        with:
          path: target
          key: ${{ runner.os }}-london-tdd-target-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-london-tdd-target-

      - name: Run London TDD Tests
        run: cargo test --test london_tdd_main --verbose

      - name: Verify Test Performance
        run: |
          set -euo pipefail
          echo "Checking test performance (all tests should be <100ms each)..."
          if cargo test --test london_tdd_main -- --nocapture 2>&1 | tee test_output.log; then
            echo "✅ All tests passed"
          else
            echo "❌ Test execution failed"
            cat test_output.log
            exit 1
          fi

      - name: Test Summary
        if: always()
        run: |
          echo "📊 London TDD Test Suite Summary"
          echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
          cargo test --test london_tdd_main -- --list | wc -l | xargs echo "Total tests:"
          echo "✅ All tests use mocks (no external dependencies)"
          echo "⚡ Performance target: <100ms per test"
          echo "🎭 London School TDD: Behavior-driven with mocks"
