Repository navigation
Conversation
5d81e6f to
402610b
Compare
821829c to
659ab57
Compare
65e29df to
062a16f
Compare
f0359a7 to
baa0279
Compare
|
Two findings from probing this branch locally:
🤖 Generated with Claude Code |
|
Finding 1 is fixed in 26d5f16. When the comparison budget ran out, Finding 2 is still open. 🤖 Generated with Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
numerically_equal converted values to complex, which turns e.g. 99^9999999 into inf without raising, so inf <= 1e-30 * inf graded the response as correct once the comparison budget ran out. Return None when any value is not finite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26d5f16 to
f668b91
Compare
Problem
Stacked on #281. Grading a number that combines the log of a constant with a large power of 10, such as
log(0.1)*(10^8/ pi), ran past the 120 s Lambda timeout. The student got no grade, and the instance was held for the full timeout. This predates the refactor: the old grader stored empty responses for all 4 past submissions of this shape.The cause is SymPy's
simplify(), which callslogcombine. That rewrites-10^8*log(10)/piaslog(10**(-10**8))and builds a 100-million-digit integer. Two places hit it: the "simplified" display inevaluation.py, and the comparison indo_comparison. Parsing is not involved.Changes
app/time_budget.py(new): nested time limits enforced with SIGALRM. They're checked between bytecodes, which interrupts thissimplifypromptly.TimeBudgetExceededis aBaseException, so theexcept Exceptionaround SymPy calls can't swallow it. A limit does nothing off the main thread. The limits are 5 s per comparison and 60 s per request.app/context/symbolic.py: the symbolic attempts incheck_equalityrun under the comparison limit. If they run out of time,=falls back to comparing values to 50 digits.check_order,check_proportionalityand equality equivalence also run under the limit and grade as incorrect if they run out of time.app/context/numerical.py: addsnumerically_equal, andreplace_pimoves to module level. The fallback substitutes exactpi, because floatpiwould add noise at 50 digits.app/evaluation.py:TIME_LIMIT_EXCEEDEDfeedback (app/feedback/symbolic.py).log(0.1)*(10^8/ pi)vs(-1/(100*pi*k))*ln(r)+c900000+10^8* pi* log(100)vs1.47*10**8log(0.1)*(10^8/ pi)vs-10^8*log(10)/pi-10^8/( pi) log(r)vs(-1/(100*pi*k))*ln(r)+cNot covered: the
simplifycalls inapp/context/physical_quantity.py, and the variation code atsymbolic.py:615/620. They're bounded only by the 60 s request limit, not by their own fallbacks.Checklist
symbolic_evaluation_test.py;app/tests/time_budget_test.py.app/docs.md) if user-facing behaviour changed: only the new feedback message is user-facing.Testing
pytest app/tests: 1,223 passed, plus the 1 knowntest_radians_to_frequencyfailure (it also fails on Restructure app: split tests, previews and comparison helpers into modules #281).🤖 Generated with Claude Code