File size: 4,547 Bytes
f13d613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
from __future__ import annotations

from env.tasks.task_types import CICDTask


HARD_TASKS: list[CICDTask] = [
    CICDTask(
        task_id="hard-matrix-logic",
        title="Fix matrix include-exclude logic",
        description="Matrix includes unsupported versions and causes deterministic CI breakage.",
        difficulty="hard",
        failure_stage="test",
        broken_config="""
name: CI
on: [push]
jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
        python-version: ["3.10", "3.11", "3.13"]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - run: pip install -r requirements.txt
      - run: pytest -q
""".strip(),
        expected_config="""
name: CI
on: [push]
jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
        python-version: ["3.10", "3.11", "3.13"]
        exclude:
          - os: windows-latest
            python-version: "3.13"
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - run: pip install -r requirements.txt
      - run: pytest -q
""".strip(),
        logs="test stage failed: wheel build unavailable for windows-latest + python 3.13",
        error_message="matrix includes unsupported runtime combination",
        actual_bug="matrix logic is missing an exclude for unstable runtime pair",
        metadata={"broken_token": "python-version: [\"3.10\", \"3.11\", \"3.13\"]", "fixed_token": "exclude:"},
    ),
    CICDTask(
        task_id="hard-conditional-deploy",
        title="Repair deploy conditional",
        description="Deploy job runs regardless of failed tests due to always() condition.",
        difficulty="hard",
        failure_stage="deploy",
        broken_config="""
name: CI
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm run build
  test:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: actions/checkout@v4
      - run: npm test
  deploy:
    runs-on: ubuntu-latest
    needs: test
    if: always()
    steps:
      - run: echo deploying
""".strip(),
        expected_config="""
name: CI
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm run build
  test:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: actions/checkout@v4
      - run: npm test
  deploy:
    runs-on: ubuntu-latest
    needs: test
    if: success() && github.ref == 'refs/heads/main'
    steps:
      - run: echo deploying
""".strip(),
        logs="deploy stage triggered despite failing tests on non-main branch",
        error_message="unsafe deploy condition bypasses quality gates",
        actual_bug="deploy condition uses always() instead of guarded success check",
        metadata={"broken_token": "if: always()", "fixed_token": "if: success() && github.ref == 'refs/heads/main'"},
    ),
    CICDTask(
        task_id="hard-needs-order",
        title="Fix job dependency ordering",
        description="Deploy depends only on build and can run before tests complete.",
        difficulty="hard",
        failure_stage="deploy",
        broken_config="""
name: CI
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
  test:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: actions/checkout@v4
      - run: npm test
  deploy:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - run: echo deploying package
""".strip(),
        expected_config="""
name: CI
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
  test:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: actions/checkout@v4
      - run: npm test
  deploy:
    runs-on: ubuntu-latest
    needs: [build, test]
    steps:
      - run: echo deploying package
""".strip(),
        logs="deploy stage started before tests finished, causing regression release",
        error_message="deploy dependency graph skips mandatory test gate",
        actual_bug="deploy job does not depend on test job",
        metadata={"broken_token": "needs: build", "fixed_token": "needs: [build, test]"},
    ),
]