Census: deduplicate PE imports without hint #476

Manually merged
github merged 1 commit from gh-pr/476/head into gh-pr/476/base 2026-11-26 04:05:22 +00:00
Owner

@⁠nathanbzrr on GitHub · 2026-11-24 03:50 UTC · original
nathanbzrr:fix/census-dedupe-without-hint → main · +221 −24 · 1 files · 1 commits · merged 2026-11-25 00:08 UTC

Problem

victory census in apps/victory/src/census.rs tracked per-DLL unique functions in BTreeSet<ImportSymbol>. Because ImportSymbol derives Eq and Ord over all fields including the advisory PE hint: u16, identical dll!function imports appearing across different binaries (or in both regular and delay-load import tables) with different hint values were counted multiple times in funcs, hle, host, and missing totals, disagreeing with missing entries (which key by e.symbol.to_string()).

What changed

  • Added a private FunctionKey { Name(String), Ordinal(u16) } enum implementing From<&ImportSymbol> in apps/victory/src/census.rs so PE import hint values are ignored when deduplicating per-DLL functions.
  • Switched DllStats.functions from BTreeSet<ImportSymbol> to BTreeSet<FunctionKey>.
  • Extracted tally_image() from run() and inserted FunctionKey::from(&e.symbol) into stats.functions.
  • Added synthetic in-memory unit tests covering cross-image and imports + delay_imports deduplication across differing hint values, ordinal imports, and missing total consistency.

Tests (isolated branch a3f89ed)

  • rustfmt --edition 2024 --check apps/victory/src/census.rs: passed (exit 0).
  • cargo test -p victory --bin victory census: 2 passed, 0 failed, 1 filtered out (census::tests::deduplicates_imports_ignoring_hint_across_images_and_delay_imports, census::tests::counts_distinct_symbols_and_dlls_separately).
  • cargo clippy -p victory --all-targets: passed (exit 0; 0 errors/warnings in apps/victory/src/census.rs).
  • cargo xtask policy: asset policy: 151 files ok.

No game files. AI-assisted; reviewed and verified with the tests above.

**@⁠nathanbzrr** on GitHub · 2026-11-24 03:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/476) `nathanbzrr:fix/census-dedupe-without-hint` → `main` · +221 −24 · 1 files · 1 commits · merged 2026-11-25 00:08 UTC ## Problem `victory census` in `apps/victory/src/census.rs` tracked per-DLL unique functions in `BTreeSet<ImportSymbol>`. Because `ImportSymbol` derives `Eq` and `Ord` over all fields including the advisory PE `hint: u16`, identical `dll!function` imports appearing across different binaries (or in both regular and delay-load import tables) with different `hint` values were counted multiple times in `funcs`, `hle`, `host`, and `missing` totals, disagreeing with `missing` entries (which key by `e.symbol.to_string()`). ## What changed - Added a private `FunctionKey { Name(String), Ordinal(u16) }` enum implementing `From<&ImportSymbol>` in `apps/victory/src/census.rs` so PE import `hint` values are ignored when deduplicating per-DLL functions. - Switched `DllStats.functions` from `BTreeSet<ImportSymbol>` to `BTreeSet<FunctionKey>`. - Extracted `tally_image()` from `run()` and inserted `FunctionKey::from(&e.symbol)` into `stats.functions`. - Added synthetic in-memory unit tests covering cross-image and `imports` + `delay_imports` deduplication across differing `hint` values, ordinal imports, and `missing` total consistency. ## Tests (isolated branch `a3f89ed`) - `rustfmt --edition 2024 --check apps/victory/src/census.rs`: passed (exit 0). - `cargo test -p victory --bin victory census`: 2 passed, 0 failed, 1 filtered out (`census::tests::deduplicates_imports_ignoring_hint_across_images_and_delay_imports`, `census::tests::counts_distinct_symbols_and_dlls_separately`). - `cargo clippy -p victory --all-targets`: passed (exit 0; 0 errors/warnings in `apps/victory/src/census.rs`). - `cargo xtask policy`: `asset policy: 151 files ok`. No game files. AI-assisted; reviewed and verified with the tests above.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:05:22 +00:00
github manually merged commit a3f89eda54 into gh-pr/476/base 2026-11-26 04:05:22 +00:00
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!476
No description provided.