Commit Graph

20 Commits

Author SHA1 Message Date
044d410cd3 world_census: restore write mode before temporary directory cleanup in _staged_json (WORLD-CENSUS-STAGE-CLEANUP)
When staging JSON output in _staged_json, if the destination had read-only
permissions, the staged file received mode 0o444. If publishing fails or
raises an exception, resetting os.chmod to 0o600 in finally ensures
TemporaryDirectory cleanup does not fail with PermissionError on Windows.

agent: yes
AI-assisted: yes
2026-11-24 17:24:13 +03:00
bc5ff429d4 world_census: reject a resume-cache shard whose rows are not well-typed
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 20:51:09 +01:00
40063162df world_census: guard --out with the shared report_paths helper (#5917)
Squash-merged after review of PR #5917 - world_census: guard --out with the shared report_paths helper
2026-11-23 08:08:04 -06:00
85cd076302 world_census: an archive shorter than the 8-byte RPF9 header is not an RPF9 archive (exit 2), not a struct.error traceback 2026-11-23 03:34:25 +00:00
77f8e140c5 world_census: do not carry raw_pages candidates across compressed streams 2026-11-22 16:48:27 -03:00
f4d0f92c10 world_census: fix gap-audit chunk boundaries, pre-raw audits, and straddling segments 2026-11-22 14:18:40 -03: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
cf0717e2f8 Merge pull request #1477 from pushkarreddyy 2026-11-22 07:07:49 -05:00
398daeae8f world_census: refuse output paths that overwrite archives or point to files 2026-11-22 17:08:54 +05:30
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
9874e9d2ba world_census: invalidate pre-fix warm-up shard totals 2026-11-22 15:48:38 +10:00
e3a792c5e2 world_census: don't count the warm-up window's streams a second time
Each shard starts scanning WARMUP (8 MiB) before its start to land on a real stream boundary. The
streams it found there belong to the previous shard, but scan_shard added their streams, stored,
inflated and rejected counts anyway; only metadata streams were caught by the later `s < start`
check, which is what the "adopted" counter counted. So every total except the map rows grew with
the number of shards.

On a 1.0.2.1 copy, data.rpf gave 28,509 streams with one shard (rpf9_carve's count), 42,293 with
--shard-size 16 MiB and 51,831 with 10,000,019 bytes, with identical map rows. With this change
all three give 28,509 streams, 423,279,355 stored and 1,403,250,069 inflated bytes and 638
rejected candidates (1, 29 and 49 shards).

A warm-up stream now only moves the scan past its bytes. The adopted counter, which only ever
measured the double count, is gone.

test_world_census: test_tiny_shards_give_the_same_stream_totals compares every total of a
one-shard run with 400-byte shards (the existing tiny-shard test only checked maps, entities and
interval coverage, which a union hides). It fails on the old code (inflated 39,312 vs 7,504).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit eb96a79ceb86a56cbc9a654ad7b2d04df1da27a4)
2026-11-22 00:33:52 -05:00
4547af3cec Restore census reports when publication fails 2026-11-21 19:14:49 -07:00
e876dd2dba Bind world census shards to their source archive 2026-11-21 18:22:43 -07:00
a409452f03 Merge pull request #569 from bbareth 2026-11-21 20:09:24 -05:00
eafa5731d3 world_census.py: --limit 0 is an empty range, and a bad archive path is one line
`end = min(size, start + a.limit) if a.limit else size` treated
--limit 0 as no limit, so asking for zero bytes scanned the whole
archive (a full census of a multi-GiB archive) and wrote its outputs.
It is now an empty range and refused as "bad scan range", like
--limit -1. A missing archive, or a folder given as one, ended in a
FileNotFoundError / IsADirectoryError traceback; it is now one line
naming the path, exit 2, before --out is created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:49:58 +01:00
24bfb65867 Follow up three review points on merged PRs (#326, #308, #292)
- ci.yml: cancel only superseded pull request runs; a push to main was
  cancelled by the next merge and left that commit without a CI result
  (#326 review).
- world_census.py: --jobs above 61 is rejected with an argparse error on
  Windows instead of ProcessPoolExecutor's ValueError traceback, with a
  test next to the below-1 test (#308 review).
- docs/textures.md: drop the duplicated "The BCPack counts above..."
  paragraph (#292 review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:37:20 +00:00
40a7edaef3 world_census: reject --shard-size and --jobs below 1
--shard-size 0 (or a negative size) never finished planning shards: pos
never advanced, so the list grew until memory ran out. --jobs 0 crashed
with a ValueError traceback from ProcessPoolExecutor.

Both flags now take a positive_int, so argparse exits 2 with "must be at
least 1". _expected_shards also raises ValueError for a size below 1, for
callers that skip the CLI.

Tests: the CLI cases run in a subprocess with a timeout, and the planner
case counts additions, so a regression fails instead of hanging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:38:00 +03:00
ded3576dad Tools: separate placement maps from CMapData-only metadata in the census 2026-11-21 21:32:11 +00:00
c5aeb1526c Tools: census every map resource in levels.rpf 2026-11-21 21:06:18 +00:00