fix(census): report unreadable files during PE detection #1863

Manually merged
github merged 1 commit from gh-pr/1863/head into gh-pr/1863/base 2026-11-26 04:46:54 +00:00
Owner

@⁠Damokles2 on GitHub · 2026-11-24 23:45 UTC · original
Damokles2:fix-census-unreadable-files → main · +84 −7 · 2 files · 1 commits · merged 2026-11-25 21:52 UTC

Summary

  • Propagate I/O errors from looks_like_pe() instead of silently treating unreadable files as non-PE files.
  • Report affected paths through the existing unreadable mechanism.
  • Continue scanning remaining files after an I/O error.
  • Preserve existing behavior for empty, short and non-PE files.

Testing

  • Passed: Isolated Windows-MSVC reproduction of ERROR_SHARING_VIOLATION (Win32 error 32).
  • Passed: git diff --check and targeted formatting checks.
  • Not verified: Full CLI regression test and Clippy. Both were blocked because the local Windows application-control policy rejected a Rust build script (OS error 4551).

The regression test uses synthetic files and requires no game assets.

Additional notes

This addresses file-read failures after directory traversal, separately from the traversal errors covered by #115.

AI-assisted using OpenAI Codex.

**@⁠Damokles2** on GitHub · 2026-11-24 23:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/1863) `Damokles2:fix-census-unreadable-files` → `main` · +84 −7 · 2 files · 1 commits · merged 2026-11-25 21:52 UTC **Summary** - Propagate I/O errors from `looks_like_pe()` instead of silently treating unreadable files as non-PE files. - Report affected paths through the existing `unreadable` mechanism. - Continue scanning remaining files after an I/O error. - Preserve existing behavior for empty, short and non-PE files. **Testing** - **Passed:** Isolated Windows-MSVC reproduction of `ERROR_SHARING_VIOLATION` (Win32 error 32). - **Passed:** `git diff --check` and targeted formatting checks. - **Not verified:** Full CLI regression test and Clippy. Both were blocked because the local Windows application-control policy rejected a Rust build script (OS error 4551). The regression test uses synthetic files and requires no game assets. **Additional notes** This addresses file-read failures after directory traversal, separately from the traversal errors covered by #115. AI-assisted using OpenAI Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:46:50 +00:00
github manually merged commit c0af92af23 into gh-pr/1863/base 2026-11-26 04:46:54 +00:00
Author
Owner

@⁠oddmaniv on GitHub · 2026-11-25 00:56 UTC · original

Independently tested @⁠Damokles2’s fix on native Windows with Rust 1.98.1 in two configurations:

Exact current PR head — 0e4c06c

  • Clean, unmodified checkout; no adaptation or additional tests.
  • The PR’s unreadable-file regression passed: the locked synthetic PE is reported while the readable file is still scanned.
  • All tests from cargo test --locked -p victory passed.

Earlier patch adapted onto main — e9b2873 adapted to 02deab1

  • The original direct-file test and an additional directory-traversal regression both failed on unmodified main (1 images scanned, 0 unreadable).
  • Both passed with the adaptation (1 images scanned, 1 unreadable), including a repeat run. The directory test also verifies continued scanning of a readable sibling.
  • Two census unit tests and two existing census CLI integration tests passed.

Both configurations passed workspace Clippy—all targets, default and all features, warnings denied—and asset policy. The adaptation also passed changed-file formatting checks.

The full workspace test suite was not run. Synthetic fixtures only; no game data or game/GPU execution. AI-assisted.

**@⁠oddmaniv** on GitHub · 2026-11-25 00:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/1863#issuecomment-7149047679) Independently tested @⁠Damokles2’s fix on native Windows with Rust 1.98.1 in two configurations: **Exact current PR head — `0e4c06c`** - Clean, unmodified checkout; no adaptation or additional tests. - The PR’s unreadable-file regression passed: the locked synthetic PE is reported while the readable file is still scanned. - All tests from `cargo test --locked -p victory` passed. **Earlier patch adapted onto main — `e9b2873` adapted to `02deab1`** - The original direct-file test and an additional directory-traversal regression both failed on unmodified main (`1 images scanned, 0 unreadable`). - Both passed with the adaptation (`1 images scanned, 1 unreadable`), including a repeat run. The directory test also verifies continued scanning of a readable sibling. - Two census unit tests and two existing census CLI integration tests passed. Both configurations passed workspace Clippy—all targets, default and all features, warnings denied—and asset policy. The adaptation also passed changed-file formatting checks. The full workspace test suite was not run. Synthetic fixtures only; no game data or game/GPU execution. AI-assisted.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 07:26 UTC · original · edited 2026-11-25 11:21 UTC

Automated triage for the maintainers.

Merge candidate. No change since the last triage (head still c0af92a). looks_like_pe in apps/victory/src/census.rs returns io::Result<bool>, and run adds open/read errors other than UnexpectedEof to the existing failed list, which prints as "unreadable"/"skipped", then keeps scanning. Empty, short and non-PE files are still skipped silently, as on main. The Windows-only test apps/victory/tests/census_unreadable.rs locks a synthetic PE with share mode 0 and expects 1 images scanned, 1 unreadable. CI: passing (check).

On your reply: thanks, nothing more is needed. @⁠cloph-dsp reports that the new test passes on native Windows at this head, which covers the run your local policy blocked.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 07:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1863#issuecomment-7155857916) · edited 2026-11-25 11:21 UTC <!-- victory-triage v1 head=c0af92af23b6d7504a515fc5b2e1d13fdacffecd verdict=merge-candidate at=2026-11-25T11:21:30Z --> Automated triage for the maintainers. **Merge candidate.** No change since the last triage (head still `c0af92a`). `looks_like_pe` in `apps/victory/src/census.rs` returns `io::Result<bool>`, and `run` adds open/read errors other than `UnexpectedEof` to the existing `failed` list, which prints as "unreadable"/"skipped", then keeps scanning. Empty, short and non-PE files are still skipped silently, as on `main`. The Windows-only test `apps/victory/tests/census_unreadable.rs` locks a synthetic PE with share mode 0 and expects `1 images scanned, 1 unreadable`. CI: passing (`check`). On your reply: thanks, nothing more is needed. @⁠cloph-dsp reports that the new test passes on native Windows at this head, which covers the run your local policy blocked. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Damokles2 on GitHub · 2026-11-25 09:20 UTC · original

Thanks for the review! I've updated the existing PR branch with a clean commit (c0af92a) directly on upstream main.

The PR now contains only the census fix and its Windows regression test, using the current Vec<String> error format.

Formatting and strict Windows-MSVC Clippy passed. The tests compiled, but local Windows Application Control blocked their execution (OS error 4551).

AI-assisted using OpenAI Codex.

**@⁠Damokles2** on GitHub · 2026-11-25 09:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/1863#issuecomment-7158197943) Thanks for the review! I've updated the existing PR branch with a clean commit (`c0af92a`) directly on upstream main. The PR now contains only the census fix and its Windows regression test, using the current `Vec<String>` error format. Formatting and strict Windows-MSVC Clippy passed. The tests compiled, but local Windows Application Control blocked their execution (OS error 4551). AI-assisted using OpenAI Codex.
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-25 11:09 UTC · original

Independent local validation (Windows, Rust 1.100.0/MSVC, head c0af92a, no game data): cargo test --locked -p victory --test census_unreadable -> 1 test passed (census_reports_unreadable_files_and_continues_scanning), exit 0; cargo test --locked -p victory -> 53 tests passed, exit 0. Caveat: my capture of the main 940d32f baseline was truncated, so I cannot compare total test counts directly; the new test itself passes here. Author reported this head not runnable under App Control/OS 4551, but it ran here. Windows exclusive-share handle semantics may still differ from Wine/Linux. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only tests). No game data used.

**@⁠cloph-dsp** on GitHub · 2026-11-25 11:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/1863#issuecomment-7160662966) Independent local validation (Windows, Rust 1.100.0/MSVC, head c0af92a, no game data): `cargo test --locked -p victory --test census_unreadable` -> 1 test passed (`census_reports_unreadable_files_and_continues_scanning`), exit 0; `cargo test --locked -p victory` -> 53 tests passed, exit 0. Caveat: my capture of the main 940d32f baseline was truncated, so I cannot compare total test counts directly; the new test itself passes here. Author reported this head not runnable under App Control/OS 4551, but it ran here. Windows exclusive-share handle semantics may still differ from Wine/Linux. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only tests). No game data used.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1863
No description provided.