Spaces:
Sleeping

p4r5kpftnp-cmd Claude Sonnet 4.6 commited on
Commit
b42c3ef
·
1 Parent(s): cb30699

Fix 4 bugs found by stress-test agents + add fuzz/concurrent test suites

Browse files

Bugs fixed:
- src/lmm_client.py: chat() crashed with IndexError when Groq returned
empty choices (content filter / quota). Now returns "" gracefully.
- src/lean_verifier.py: verify_proof("") crashed with pydantic
ValidationError (Command requires min_length=1). Now returns a clean
failure result.
- src/lean_verifier.py: LeanServer.run exceptions propagated up, killing
the agent retry loop on transient disconnects. Now caught and surfaced
as "Lean server error: <msg>" inside the failure result.
- app.py: tempfile and open() use platform default encoding, which can
blow up on non-UTF-8 locales for Lean source containing ∀ ℕ ∃ etc.
Forced UTF-8 on both ends.

Tests added (all using stdlib unittest + mocks, no Lean/Groq needed):
- tests/test_app_fuzz.py — 11 fuzz cases for app.solve_proof (empty,
whitespace, 100KB input, unicode, missing GROQ_API_KEY, agent raising,
temp-file cleanup, etc.)
- tests/test_concurrent_solve.py — 4 stress cases for concurrent
invocations; verifies no stdout cross-contamination, unique tmp paths,
isolated failures. Patches app.LangGraphAgent per-test so test files
don't fight over the sys.modules mock.

Full suite: 18/18 passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

5 files changed +407 -6
Files changed (5)
app.py+12-2
src/lean_verifier.py+23-3
src/lmm_client.py+8-1
tests/test_app_fuzz.pyAdded+357
tests/test_concurrent_solve.py+7