O6: telemetry, orch report, orch eval, orch bench and eval cases (closes #7)
This commit is contained in:
1 parent
bea07e82bb
commit
015561530a
31 files changed
+809
-3
No files matched your search
@@ -0,0 +1,13 @@
|
||||
# Eval cases
|
||||
|
||||
Each directory is one case for `orch bench`:
|
||||
|
||||
- `task.md` - the prompt (first `#` heading = title)
|
||||
- `files/` - the initial repository content (a fresh git repo per run)
|
||||
- `gate.sh` - exit 0 = solved; runs in the worktree after hx
|
||||
- `solution/` - optional overlay that solves the case; only used by `orch bench eval --check`, never shown to the agent
|
||||
|
||||
orch bench eval --check # every case fails untouched and passes with its solution
|
||||
orch bench eval --profile NAME --out a.jsonl # run all cases with a profile
|
||||
orch eval a.jsonl b.jsonl # compare two runs per case, exit 1 on a lower success rate
|
||||
orch report a.jsonl # per profile and hx version
|
||||
@@ -0,0 +1,8 @@
|
||||
from text import slugify, shout
|
||||
|
||||
assert slugify('Hello, World!') == 'hello-world'
|
||||
assert slugify(' a b ') == 'a-b'
|
||||
assert slugify('---') == ''
|
||||
assert slugify('x1_y2') == 'x1-y2'
|
||||
assert shout('a') == 'A!'
|
||||
print('ok')
|
||||
@@ -0,0 +1,2 @@
|
||||
def shout(s):
|
||||
return s.upper() + '!'
|
||||
@@ -0,0 +1 @@
|
||||
python3 test_text.py
|
||||
@@ -0,0 +1,9 @@
|
||||
import re
|
||||
|
||||
|
||||
def shout(s):
|
||||
return s.upper() + '!'
|
||||
|
||||
|
||||
def slugify(s):
|
||||
return re.sub(r'[^a-z0-9]+', '-', s.lower()).strip('-')
|
||||
@@ -0,0 +1,3 @@
|
||||
# Add slugify
|
||||
|
||||
Add a function `slugify(s)` to `text.py`: lowercase, every run of non-alphanumeric characters becomes a single `-`, no leading or trailing `-`. Example: `slugify('Hello, World!')` is `'hello-world'`.
|
||||
@@ -0,0 +1,2 @@
|
||||
def last_n(xs, n):
|
||||
return xs[len(xs) - n + 1:]
|
||||
@@ -0,0 +1,6 @@
|
||||
from lib import last_n
|
||||
|
||||
assert last_n([1, 2, 3, 4], 2) == [3, 4]
|
||||
assert last_n([1, 2, 3], 3) == [1, 2, 3]
|
||||
assert last_n([1], 1) == [1]
|
||||
print('ok')
|
||||
@@ -0,0 +1 @@
|
||||
python3 test_lib.py
|
||||
@@ -0,0 +1,2 @@
|
||||
def last_n(xs, n):
|
||||
return xs[len(xs) - n:]
|
||||
@@ -0,0 +1,3 @@
|
||||
# Fix the off-by-one in last_n
|
||||
|
||||
`last_n(xs, n)` in `lib.py` must return the last n items of the list, but it returns one too few. Fix it. Do not change the tests.
|
||||
@@ -0,0 +1,3 @@
|
||||
# demo
|
||||
|
||||
Instal with pip install demo.
|
||||
@@ -0,0 +1 @@
|
||||
grep -q 'Install with pip install demo.' README.md && ! grep -q 'Instal ' README.md && [ "$(wc -l < README.md)" -eq 3 ]
|
||||
@@ -0,0 +1,3 @@
|
||||
# demo
|
||||
|
||||
Install with pip install demo.
|
||||
@@ -0,0 +1,3 @@
|
||||
# Fix the typo in README
|
||||
|
||||
The README says `Instal with pip`. Fix the spelling of that word and nothing else.
|
||||
@@ -0,0 +1,5 @@
|
||||
from pricing import compute
|
||||
|
||||
|
||||
def checkout(items):
|
||||
return round(compute(items) * 1.2, 2)
|
||||
@@ -0,0 +1,2 @@
|
||||
def compute(items):
|
||||
return sum(i['price'] * i['qty'] for i in items)
|
||||
@@ -0,0 +1,4 @@
|
||||
from cart import checkout
|
||||
|
||||
assert checkout([{'price': 10, 'qty': 2}]) == 24.0
|
||||
print('ok')
|
||||
@@ -0,0 +1 @@
|
||||
! grep -rq 'compute' --include=*.py . && grep -q 'def total_price' pricing.py && python3 test_cart.py
|
||||
@@ -0,0 +1,5 @@
|
||||
from pricing import total_price
|
||||
|
||||
|
||||
def checkout(items):
|
||||
return round(total_price(items) * 1.2, 2)
|
||||
@@ -0,0 +1,2 @@
|
||||
def total_price(items):
|
||||
return sum(i['price'] * i['qty'] for i in items)
|
||||
@@ -0,0 +1,3 @@
|
||||
# Rename compute to total_price
|
||||
|
||||
Rename the function `compute` to `total_price` everywhere (definition and all callers, in every file). Behaviour must not change.
|
||||
Reference in new issue
Block a user