app: factor inspect lib_exports' import grouping into a pure function and pin it with unit tests #470

Open
opened 2026-11-27 21:39:30 +00:00 by AnastasisKon · 6 comments
AnastasisKon commented 2026-11-27 21:39:30 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-27T21:39:30Z.


What

apps/victory/src/inspect.rs's lib_exports (behind victory inspect --lib) groups a library file's imports by DLL inline while printing, so the grouping rules — DLL names lowercased, DLLs in name order, each DLL's exports in file order, ordinals rendered as #N — are untested.

What this changes

One change: extract the grouping into a pure imports_by_dll(&[LibImport]) -> BTreeMap<String, Vec<String>> and pin it with unit tests (lowercased keys, BTreeMap order, file order kept within a DLL, ordinal rendering, empty input). No behavior change to the printed output.

How it was tested

  • cargo test -p victory (new tests in apps/victory/src/inspect.rs)
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings
  • cargo xtask policy
  • Game run: not needed (test-only).
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6654859655 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/470). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-27T21:39:30Z. --- ## What `apps/victory/src/inspect.rs`'s `lib_exports` (behind `victory inspect --lib`) groups a library file's imports by DLL inline while printing, so the grouping rules — DLL names lowercased, DLLs in name order, each DLL's exports in file order, ordinals rendered as `#N` — are untested. ## What this changes One change: extract the grouping into a pure `imports_by_dll(&[LibImport]) -> BTreeMap<String, Vec<String>>` and pin it with unit tests (lowercased keys, BTreeMap order, file order kept within a DLL, ordinal rendering, empty input). No behavior change to the printed output. ## How it was tested - `cargo test -p victory` (new tests in `apps/victory/src/inspect.rs`) - `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` - `cargo xtask policy` - Game run: not needed (test-only).
AnastasisKon commented 2026-11-27 21:39:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-27T21:39:35Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7228641782 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/470#issuecomment-7228641782). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-27T21:39:35Z. --- /claim
github-actions[bot] commented 2026-11-27 21:39:46 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T21:39:46Z.


Claimed by @AnastasisKon. Open a draft pull request with Refs #470 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7228644496 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/470#issuecomment-7228644496). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-27T21:39:46Z. --- Claimed by @AnastasisKon. Open a draft pull request with `Refs #470` in its description within 24 hours, or the claim expires.
AnastasisKon commented 2026-11-27 21:42:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-27T21:42:58Z.


Draft PR up: #471 (branch vibe/inspect-lib-exports-tests-1705ac), CI running; local gates pass (cargo test -p victory, windows clippy, xtask policy).

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7228691027 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/470#issuecomment-7228691027). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-27T21:42:58Z. --- Draft PR up: #471 (branch vibe/inspect-lib-exports-tests-1705ac), CI running; local gates pass (cargo test -p victory, windows clippy, xtask policy).
AnastasisKon commented 2026-11-28 12:37:17 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T12:37:17Z.


/release - done: PR #471 factors inspect's lib_exports import grouping into a pure function and pins it with unit tests. Carried in my fork's main (69146296).

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7239353152 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/470#issuecomment-7239353152). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T12:37:17Z. --- /release - done: PR #471 factors inspect's lib_exports import grouping into a pure function and pins it with unit tests. Carried in my fork's `main` (69146296).
AnastasisKon commented 2026-11-28 12:42:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T12:42:26Z.


/release - done: PR #471 factors inspect's lib_exports import grouping into a pure function and pins it with unit tests. Carried in my fork's main (69146296).

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7239411284 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/470#issuecomment-7239411284). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T12:42:26Z. --- /release - done: PR #471 factors inspect's lib_exports import grouping into a pure function and pins it with unit tests. Carried in my fork's `main` (69146296).
github-actions[bot] commented 2026-11-28 12:42:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T12:42:36Z.


Released. This issue is free to claim.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7239413007 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/470#issuecomment-7239413007). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T12:42:36Z. --- Released. This issue is free to claim.
Sign in to join this conversation.
No labels
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.

Reference
LakshanSivakumar/Native-Victory-macOS#470
No description provided.