Repository navigation
Conversation
Companion to grain a-2 (previous commit) — same preserve gate, same
calibration sequence. ai-01 Run-4 forensic (msg-20260716T103228-g8pzpz):
the preserve gate at `provers.py:_reverify_compiles_clean` crashed with
`AttributeError: 'list' object has no attribute 'split'`, exiting the BG
iteration (Run-4 exit 1). Run-5 is gated on this fix.
Root cause: three callers use the pattern
result.get("raw_output", "") or result.get("errors", "")
But `errors` in the verifier result is a **list** of pre-extracted error lines
(`_extract_errors` returns `list[str]`), not a string. When `raw_output` is
empty (build crashed/timeout without captured stdout), the fallback passes a
list to `_parse_lean_errors` / `_count_sorries_from_build_output`, both of
which call `.split("\n")` on the input assuming a string -> AttributeError.
Sites (all share the `or errors` fallback):
- provers.py:_reverify_compiles_clean -> _parse_lean_errors (Run-4 crash)
- tools.py compile() L1189 -> _count_sorries_from_build_output
- tools.py compile() L1255 -> _count_sorries_from_build_output
Fix — defense in depth at the two parsers (corrects all three sites at once
without touching caller logic): coerce list/tuple to a joined string and
short-circuit on empty. The parsers are now type-safe regardless of caller;
the `errors`-as-fallback semantics (see errors even when raw_output is empty)
are preserved.
Verification (firsthand, this machine):
- Standalone replay of the crash input: before, `_parse_lean_errors([...])`
raised AttributeError; after, returns the parsed errors (list coerced).
- pytest: new regression `test_parse_lean_errors_type_safe_on_list_fallback`
PASS; full parser/guard/co crash cohort 9/9 PASS; full file 162/164 (the 2
failures are pre-existing + unrelated — OPENAI_API_KEY env +
STALE_POST_ABSORPTION Voting.lean #4365; same as the a-2 baseline).
- LF clean; +23/-1 in tools.py, +32 in tests.
See #6790, See #1453
Co-Authored-By: Claude <noreply@anthropic.com>
|
Coordination (ai-01) : réduire au delta, ne pas fermer. La coercion |
|
Closing in favor of #6849 (reduced delta). Per ai-01 review: #6846 already landed the |
…t (delta) (#6852) Companion to #6846 (which defended `_parse_lean_errors`). ai-01 review of the superseded #6848: reduce to the delta not already on main. The two build-output parsers (`_parse_lean_errors`, `_count_sorries_from_build_output`) share the same input shape (a `raw_output` string from the verifier result). #6846 made `_parse_lean_errors` type-safe against a list `errors` fallback; this applies the identical coercion to `_count_sorries_from_build_output` so the two parsers' type-contract stays aligned and the helper is robust to any future caller that passes the `or errors` fallback. Honest scoping (firsthand): NO current call-site of `_count_sorries_from_build_output` passes the `or errors` list fallback -- the two `or errors` sites in `compile()` (L1202, L1268) feed `_parse_lean_errors` (already defended by #6846), not this helper. So this is defense-in-depth + API consistency, not a fix for an active crash. The active Run-4 crash (preserve gate) is fully closed by #6846. This delta keeps the sibling parser from regressing the same class of bug if a caller is ever refactored to pass the list fallback here. Verification (firsthand, this machine): - pytest: new regression `test_count_sorries_from_build_output_type_safe_on_list_input` PASS (list coercion, empty -> 0, string path unchanged); full crash-list + parser/guard cohort 16/16 PASS; full file 164/166 (2 pre-existing unrelated failures: OPENAI_API_KEY env + stale STALE_POST_ABSORPTION Voting.lean #4365). - LF clean; +40/-1 (15 in tools.py coercion + 26 test), atomic. Supersedes #6848 (which duplicated the `_parse_lean_errors` coercion now on main via #6846). See #6790, See #1453 Co-authored-by: Claude <noreply@anthropic.com>
Companion to #6845 (grain a-2, MERGED). ai-01 Run-4 forensic (msg-20260716T103228-g8pzpz): the preserve gate at
provers.py:_reverify_compiles_cleancrashed withAttributeError: 'list' object has no attribute 'split', exiting the BG iteration (Run-4 exit 1). Run-5 is gated on this fix.Root cause
Three callers use the pattern:
But
errorsin the verifier result is a list of pre-extracted error lines (_extract_errorsreturnslist[str]), not a string. Whenraw_outputis empty (build crashed/timeout without captured stdout), the fallback passes a list to_parse_lean_errors/_count_sorries_from_build_output, both of which call.split("\n")assuming a string →AttributeError: 'list' object has no attribute 'split'.Sites (all share the
or errorsfallback):provers.py:_reverify_compiles_clean→_parse_lean_errors(Run-4 crash)tools.pycompile() L1189 →_count_sorries_from_build_outputtools.pycompile() L1255 →_count_sorries_from_build_outputFix — defense in depth at the two parsers
Coerce list/tuple to a joined string and short-circuit on empty. This corrects all three call sites at once without touching caller logic. The parsers are now type-safe regardless of caller; the
errors-as-fallback semantics (see errors even whenraw_outputis empty) are preserved.Verification (firsthand, this machine —
myia-po-2026:CoursIA-2)_parse_lean_errors([...])raisedAttributeError; after, returns the parsed errors (list coerced to str). Same for_count_sorries_from_build_output([...]).python3.14 -m pytest tests/test_prover_guards.py):test_parse_lean_errors_type_safe_on_list_fallbackPASS (pins the exact Run-4 gate scenario:{"raw_output": "", "errors": [...]}→rv.get("raw_output","") or rv.get("errors","")→ list passed).Scope
2 files, +54/−1, atomic (single subject: type-safe parsers closing the Run-4 AttributeError crash). Cherry-picked onto
origin/main(post-#6845 merge) — applies clean.See #6790, See #1453
Co-Authored-By: Claude noreply@anthropic.com