FWeindel commited on
Commit
bd50cf6
·
verified ·
1 Parent(s): 6b38a14

Restore SWE-Lego historical static repairs and concise release evidence

Browse files
swelego-real-data-verified_environment-reliable/README.md CHANGED
@@ -1,47 +1,48 @@
1
  # SWE-Lego
2
 
3
- The pinned [Prime SWE-Lego release](https://huggingface.co/datasets/PrimeIntellect/SWE-Lego-Real-Data-Verified/tree/8b0d2bed6f04ef571ca04abebf737ea23cbceaf3) contains **4,323 tasks**.
4
 
5
- ## Stage 3: Verifying build
 
6
 
7
- - **4,281 tasks patched:** replaced 4,323 original per-task image definitions with 101 shared cached images and added pinned versions where missing.
8
- - **737 tasks patched:** restored missing build dependencies omitted from the recorded environment, using pinned versions.
9
- - **1 task excluded:** `peopledoc__vault-cli-140`, because its source repository was unavailable and setup failed in all four attempts.
10
 
11
- ## Stage 4: Reference solution reward 1
12
 
13
- **55 tasks patched:**
14
 
15
- - **19:** restored missing Git history, version information or dependencies needed to install packages and run tests.
16
- - **13:** limited parallel test processes to fit the task's allocated resources.
17
- - **6:** increased memory limits after tests ran out of memory.
18
- - **6:** restored a missing exception-checking function in older SymPy tests.
19
- - **5:** adjusted task network settings so tests using simulated or recorded HTTP responses worked correctly.
20
- - **3:** replaced outdated time-conversion tables that caused astronomy tests to fail.
21
- - **1:** used a fixed date during testing so the result no longer depended on the month the test ran.
22
- - **1:** made a test use a CPU allocated to the task instead of assuming CPU 0 was available.
23
- - **1:** preserved the Python import paths needed by the grading runner so tests could start.
24
 
25
- **42 tasks excluded:**
26
 
27
- - **23:** the cluster's network proxy interfered with the tests, so the reference solution could not pass reliably.
28
- - **6:** tests or their libraries expected functions that were missing or had changed in the installed dependency versions.
29
- - **8:** tests depended on external services that were unavailable or unreliable.
30
- - **2:** tests expected exact YAML formatting or warning counts that differed with the installed software versions.
31
- - **1:** an older C parser could not read the newer Linux system headers in our shared image.
32
- - **1:** the required solver licence had expired.
33
- - **1:** verification exceeded the supported memory limit.
34
 
35
- ## Stage 5: No-op reward 0
36
 
37
- **3 tasks patched:**
38
 
39
- - **1:** moved an import into the tests that use it, so missing functionality causes a test failure instead of preventing all tests from starting.
40
- - **1:** tested the Python implementation containing the bug, rather than the alternative implementation that already passed.
41
- - **1:** used a fixed test date so the test still detects the bug after a scheduled data release.
42
 
43
- All three then produced **reference reward 1 and no-op reward 0**.
44
 
45
- - **3 tasks excluded:** `openstates__pyopenstates-15` and `tensorly__tensorly-318` passed their required tests without the reference patch. `tortoise__tortoise-orm-1010` repeatedly failed with a pytest usage error before running tests.
46
 
47
- **Total: 4,277 tasks kept, all patched; 46 excluded.**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # SWE-Lego
2
 
3
+ ## Dataset stats
4
 
5
+ - **[4,323 original tasks](https://huggingface.co/datasets/PrimeIntellect/SWE-Lego-Real-Data-Verified/tree/8b0d2bed6f04ef571ca04abebf737ea23cbceaf3); 4,277 retained, all changed; 46 archived.**
6
+ - **4,323 original build contexts → 101 shared contexts and cached Apptainer image bundles.**
7
 
8
+ ## Dataset characteristics
 
 
9
 
10
+ Real repository issues with source checkouts, regression tests and reference patches.
11
 
12
+ <details><summary>Domains</summary>
13
 
14
+ Software Engineering; Debugging; Scientific Computing; Web & API Tooling.
 
 
 
 
 
 
 
 
15
 
16
+ </details>
17
 
18
+ <details><summary>Capabilities</summary>
 
 
 
 
 
 
19
 
20
+ Exploration; Error Recovery; Specification Adherence; Constraint Satisfaction. Locate faulty code, implement fixes and verify regression behavior.
21
 
22
+ </details>
23
 
24
+ **Likely transfer targets:** SWE-bench Verified; repository debugging in Terminal-Bench 2.0 and TBLite 2.0.
 
 
25
 
26
+ ## Per-stage breakdown
27
 
28
+ Counts below describe retained repairs; repair groups overlap. Results are historical, with the validated instructions restored.
29
 
30
+ - **1, rule-based/static:** 4,277 changed, 0 archived. Restored the timeout/anti-cheating sentence required by `check-instruction-suffix.sh`; no additional recorded automatic path or pip-pin repairs. Existing `/testbed` and setup instructions remain.
31
+ - **3, build/setup:** 4,277 changed, 1 archived. Shared images, pinned dependencies and Apptainer/Marin Harbor bridge compatibility; 736 retained tasks also needed missing build dependencies. Archived 1 unavailable repository.
32
+ - **4, reference reward 1:** 4,277 passed; 55 repaired, 42 archived. Repairs: 19 missing history/metadata/dependencies, 13 worker limits, 6 memory limits, 6 legacy SymPy helpers, 5 mocked/recorded HTTP settings, 3 astronomy time tables, and 1 each for a fixed test date, CPU affinity and Python import paths. Archives: 23 proxy-sensitive tests, 8 unreliable services, 6 dependency mismatches, 2 version-sensitive expectations, and 1 each for system headers, expired licence and excessive memory.
33
+ - **5, no-op reward 0:** 4,277 passed; 3 repaired, 3 archived. Repairs: defer a missing-feature import, test the buggy Python backend, freeze a date-sensitive test. Archived 2 tasks passing without a fix and 1 verifier usage error.
34
+
35
+ [Historical results and per-task reasons](https://huggingface.co/datasets/FWeindel/validated-tasks/blob/65cc78ebebb1201ab7bd4590cd359d55bc57a912/runs/2026-10-11-swelego-real-data-verified-d15f2a1ef8c8.json).
36
+
37
+ ## Resources and timing
38
+
39
+ Image builds: **4 CPUs each**, 98 at **12,288 MiB**, 3 at **8,192 MiB**. Historical validation: Helma `h34-51`; x86_64, Apptainer, Python 3.12.14, Harbor 0.8.1; 32 requested CPUs, measured stage concurrency 32. Marin Harbor validation commit [`7faf878c14b6`](https://github.com/marin-community/harbor/tree/7faf878c14b6d72737579ec936ebf5f74ba3194d). Apptainer version and complete job memory/GPU allocation: **Not recorded**.
40
+
41
+ | Historical validation stage | Stage wall time | Median task time | Timed tasks |
42
+ | --- | ---: | ---: | ---: |
43
+ | 1 | 104.7 s | 0.8 s | 4,281 |
44
+ | 3 | 9,131.6 s | 70.1 s | 4,281 |
45
+ | 4 | 9,280.0 s | 56.5 s | 4,280 |
46
+ | 5 | 9,558.0 s | 52.6 s | 4,280 |
47
+
48
+ Patching time and mean task time: **Not recorded**. Timings describe the historical full run, including tasks subsequently archived.
swelego-real-data-verified_environment-reliable/archive.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:41304f0818876af05cfcf2221f14c55f80d97ba937f1ed6b38a96cc40280cc70
3
- size 4057343
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52655e2fb188a4461b81529a3c5e506d8e7a2c6b064d7214da27438fa816f96a
3
+ size 3795243
swelego-real-data-verified_environment-reliable/assets/historical_release.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Restore only evidence-backed instructions from an immutable historical release."""
2
+ from pathlib import Path, PurePosixPath
3
+ import hashlib
4
+ import io
5
+ import json
6
+ import shutil
7
+ import tarfile
8
+
9
+ import pyarrow as pa
10
+ import pyarrow.parquet as pq
11
+ from validation.contract import files_digest
12
+
13
+
14
+ def files(blob):
15
+ result = {}
16
+ with tarfile.open(fileobj=io.BytesIO(blob), mode='r:*') as archive:
17
+ for member in archive:
18
+ path = PurePosixPath(member.name)
19
+ if path.is_absolute() or '..' in path.parts or not (member.isfile() or member.isdir()):
20
+ raise ValueError('Unsafe historical archive member')
21
+ if member.isfile():
22
+ if str(path) in result:
23
+ raise ValueError('Duplicate historical archive member')
24
+ result[str(path)] = (archive.extractfile(member).read(), member.mode)
25
+ return result
26
+
27
+
28
+ def restore(current, historical, archive, record, dataset, revision, output):
29
+ """Keep current runtime bytes/modes and image locations; restore recorded instructions.
30
+
31
+ Historical archives must differ only in instruction.md. The caller pins and
32
+ verifies historical input files against the stated immutable HF revision.
33
+ """
34
+ import re
35
+ if not re.fullmatch('[0-9a-f]{40}', revision):
36
+ raise ValueError('An immutable historical publication revision is required')
37
+ output = Path(output)
38
+ output.mkdir(parents=True, exist_ok=False)
39
+ run = json.loads(Path(record).read_text())
40
+ provenance = run['patch_provenance'][dataset]
41
+ changes = {x['task_id']: x for x in provenance['tasks']}
42
+ automatic = {x['task_id']: x for x in run['automation_changes'][dataset]['tasks']}
43
+ old = {r['path']: r for b in pq.ParquetFile(historical).iter_batches(batch_size=32) for r in b.to_pylist()}
44
+ source = pq.ParquetFile(current)
45
+ metadata = dict(source.schema_arrow.metadata or {})
46
+ images = json.loads(metadata[b'ot.images.v1']) if b'ot.images.v1' in metadata else None
47
+ audit = []
48
+ rows = []
49
+ for batch in source.iter_batches(batch_size=32):
50
+ for row in batch.to_pylist():
51
+ name = row['path']
52
+ prior = old.pop(name)
53
+ before, after = files(row['task_binary']), files(prior['task_binary'])
54
+ if {k:v for k,v in before.items() if k != 'instruction.md'} != {k:v for k,v in after.items() if k != 'instruction.md'}:
55
+ raise ValueError('Runtime differs from historical evidence: ' + name)
56
+ for payload, values in [(row, before), (prior, after)]:
57
+ if payload['content_sha256'] != files_digest((k,v[0]) for k,v in values.items()):
58
+ raise ValueError('Invalid content digest: ' + name)
59
+ if prior['stages_passed'] != '1,3,4,5' or set(automatic[name]['labels']) != {'anti-cheat-instruction'}:
60
+ raise ValueError('Unreviewed or incomplete historical evidence: ' + name)
61
+ if images:
62
+ if images['tasks'][name]['content_sha256'] != row['content_sha256']:
63
+ raise ValueError('Image task binding mismatch: ' + name)
64
+ images['tasks'][name]['content_sha256'] = prior['content_sha256']
65
+ audit.append({'task_id': name, 'before_content_sha256': row['content_sha256'],
66
+ 'content_sha256': prior['content_sha256'], 'labels': prior['patch_labels'],
67
+ 'path_repair': 'instruction-path-clarified' in changes[name]['labels']})
68
+ for key in ['task_binary', 'content_sha256', 'stages_passed', 'patch_changed', 'patch_labels']:
69
+ row[key] = prior[key]
70
+ row['run'] = f'https://huggingface.co/datasets/FWeindel/validated-tasks/blob/{revision}/runs/{run["run"]}.json'
71
+ rows.append(row)
72
+ if old:
73
+ raise ValueError('Historical/current retained task sets differ')
74
+ summary = {'historical_revision': revision, 'historical_run': run['run'],
75
+ 'retained': len(rows), 'archived': pq.ParquetFile(archive).metadata.num_rows,
76
+ 'changed_retained': len(rows), 'instruction_suffix_restored': len(rows),
77
+ 'instruction_path_repairs_restored': sum(x['path_repair'] for x in audit),
78
+ 'static_archived': 0, 'fresh_runtime_validation': False,
79
+ 'runtime_files_and_modes_identical_to_historical': True,
80
+ 'historical_stages': [1,3,4,5]}
81
+ metadata.pop(b'ot.environment_reliable.v1', None)
82
+ metadata[b'ot.full_release.v1'] = json.dumps(summary).encode()
83
+ if images:
84
+ metadata[b'ot.images.v1'] = json.dumps(images).encode()
85
+ (output/'cached_images').mkdir()
86
+ (output/'cached_images'/'manifest.json').write_text(json.dumps(images, indent=2)+'\n')
87
+ pq.write_table(pa.Table.from_pylist(rows, schema=source.schema_arrow.with_metadata(metadata)), output/'tasks.parquet', compression='zstd')
88
+ archived = pq.read_table(archive)
89
+ if 'run' in archived.column_names:
90
+ index = archived.column_names.index('run')
91
+ archived = archived.set_column(index, archived.schema.field(index), pa.array(
92
+ [f'https://huggingface.co/datasets/FWeindel/validated-tasks/blob/{revision}/runs/{run["run"]}.json'] * archived.num_rows,
93
+ type=archived.schema.field(index).type))
94
+ archive_metadata = dict(archived.schema.metadata or {})
95
+ archive_metadata.pop(b'ot.environment_reliable.v1', None)
96
+ archive_metadata[b'ot.full_release.v1'] = json.dumps(summary).encode()
97
+ pq.write_table(archived.replace_schema_metadata(archive_metadata), output/'archive.parquet', compression='zstd')
98
+ (output.parent/'restoration-audit.json').write_text(json.dumps({'summary':summary, 'tasks':audit}, indent=2)+'\n')
99
+ return summary
swelego-real-data-verified_environment-reliable/cached_images/manifest.json CHANGED
The diff for this file is too large to render. See raw diff
 
swelego-real-data-verified_environment-reliable/patch.py CHANGED
@@ -1340,7 +1340,24 @@ def main():
1340
  parser.add_argument('--publication-revision', help='Immutable HF commit of the validated inputs')
1341
  parser.add_argument('--output', type=Path, required=True)
1342
  parser.add_argument('--metadata', type=Path, help='Pinned upstream recipe JSON; defaults to recipes.json beside source')
 
1343
  args = parser.parse_args()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1344
  if args.validated_tasks:
1345
  if not all((args.validated_archive, args.run_record, args.publication_revision)):
1346
  parser.error('--validated-tasks requires --validated-archive, --run-record and --publication-revision')
 
1340
  parser.add_argument('--publication-revision', help='Immutable HF commit of the validated inputs')
1341
  parser.add_argument('--output', type=Path, required=True)
1342
  parser.add_argument('--metadata', type=Path, help='Pinned upstream recipe JSON; defaults to recipes.json beside source')
1343
+ parser.add_argument('--restore-historical-instructions', type=Path, help='Current release tasks; restore recorded historical instructions and preserve runtime/image bindings')
1344
  args = parser.parse_args()
1345
+ if args.restore_historical_instructions:
1346
+ if not all((args.validated_tasks, args.validated_archive, args.run_record, args.publication_revision)):
1347
+ parser.error('Historical restoration requires validated tasks, archive, run record and immutable publication revision')
1348
+ helper = Path(__file__).resolve().parent / 'assets' / 'historical_release.py'
1349
+ if helper.is_file():
1350
+ import importlib.util
1351
+ spec = importlib.util.spec_from_file_location('historical_release', helper)
1352
+ module = importlib.util.module_from_spec(spec)
1353
+ spec.loader.exec_module(module)
1354
+ restore = module.restore
1355
+ else:
1356
+ from data.utils.historical_release import restore
1357
+ print(json.dumps(restore(args.restore_historical_instructions, args.validated_tasks,
1358
+ args.validated_archive, args.run_record, 'swelego-real-data-verified',
1359
+ args.publication_revision, args.output), indent=2))
1360
+ return
1361
  if args.validated_tasks:
1362
  if not all((args.validated_archive, args.run_record, args.publication_revision)):
1363
  parser.error('--validated-tasks requires --validated-archive, --run-record and --publication-revision')
swelego-real-data-verified_environment-reliable/tasks.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3bae6d1c5e3a35bfe21151358921893f86469ef3e63d8bd575ecdfec2b8a0157
3
- size 59667946
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3becd635a81330af4ee02797e4a27e60584a15df81f98498cfe9c71ba5b70c05
3
+ size 19874210