rbf0_encode: fail closed on malformed descriptors/nodes/lengths/float overflow and harden CLI (RBF0-ENCODE-FAIL-CLOSED-VALIDATION) #1574
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1574
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/rbf0-encode-fail-closed-validation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Item ID:
RBF0-ENCODE-FAIL-CLOSED-VALIDATION(new item; coordination issue #14 is at GitHub's 2,500-comment cap with no open successor at PR time — confirmed 0 open PRs touchtools/rbf0_encode.py)Summary
index:_Writer.__init__previously assumeddescriptorswas a list of dicts in positional order and indexedd["index"]directly, crashing withAttributeError/KeyErroron malformed edited reports and mis-mapping out-of-order entries. Now malformed descriptors raiseEncodeError("descriptor", ...), explicit indices map byindex(defaulting to position when omitted), and conflicting duplicate indices are refused.float()overflow insidefloat_bits():float(10**400)previously raised an uncaughtOverflowErrorbefore reachingstruct.pack(), bypassingEncodeError("value", ...)and abortingwrite_all().vec3: requirefloat_special(when present) to be a 3-elementlist(previously non-sequences raisedTypeErrorand 3-char strings like"nan"passedlen == 3).string/text: rejectboolvalues forbyte_length/length(previouslyTrue == 1andFalse == 0slipped past equality checks).element: requireattributesandcontentto be lists of dicts, raisingEncodeError("value", ...)instead ofTypeError/AttributeError.write_all()andmain(): accept UTF-8 BOM reports (utf-8-sig) and catchRecursionError, reject empty/whitespace output directories beforeos.makedirs(), catchOSErrorin--check, and don't format boolean refused offsets (True/False) as hex0x1/0x0.Testing
python3 -W error -I tests/test_rbf0_encode.py -v: 41/41 passedpython3 -W error -I tests/test_text_write_line_endings.py -v: 3/3 passedpython3 -I scripts/check_no_game_data.py tools/rbf0_encode.py tests/test_rbf0_encode.py: passedpython3 -m compileall -q make_game.py tools tests: passedmain:tools/rbf0_encode.py: all 4 new tests fail (FAILED (failures=2, errors=5)).Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 19 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)