mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #2257] scripts/vs_layout_census: support BOM index, validate limit/paths, write --json atomically #2262
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#2262
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/2257
Author: @kirigayakazima
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/vs-layout-census-safety📝 Commits (1)
8755879Harden vs_layout_census BOM/limit validation and atomic --json writes📊 Changes
2 files changed (+111 additions, -7 deletions)
View changed files
📝
scripts/vs_layout_census.py(+43 -7)📝
tests/test_vs_layout_census.py(+68 -0)📄 Description
Claimed in the coordination issue as: VS-LAYOUT-CENSUS-BOM-LIMIT-AND-ATOMIC-JSON-SAFETY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7189748056)
What and why
<dxbc>/index.jsonwithencoding="utf-8-sig"and convertRecursionErrorfromjson.load()intoValueErroracrossload_index(),input_paths(), andmain()(scripts/vs_layout_census.py) so single-line error reporting holds without tracebacks.limit/--limit(< 1) insurvey()andmain()as well as trailing-separator--jsondirectory paths (/or\) before callingsurvey().--jsonoutput atomically via_write_json_atomic()(creating missing parent directories cleanly, writing trailing LF\n, fsyncing, preserving permissions withpublished_mode(), publishing viareplace_retry.replace(), and cleaning.vs-layout-*.tmpfiles on failure).tests/test_vs_layout_census.pycovering UTF-8 BOM index parsing,RecursionErrorCLI handling,--limitvalidation, trailing-separator--jsonrefusal, and atomic JSON write/failure rollback.Tested
python -I tests/test_vs_layout_census.py -v->Ran 19 tests in 0.629s(OK).upstream/maina73a57e1with updatedtests/test_vs_layout_census.pycopied into detached worktree):Ran 19 tests in 0.690s(FAILED (failures=5, errors=1)).python -I tests/test_ci_registration.py(Ran 16 tests in 5.365s,OK),python -I tests/test_text_write_line_endings.py(Ran 3 tests in 13.271s,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 (synthetic containers/listings and atomic JSON output tests)
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.