Feature: Large project scaling performance baselines
  Validates that benchmark fixtures, threshold definitions, and scaling
  expectations are present and self-consistent for 50K and 100K file
  scales, and that context assembly and execution throughput thresholds
  are defined.

  Background:
    Given a scaling performance test environment is ready

  # ──────────────────────────────────────────────────
  # Section 1: Extended scale profile validation
  # ──────────────────────────────────────────────────

  Scenario: Scale metadata includes xlarge and xxlarge profiles
    When I scaling perf load the scale metadata fixture
    Then the scaling perf metadata should contain profile "xlarge"
    And the scaling perf metadata should contain profile "xxlarge"

  Scenario: XLarge profile has correct file count
    When I scaling perf load the scale metadata fixture
    Then the scaling perf profile "xlarge" should have file count 50000

  Scenario: XXLarge profile has correct file count
    When I scaling perf load the scale metadata fixture
    Then the scaling perf profile "xxlarge" should have file count 100000

  Scenario: New profiles have valid language mixes
    When I scaling perf load the scale metadata fixture
    Then the scaling perf language mix should sum to 1.0 for profile "xlarge"
    And the scaling perf language mix should sum to 1.0 for profile "xxlarge"

  # ──────────────────────────────────────────────────
  # Section 2: Extended threshold validation
  # ──────────────────────────────────────────────────

  Scenario: Indexing thresholds cover 50K and 100K files
    When I scaling perf load the baseline thresholds fixture
    Then the scaling perf indexing thresholds should cover "50000_files"
    And the scaling perf indexing thresholds should cover "100000_files"

  Scenario: Decomposition thresholds cover 50K and 100K files
    When I scaling perf load the baseline thresholds fixture
    Then the scaling perf decomposition thresholds should cover "50000_files"
    And the scaling perf decomposition thresholds should cover "100000_files"

  Scenario: Extended thresholds are monotonically increasing
    When I scaling perf load the baseline thresholds fixture
    Then scaling perf p50 should be less than p95 for "50000_files" indexing
    And scaling perf p95 should be less than p99 for "50000_files" indexing
    And scaling perf p50 should be less than p95 for "100000_files" indexing
    And scaling perf p95 should be less than p99 for "100000_files" indexing

  Scenario: 50K indexing threshold scales sub-linearly from 10K
    When I scaling perf load the baseline thresholds fixture
    Then scaling perf 50K indexing p50 should be less than 5x the 10K p50

  Scenario: 100K indexing threshold scales sub-linearly from 50K
    When I scaling perf load the baseline thresholds fixture
    Then scaling perf 100K indexing p50 should be less than 2.5x the 50K p50

  # ──────────────────────────────────────────────────
  # Section 3: Context assembly thresholds
  # ──────────────────────────────────────────────────

  Scenario: Context assembly thresholds section exists
    When I scaling perf load the baseline thresholds fixture
    Then the scaling perf thresholds should have context assembly section

  Scenario: Context assembly covers 5K and 10K fragments
    When I scaling perf load the baseline thresholds fixture
    Then the scaling perf context assembly thresholds should cover "5000_fragments"
    And the scaling perf context assembly thresholds should cover "10000_fragments"

  # ──────────────────────────────────────────────────
  # Section 4: Execution throughput thresholds
  # ──────────────────────────────────────────────────

  Scenario: Execution throughput thresholds section exists
    When I scaling perf load the baseline thresholds fixture
    Then the scaling perf thresholds should have execution throughput section

  Scenario: Execution throughput covers all plan counts
    When I scaling perf load the baseline thresholds fixture
    Then the scaling perf execution thresholds should cover "10_plans"
    And the scaling perf execution thresholds should cover "50_plans"
    And the scaling perf execution thresholds should cover "100_plans"

  # ──────────────────────────────────────────────────
  # Section 5: Memory thresholds at production scale
  # ──────────────────────────────────────────────────

  Scenario: Memory thresholds cover 50K and 100K files
    When I scaling perf load the baseline thresholds fixture
    Then the scaling perf memory thresholds should cover "50000_files"
    And the scaling perf memory thresholds should cover "100000_files"

  Scenario: Memory peak exceeds steady state for extended profiles
    When I scaling perf load the baseline thresholds fixture
    Then scaling perf memory peak should exceed steady state for "50000_files"
    And scaling perf memory peak should exceed steady state for "100000_files"
