mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #1859] tools/cf_diff: validate CLI args, isolate SPIRV_VAL state, and enforce UTF-8 subprocess decoding #1872
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1872
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1859
Author: @kirigayakazima
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/cf-diff-safety📝 Commits (1)
7fd52faHarden cf_diff CLI validation, SPIRV_VAL state isolation, and utf-8 encoding📊 Changes
2 files changed (+154 additions, -44 deletions)
View changed files
➕
tests/test_cf_diff_cli.py(+100 -0)📝
tools/cf_diff.py(+54 -44)📄 Description
Claimed in the coordination issue as: CF-DIFF-CLI-VALIDATION-STATE-ISOLATION-AND-ENCODING (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163606026)
What and why
--minimizewithout--program, negative--program, and negative--depthviaap.error(...)intools/cf_diff.py:main().--spirv-valtool errors (spirv-as/spirv-val) tosys.stderrinstead ofstdout, returning2before mutating module-globalSPIRV_VAL.SPIRV_VALupdates insidetry ... finally: SPIRV_VAL = prev_spirv_valinmain()so in-process callers cannot leakSPIRV_VAL = Trueafter normal return or exceptions.encoding="utf-8", errors="replace"tosubprocess.runin_spirv_val()to avoid platform code-page decode failures on tool output.unittestCLI and encoding regression coverage intests/test_cf_diff_cli.py.Tested
python -I tests/test_cf_diff_cli.py -v->Ran 4 tests in 0.007s(OK).upstream/main98c2f777withtests/test_cf_diff_cli.pycopied into detached worktree):Ran 4 tests in 10.120s(FAILED (failures=6)across all subtests and cases).python -I tests/test_ci_registration.py(Ran 16 tests in 5.521s,OK),python -I tests/test_text_write_line_endings.py(Ran 3 tests in 13.010s,OK),python -I scripts/check_no_game_data.py(exit 0),python -I -m compileall -q(exit 0),git diff --check(exit 0).GPUs tested: n/a (CLI validation, state isolation, and mocked subprocess unittest suite)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.