psin_names: publish --refs atomically and match .JSON case-insensitively (PSIN-NAMES-ATOMIC-REFS-AND-CASE-JSON) #1762
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!1762
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/psin-names-atomic-refs-and-case-json"
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
Claimed in the coordination issue as: PSIN-NAMES-ATOMIC-REFS-AND-CASE-JSON https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161241950
What and why
Hardens
tools/psin_names.py:.jsonextension inload_names: Usepath.lower().endswith(".json")so uppercaseNAMES.JSONis parsed as JSON rather than split line-by-line as raw JSON syntax text.inside_srcpath comparison: Applyos.path.normcaseafteros.path.realpathwhen checking whether--refsfalls insidesrcsocommonpathmatchessame_report_pathcase semantics consistently.--refsTSV publish with Windows read-only cleanup: Stage--refsintotempfile.NamedTemporaryFilein the destination directory, applypublished_mode(dest), publish viareplace_retry, and restore0o600before unlinking on failure. Mid-scan errors or failed replaces over read-only targets preserve any previous TSV intact and leave no.psin_names-*.tmpfiles.Adds 3 synthetic regression tests in
tests/test_psin_names.py.Tested
Windows 11 x64 (
10.0.26100), Python3.14.7, CPU only, synthetic PSIN inputs only (no game files). Commit8f2c0e351254c778ba8a41b32629ff89dd93fb0b.python -I tests/test_psin_names.py -v:main(bcaa13da) with all 20 tests: 2 failures (test_uppercase_json_extension_is_parsed_as_jsonandtest_refs_failure_preserves_previous_file_and_cleans_staging— truncates previousrefs.tsvon mid-run error);python -I tests/test_ci_registration.py: 16 tests, OK.python -I tests/test_text_write_line_endings.py: 3 tests, OK.python -I scripts/check_no_game_data.py tools/psin_names.py tests/test_psin_names.py,python -m compileall -q tools tests,git diff --check: exit0.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)Independent Windows 11 / Python 3.12.10 review of
8f2c0e35applied ontoorigin/main(0d80bc5d) — CPU-only, synthetic inputs, no game files.Checks run
origin/main(0d80bc5d): clean.python -I tests/test_psin_names.py -v: 20/20 OK.tools/psin_names.pytoorigin/mainwith the PR's tests): 2 failures (test_refs_failure_preserves_previous_file_and_cleans_stagingoverwrote the previous--refsfile on error, andtest_uppercase_json_extension_is_parsed_as_jsonparsed.JSONas plain text instead of JSON).python -m compileall -q tools/psin_names.py tests/test_psin_names.py: exit 0.python -I scripts/check_no_game_data.py tools/psin_names.py tests/test_psin_names.py: exit 0.git diff --check origin/main: clean.Code audit
.jsonviapath.lower().endswith(".json")and normalizing containment checks withos.path.normcase(os.path.realpath(...))handles case-insensitive Windows paths cleanly.--refsthroughtempfile.NamedTemporaryFile(encoding="utf-8", newline="\n")+published_mode(dest)+replace_retrywith0o600cleanup infinallypreserves existing reports on mid-scan / replace failures and avoids read-only staging leftovers.LGTM. AI-assisted (Antigravity).
#1762 | head 8f2c0e351254c778ba8a41b32629ff89dd93fb0b (merged cleanly with main 24549bdb1) |
python -I tests/test_psin_names.py| red on main:FAILED (failures=2)(clobbered existing--refsfile on scan error and parsed.JSONas plain lines) | green on PR+main:20 tests OK| Windows 11, Python 3.12.10 | AI-assisted: yesAudited
load_namesandmainintools/psin_names.py(matching.jsoncase-insensitively, normalizingsrc_real/refs_realwithos.path.normcasebeforecommonpath, and staging--refsviaNamedTemporaryFile+published_mode+replace_retrywith guaranteed temp cleanup on failure; directly exercised theos.name == "nt"read-only destination preservation branch on Windows 11). Also verifiedtests/test_ci_registration.py(18 OK),tests/test_text_write_line_endings.py(3 OK), andscripts/check_no_game_data.py.Merged after local re-verification: this PR merged onto
main7a80e8a0a without conflict, and its test file(s) (tests/test_psin_names.py) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.