test(benchmarks): add A/B task fixtures with hidden checks

Ten small Python tasks, each failing on the fixture and passing with a
reference solution, including workflow expectations for a small change, a
bugfix, and a delegable change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian lechnerandClaude Opus 5.5 committed 2026-10-01 12:45:40 +02:00
1 parent b8fd66ce3b
commit 3480072ed7
60 files changed
+374

No files matched your search

Whitespace-only changes.
@@ -0,0 +1,26 @@
import os
import tempfile
import unittest
from pathlib import Path
from app.files import read_upload
class Hidden(unittest.TestCase):
def setUp(self):
self.directory = tempfile.TemporaryDirectory()
root = Path(self.directory.name)
(root / 'uploads/sub').mkdir(parents=True)
(root / 'uploads/sub/a.txt').write_bytes(b'ok')
(root / 'secret.txt').write_bytes(b'secret')
self.base = str(root / 'uploads')
def tearDown(self):
self.directory.cleanup()
def test_nested(self):
self.assertEqual(read_upload(self.base, 'sub/a.txt'), b'ok')
def test_traversal(self):
for name in ('../secret.txt', 'sub/../../secret.txt', os.path.join(os.path.dirname(self.base), 'secret.txt')):
with self.subTest(name), self.assertRaises((ValueError, PermissionError, FileNotFoundError)):
read_upload(self.base, name)
Whitespace-only changes.
@@ -0,0 +1,7 @@
import os
def read_upload(base, name):
"""Return the bytes of the uploaded file name below the base directory."""
with open(os.path.join(base, name), "rb") as stream:
return stream.read()
@@ -0,0 +1,6 @@
{
"prompt": "Make read_upload() safe against path traversal. Legitimate names in nested folders must keep working.",
"workflow": {
"kind": "security hardening"
}
}