Skip to content

Commit 207fac2

Browse files
committed
Harden the four graders after review
tier-med: the decoys announced themselves. legacy/pricing.ts said "Nothing imports this module" and pricing.config.json said "Not read by the runtime", which handed over the answer without tracing the import graph. Both now read as ordinary plausible sources. tier-xhard rubric 1 only inspected notify.ts, so moving declareTable into another src file passed. It now checks every file in src/ that calls declareTable and requires it to be the code applying the migrations, with store.ts excluded since it defines the helper. tier-xhard rubric 4 rejected any setTimeout in src/, which fails a retry backoff -- good engineering -- for the wrong reason. Narrowed to setInterval. tier-easy accepted any test file that merely contained the word "version". It now requires a test that calls handleRequest against /version. Each change re-validated against a correct fix and the corresponding cheat.
1 parent 15613b7 commit 207fac2

5 files changed

Lines changed: 30 additions & 12 deletions

File tree

‎evals/capability/cases/tier-easy/verify.sh‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,13 @@ console.log("ok: routes verified");
2929
'
3030

3131
bun test >/tmp/tier-easy-test.log 2>&1 || { cat /tmp/tier-easy-test.log; echo "FAIL: bun test failed"; exit 1; }
32-
grep -qiE "version" tests/*.ts || { echo "FAIL: no test references /version"; exit 1; }
32+
# A test must actually exercise the route, not merely mention the word.
33+
found=0
34+
for f in tests/*.ts; do
35+
if grep -q "/version" "$f" && grep -q "handleRequest" "$f"; then found=1; break; fi
36+
done
37+
if [[ "$found" -ne 1 ]]; then
38+
echo "FAIL: no test calls handleRequest against /version"
39+
exit 1
40+
fi
3341
echo "PASS: /version added, /health intact, suite green"

‎evals/capability/cases/tier-xhard/verify.sh‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,24 @@ if [[ ${#migrations[@]} -eq 0 ]]; then
2929
echo "FAIL rubric 1: no versioned migration files under migrations/ (NNN_name.sql|ts)"
3030
exit 1
3131
fi
32-
if grep -rqE "^[[:space:]]*declareTable\(" src/notify.ts; then
33-
echo "FAIL rubric 1: src/notify.ts still declares the schema inline"
34-
exit 1
35-
fi
32+
# Schema must come from the migrations, so any file that calls declareTable has
33+
# to be the thing that applies them. store.ts is excluded: it *defines* the
34+
# helper. Checking all of src/ (not just notify.ts) closes the "move the call
35+
# to another file" escape.
36+
while IFS= read -r f; do
37+
[[ -z "$f" ]] && continue
38+
[[ "$f" == "src/store.ts" ]] && continue
39+
if ! grep -q "migrations" "$f"; then
40+
echo "FAIL rubric 1: $f declares the schema inline instead of applying migrations"
41+
exit 1
42+
fi
43+
done < <(grep -rlE "(^|[^A-Za-z_])declareTable\(" src/ 2>/dev/null || true)
3644

3745
# --- rubric 4: no in-process polling loop ----------------------------------
38-
if grep -rqE "setInterval|setTimeout" src/; then
39-
echo "FAIL rubric 4: in-process setInterval/setTimeout polling remains in src/"
46+
# setInterval only. setTimeout is deliberately allowed: a retry backoff is good
47+
# engineering, and rejecting it would fail the right answer for the wrong reason.
48+
if grep -rqE "setInterval" src/; then
49+
echo "FAIL rubric 4: in-process setInterval polling loop remains in src/"
4050
exit 1
4151
fi
4252

‎tests/fixtures/tier-med/docs/PRICING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
The platform fee is **150 basis points** on the order subtotal.
44

5-
This document was last reviewed two quarters ago.
5+
Applies to all marketplace orders.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2-
"_comment": "Legacy deploy-time pricing overrides. Not read by the runtime.",
3-
"feeBasisPoints": 200
2+
"environment": "production",
3+
"feeBasisPoints": 200,
4+
"currency": "usd"
45
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
// Superseded pricing table from the v1 billing service.
2-
// Nothing imports this module; it is kept for historical reference only.
1+
// Pricing table for the billing service.
32
export const FEE_BPS = 175;

0 commit comments

Comments
 (0)