profile: teleo-infrastructure-check
provider: hetzner
target: linux
architecture: arm64
class: beast
ttl: 90m
idleTimeout: 20m
capacity:
  market: spot
  strategy: most-available
  fallback: on-demand-after-120s
actions:
  workflow: .github/workflows/crabbox.yml
  job: hydrate
  runnerLabels:
    - crabbox
  runnerVersion: latest
  ephemeral: true
sync:
  delete: true
  checksum: false
  gitSeed: true
  fingerprint: true
  timeout: 15m
  warnFiles: 50000
  warnBytes: 5368709120
  failFiles: 150000
  failBytes: 21474836480
  exclude:
    - .cache
    - .venv
    - .pytest_cache
    - .ruff_cache
    - __pycache__
    - "*.pyc"
    - "*.db"
    - "*.db-wal"
    - "*.db-shm"
    - "*.log"
    - logs
    - secrets
    - .env
    - htmlcov
    - dist
    - build
    - "*.egg-info"
    - .turbo
    - node_modules
env:
  allow:
    - CI
    - PYTHONWARNINGS
    - PHASE1B_AGENT_ROUTING_ENABLED
ssh:
  user: crabbox
  port: "2222"
  # Ordered fallback ports tried after ssh.port; use [] to disable fallback.
  fallbackPorts:
    - "22"

jobs:
  ci-contract:
    provider: hetzner
    target: linux
    architecture: arm64
    class: beast
    hydrate:
      actions: true
      githubRunner: false
      waitTimeout: 20m
      keepAliveMinutes: 90
    actions:
      workflow: .github/workflows/crabbox.yml
      job: hydrate
    shell: true
    command: >
      python3 -m pip install -e '.[dev]' &&
      mkdir -p .crabbox-results &&
      python3 scripts/check_crabbox_ci_contract.py
      --output .crabbox-results/crabbox-ci-contract.json &&
      python3 scripts/check_llm_refinement_contract.py
      --output .crabbox-results/llm-refinement-contract.json &&
      python3 scripts/replay_decision_engine_eval.py
      --output .crabbox-results/decision-engine-eval.json
    downloads:
      - .crabbox-results/crabbox-ci-contract.json
      - .crabbox-results/llm-refinement-contract.json
      - .crabbox-results/decision-engine-eval.json
    stop: always

  unit:
    provider: hetzner
    target: linux
    architecture: arm64
    class: beast
    hydrate:
      actions: true
      githubRunner: false
      waitTimeout: 20m
      keepAliveMinutes: 90
    actions:
      workflow: .github/workflows/crabbox.yml
      job: hydrate
    shell: true
    command: >
      python3 -m pip install -e '.[dev]' &&
      mkdir -p .crabbox-results &&
      python3 -m pytest --junitxml=.crabbox-results/pytest.xml
    junit:
      - .crabbox-results/pytest.xml
    downloads:
      - .crabbox-results/pytest.xml
    stop: always

  lint-phase1b:
    provider: hetzner
    target: linux
    architecture: arm64
    class: beast
    hydrate:
      actions: true
      githubRunner: false
      waitTimeout: 20m
      keepAliveMinutes: 90
    actions:
      workflow: .github/workflows/crabbox.yml
      job: hydrate
    shell: true
    command: >
      python3 -m pip install -e '.[dev]' &&
      python3 -m ruff check
      lib/agent_routing.py
      lib/config.py
      lib/db.py
      lib/evaluate.py
      lib/llm.py
      lib/post_extract.py
      telegram/approvals.py
      scripts/prove_phase1b_local.py
      tests/test_agent_routing.py
      tests/test_evaluate_agent_routing.py
      tests/test_phase1b_end_to_end.py
      tests/test_eval_parse.py
      tests/test_contributor.py
      tests/test_search.py
    stop: always

  phase1b-local-proof:
    provider: hetzner
    target: linux
    architecture: arm64
    class: beast
    hydrate:
      actions: true
      githubRunner: false
      waitTimeout: 20m
      keepAliveMinutes: 90
    actions:
      workflow: .github/workflows/crabbox.yml
      job: hydrate
    shell: true
    command: >
      python3 -m pip install -e '.[dev]' &&
      scripts/crabbox_phase1b_proof.sh
    junit:
      - .crabbox-results/phase1b-pytest.xml
    downloads:
      - .crabbox-results/crabbox-ci-contract.json
      - proof/phase1b-local-e2e-proof.json
      - .crabbox-results/phase1b-pytest.xml
      - .crabbox-results/phase1b-proof-summary.json
    stop: always

  sync-smoke:
    provider: hetzner
    target: linux
    architecture: arm64
    class: beast
    hydrate:
      actions: false
    shell: true
    command: >
      python3 -m compileall
      lib
      tests
      scripts/prove_phase1b_local.py
    stop: always
