Commit Graph

25 Commits

Author SHA1 Message Date
cc5d5e3123 manifest: restore write mode before unlink on replace failure and publish mode (MANIFEST-STAGE-CLEANUP)
Apply published_mode(out) to staged manifest file before atomic replacement,
and restore write permission (0o600) before TemporaryDirectory cleanup in
exception block when replace fails, preventing Windows PermissionError [WinError 5]
and stranded temporary files.

agent: yes
AI-assisted: yes
2026-11-29 18:24:12 +03:00
9541c00907 manifest: hash through one reused buffer, halving peak chunk memory per worker (OLD-4922)
_hash_file() read each 8 MiB chunk with f.read(), which allocates the next
bytes object while the last one is still referenced: two chunks per worker
at the peak. With --jobs N that is 16 MiB times N for hashing alone.

It now fills one memoryview-backed bytearray with readinto(), as
manifest_verifier.sha256_file() already does. Digests, sizes and the
change-during-read checks are unchanged.

Measured on a 320 MiB file: tracemalloc peak 16.0 -> 8.0 MiB.

Tests: a multi-chunk file must hash right with a peak under 1.5 chunks, a
short readinto() must not skip or repeat bytes, and the edit-during-read
case hooks readinto, the call the tool now makes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 21:24:10 -05:00
3e1e6ea119 manifest: take the --out/input guard from report_paths (EGEN-MANIFEST-SHARED-PATH) (#6677)
Squash-merged after diff review of PR #6677
2026-11-23 10:59:34 -06:00
282444cb06 Merge pull request #3042 from tupacfan04 2026-11-22 15:14:19 -05:00
c9db3cfa03 manifest: verify refuses an empty files table for a folder with files
verify printed OK and exited 0 for an empty "files" table even when the folder held files, so make_game.py's package check verified nothing. Reject that case with one ERROR line and exit 2; keep the empty-folder round trip that create writes and the tests rely on.
2026-11-22 13:11:20 -06:00
f4a8990953 Merge pull request #2518 from Narek Shaghoyan 2026-11-22 13:15:52 -05:00
9a16d74719 manifest: preserve literal backslashes in POSIX filenames
In tools/manifest.py walk(), unconditional .replace("\\", "/") collapsed literal backslashes in POSIX filenames into "/", causing distinct files such as sub/a.dat and sub\a.dat to collide in create() and verify() and diverging from manifest_verifier.py (#2235). Normalize only os.sep/os.altsep when distinct from "/", and add a POSIX regression test.
2026-11-22 17:19:48 +00:00
366fcfd555 Merge pull request #2044 from Vonsek 2026-11-22 11:41:10 -05:00
cc497a86c6 fix(manifest): pin verification to the expected file size
A file can resize after the directory scan. Check the expected size again on the handle used for hashing so verification cannot combine a size and digest from different versions of the file.
2026-11-22 16:41:54 +01:00
1472d9e471 Merge pull request #2004 from richardsenra 2026-11-22 10:40:21 -05:00
b1d8b444b6 Merge pull request #1918 from JavierBlanco23 2026-11-22 10:39:26 -05:00
7892238c02 manifest: compare SHA-256 digests without case sensitivity (BUILD-549)
Normalize the expected hex digest before serial or parallel verification. Add synthetic API and CLI regressions for case variants, altered content, missing/size errors and malformed digests. AI-assisted with Codex and an independent Claude review.
2026-11-22 12:25:45 -03:00
f341856425 BUILD-536: reject duplicate JSON keys in manifest.py load_manifest() 2026-11-22 16:03:02 +01:00
00452cfaa3 Merge pull request #1615 from Ewann 2026-11-22 09:48:04 -05:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.

AI-assisted (Claude), on behalf of dev-ewann.
2026-11-22 14:20:30 +00:00
e620def682 Keep manifest size and hash on a stable file read 2026-11-22 17:39:16 +04:00
6e90a2848b manifest, turing_atlas: refuse report paths that replace inputs or are folders
manifest create --out <game>/a.txt hashed the file and then replaced it
with the manifest (exit 0), so the copy no longer matched the manifest it
had just recorded; turing_atlas --out <existing dir> built the atlas and
then died with a PermissionError. Refuse an existing non-manifest target
inside the hashed folder (and hard links to files that will be hashed)
before hashing, and reject a folder for turing_atlas' --out with one line.
2026-11-22 20:31:59 +08:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").

tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:27:00 +00:00
5952dec456 Use Win32 HANDLE types for manifest process priority 2026-11-22 02:56:37 +01:00
a9cc575f8e manifest.py: exclude the manifest from its own inventory 2026-11-22 00:59:52 +01:00
514e11d848 Isolate concurrent manifest writes before atomic replacement 2026-11-21 20:26:04 -03:00
690e6ee702 manifest.py: report a damaged manifest instead of a traceback; create it atomically
verify read the manifest with json.load(...)["files"] and indexed each entry's "size" and "sha256" directly,
and main caught only OSError. A truncated or malformed manifest therefore ended in a JSONDecodeError, KeyError
or TypeError traceback. load_manifest now checks the JSON, the "files" table and every entry, and raises
ManifestError, which main reports as an ERROR line with exit 2 like a missing file.

create wrote the final manifest in place, so an interrupted run left exactly such a truncated file. It now
writes <out>.partial and swaps it in with os.replace, removing the partial file on any failure; the previous
manifest stays as it was.

The shipped game/xbox-1.0.2.1.json still loads (108 entries).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:13 +03:00
6139be94f5 manifest.py: fail when the input directory cannot be scanned 2026-11-21 21:47:05 +01:00
51b79339fb Manifest: hash files with --jobs (parallel create/verify)
Default is half the CPU count; --jobs 1 keeps serial hashing. create rebuilds entries in walk order so the JSON does not depend on completion order, and verify prints problems in manifest order so its output and exit code are identical for every job count. Progress now reports completed file counts from the main thread instead of per-file worker lines.
2026-11-21 17:00:39 +00:00
db0dc8bd5e Initial commit: Leonida, build-it-yourself PC port groundwork
Shader pipeline (carve, FSSM unpack, gfx1013 disassembly, RDNA2 to SPIR-V),
asset export via rpf9-explorer's Core (submodule), PE loader and shim
skeleton, and make_game.py, which builds from the user's own copy of the game.
No game data, keys or executables are included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:22:16 -05:00