Repository navigation
Conversation
|
Tested
AI-assisted. No game files. |
x2Tweek
left a comment
There was a problem hiding this comment.
Second check on PR #5274 — world_interior_names: protect directory inputs from external report aliases.
Verified on Windows (no GPU, no game data):
python -m unittest tests.test_world_interior_names tests.test_world_interior_report_paths— 21 passedpython -m compileall -q— clean on the touched tools modulesgit diff --check— clean
The change closes the outside-hard-link case left by #4690:
- Before scanning, it refuses
--outnaming any input (archive or names JSON),--outnaming a folder, and--outinside a scanned directory. - For directory input with an existing file output, it stat-compares the output against every directory member (one stat per member) and exits 2 on an alias — the hard-link case the parent-chain guard missed.
- Invalid
--start/--limitwindows and unreadable inventories are refused before any work or write. - Fresh reports and independent existing reports still pass.
Tests cover flat and nested external hard links, identical-bytes reports allowed, failed-directory-check preserving prior reports, and new reports in new parents allowed.
AI-assisted (Codex). Synthetic inputs only; no GPU/driver or game files used. Tested on current main 3faac557, Windows/Python 3.14.
🤖 Generated with Claude Code
|
Tested 6ab0223 on Linux, Python 3.13 (CPU only, no GPU, no game files): pass Ran
Read
AI-assisted (Claude Code). |
|
Tested
|
|
Addressed King1565's review in The real dangling-symlink CLI cases (flat/nested targets) reproduce exit 0 on Five new synthetic methods cover external symlinks to existing inputs, scanned symlinks to outside resources, inward/outward dangling links, and allowed links between outside paths. Linux: all 40 focused/registration/LF tests pass. Windows: 35 pass / 5 symlink-method skips (WinError 1314); original hard-link cases pass. Compile, no-game-data and whitespace checks are clean. The PR description now reflects the final scope and validation. Thanks for the additional case. AI-assisted (Codex). |
Kam471
left a comment
There was a problem hiding this comment.
Reviewed 6ab0223; the new change is 0886c58 (the rest is the #4690 prerequisite). For directory input with an existing --out, it now stats the output and every WI._directory_files member and refuses with exit 2 before scanning if any is the same file (hard link or alias); a failed inventory also refuses before scanning/writing.
Tested on Windows 11, Python 3.13.15:
python -I -m pytest tests/test_world_interior_report_paths.py tests/test_world_interior_names.py tests/test_ci_registration.py tests/test_text_write_line_endings.py -q-> 35 passed, 9 subtests.python -I tests/test_world_interior_report_paths.py-> Ran 5 tests, OK.git diff --check-> clean.
The new suite covers flat and nested external hard links (exit 2, stderr names the source, input bytes unchanged), refusal before scan, and an unreadable inventory; fresh reports and an independent existing report with identical bytes are allowed.
Verdict: correct; no blockers. Stacked on #4690 (its commits are in this diff) and complements #4748.
|
Re-tested 26f35e4 on Linux, Python 3.13 (CPU only, no game files): pass
AI-assisted (Claude Code). Generated by Claude Code |
|
Reviewed 26f35e4 (Windows 11, CPU-only): pass - approve-able.
One follow-up observation, not a blocker: there is a TOCTOU window between the checks and AI-assisted. |
26f35e4 to
100de60
Compare
|
Rebased onto current main The four focused suites run 73 tests: native Windows 67 passed / 6 platform/permission skips; Ubuntu/WSL 73 passed with real symlinks. The guard errors now return 2 consistently with main, and the before-scan tests check that convention. The unchanged-main negative control still fails the real hard-link CLI cases. Compile, whitespace and no-game-data checks pass. AI-assisted (Codex); synthetic CPU tests only. |
|
Windows / Python 3.15 verification at 100de60 in an isolated worktree:
The focused alias cases passed. Windows symlink coverage is limited by the five skipped cases in the focused suite. Synthetic CPU inputs, no GPU/game files. AI-assisted (Codex). |
|
Tested 100de60 on Linux (WSL, ext4), Python 3.13: pass. Ran: Code read: AI-assisted review (Claude Code). |
An
--outname outside a scanned directory can still be a hard link to one of its members, or a dangling symlink whose target is a new file inside it. Without these checks the CLI overwrites the linked resource or creates a report among its inputs and exits 0. Refuse these cases with exit 2 before scanning or writing.For existing outputs, compare the report's file identity against the directory inventory and refuse an incomplete/unreadable inventory. For containment, check both the resolved leaf and the resolved parent directory, so inward targets and inward names with outward dangling targets are protected. Legitimate independent/outside reports remain allowed.
Claim: directory report alias guard. Credit to memorypressure for identifying the directory-member hard-link gap, and King1565 for the symlink coverage/dangling-target finding.
Rebased onto main
e6190e7b5at100de6026. The current diff contains only the directory guards and their standalone regression file; main already contains the original #4690 CLI guards. There is no remaining prerequisite. The update preserves main's newer scaled-room resolution and parser tests, and follows its return-2 error convention.Validation on synthetic inputs:
test_world_interior_report_paths,test_world_interior_names,test_report_pathsandtest_ci_registration. Five skips require symlink creation permission; the remaining report-path skip is platform-specific.e6190e7b5: the new suite has four failing Windows assertions/subcases, including both actual hard-link CLI runs exiting 0 and the scan-before-refusal checks. Synthetic fixture bytes only.AI-assisted (Codex). CPU only, no GPU/driver or game files used. The existing time-of-check/time-of-use window remains a separate nonblocking observation from review.