File size: 3,923 Bytes
ae94737
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from __future__ import annotations

from env.tasks.task_types import CICDTask


MEDIUM_TASKS: list[CICDTask] = [
    CICDTask(
        task_id="medium-python-version",
        title="Align Python version",
        description="Tests require Python 3.11 but workflow pins an older version.",
        difficulty="medium",
        failure_stage="build",
        broken_config="""
name: CI
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.8"
      - run: pip install -r requirements.txt
      - run: pytest -q
""".strip(),
        expected_config="""
name: CI
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - run: pip install -r requirements.txt
      - run: pytest -q
""".strip(),
        logs="build failed: package requires python>=3.11",
        error_message="python interpreter version mismatch",
        actual_bug="workflow pins python-version 3.8 while project requires 3.11",
        metadata={"broken_token": 'python-version: "3.8"', "fixed_token": 'python-version: "3.11"'},
    ),
    CICDTask(
        task_id="medium-cache-key",
        title="Fix cache invalidation key",
        description="Dependency cache key ignores lockfile hash and restores stale dependencies.",
        difficulty="medium",
        failure_stage="test",
        broken_config="""
name: CI
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - uses: actions/cache@v4
        with:
          path: ~/.npm
          key: node-modules-${{ runner.os }}
      - run: npm ci
      - run: npm test
""".strip(),
        expected_config="""
name: CI
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - uses: actions/cache@v4
        with:
          path: ~/.npm
          key: node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
      - run: npm ci
      - run: npm test
""".strip(),
        logs="test failed: stale cache restored old dependency tree",
        error_message="cache key misses lockfile fingerprint",
        actual_bug="cache key is too broad and never invalidates on dependency changes",
        metadata={"broken_token": "key: node-modules-${{ runner.os }}", "fixed_token": "hashFiles('**/package-lock.json')"},
    ),
    CICDTask(
        task_id="medium-artifact-permissions",
        title="Repair artifact permissions",
        description="Artifact upload fails due to insufficient token permissions.",
        difficulty="medium",
        failure_stage="deploy",
        broken_config="""
name: CI
on: [push]
permissions:
  contents: read
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm run build
      - uses: actions/upload-artifact@v4
        with:
          name: web-build
          path: dist/
""".strip(),
        expected_config="""
name: CI
on: [push]
permissions:
  contents: read
  actions: write
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm run build
      - uses: actions/upload-artifact@v4
        with:
          name: web-build
          path: dist/
""".strip(),
        logs="deploy stage failed: Resource not accessible by integration",
        error_message="insufficient permissions for upload-artifact",
        actual_bug="actions:write permission missing from workflow permissions",
        metadata={"broken_token": "permissions:\n  contents: read", "fixed_token": "actions: write"},
    ),
]