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

Open
AnastasisKon wants to merge 3 commits from upstream-pr/471 into main
AnastasisKon commented 2026-11-27 21:40:44 +00:00 (Migrated from github.com)

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


What this changes

Refs #470. One change: apps/victory/src/inspect.rs's lib_exports grouped a library file's imports by DLL inline while printing; that grouping is now a pure imports_by_dll(&[LibImport]) -> BTreeMap<String, Vec<String>>, pinned by unit tests. No change to the printed output.

Pinned rules: DLL names lowercased (so KERNEL32.dll and kernel32.DLL are one group), DLLs in name order (BTreeMap), each DLL's exports in file order, an ordinal export rendered as #N regardless of import kind, empty input groups to nothing.

How it was tested

  • cargo test -p victory — 15 lib tests pass, including the 2 new inspect::tests (arm64 host, toolchain 1.98.1)
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings — pass
  • cargo xtask policy — pass (398 files ok)
  • Ran the game: not needed (test-only)

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md — n/a, no behaviour change
  • New diagnostics are behind a VICTORY_* variable and documented — n/a, none added
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5533427754 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-27T21:40:44Z. --- ## What this changes Refs #470. One change: `apps/victory/src/inspect.rs`'s `lib_exports` grouped a library file's imports by DLL inline while printing; that grouping is now a pure `imports_by_dll(&[LibImport]) -> BTreeMap<String, Vec<String>>`, pinned by unit tests. No change to the printed output. Pinned rules: DLL names lowercased (so `KERNEL32.dll` and `kernel32.DLL` are one group), DLLs in name order (BTreeMap), each DLL's exports in file order, an ordinal export rendered as `#N` regardless of import kind, empty input groups to nothing. ## How it was tested - [x] `cargo test -p victory` — 15 lib tests pass, including the 2 new `inspect::tests` (arm64 host, toolchain 1.98.1) - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` — pass - [x] `cargo xtask policy` — pass (398 files ok) - [x] Ran the game: not needed (test-only) ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md — n/a, no behaviour change - [x] New diagnostics are behind a `VICTORY_*` variable and documented — n/a, none added
Olima34 commented 2026-11-28 01:35:01 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T01:35:01Z.

Review: DISMISSED


Check report (helping the maintainer clear the queue):

  • CI: check and macos-scripts green on the current head.
  • Read: the whole diff. imports_by_dll is factored out of lib_exports unchanged and pinned by two tests (it carries #467's commits, merged just before).
  • Local check: current main (226645f9) merged with this PR and the other test/docs/tools PRs we're landing in this batch (#397 #399 #422 #467 #471 #475 #479 #481 #486 #489 #494 #498 #505 #511). On it, the victory-gpu (arm64), victory-shader, victory-backend, victory-metal and victory tests pass, as do the macOS script tests (rustup-path.sh, run-summary-compare.sh, run-summary.sh --self-test), Windows clippy (-D warnings) and cargo xtask policy. One victory-gpu run in four failed main's own multi_mip_array_and_placed_depth_twins_preserve_all_subresources_and_remirror_immediately. That test also flakes on main alone, so it isn't from this batch.
  • Not checked: no game run (the maintainer asked us to work on GitHub only).

Thanks @AnastasisKon!

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6094920616 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#pullrequestreview-6094920616). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-28T01:35:01Z. **Review:** DISMISSED --- Check report (helping the maintainer clear the queue): - **CI:** `check` and `macos-scripts` green on the current head. - **Read:** the whole diff. `imports_by_dll` is factored out of `lib_exports` unchanged and pinned by two tests (it carries #467's commits, merged just before). - **Local check:** current main (226645f9) merged with this PR and the other test/docs/tools PRs we're landing in this batch (#397 #399 #422 #467 #471 #475 #479 #481 #486 #489 #494 #498 #505 #511). On it, the `victory-gpu` (arm64), `victory-shader`, `victory-backend`, `victory-metal` and `victory` tests pass, as do the macOS script tests (`rustup-path.sh`, `run-summary-compare.sh`, `run-summary.sh --self-test`), Windows clippy (`-D warnings`) and `cargo xtask policy`. One `victory-gpu` run in four failed main's own `multi_mip_array_and_placed_depth_twins_preserve_all_subresources_and_remirror_immediately`. That test also flakes on main alone, so it isn't from this batch. - **Not checked:** no game run (the maintainer asked us to work on GitHub only). Thanks @AnastasisKon!
Olima34 commented 2026-11-28 01:37:40 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T01:37:40Z.

Review: DISMISSED


Re-approving: my approval above was dismissed automatically when #467, whose commits this branch carries, merged. The head is unchanged (c377c42c), so the check report above still applies.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6094931040 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#pullrequestreview-6094931040). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-28T01:37:40Z. **Review:** DISMISSED --- Re-approving: my approval above was dismissed automatically when #467, whose commits this branch carries, merged. The head is unchanged (c377c42c), so the check report above still applies.
Olima34 commented 2026-11-28 01:58:24 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T01:58:24Z.

Review: CHANGES_REQUESTED


Sorry for the back and forth, @AnastasisKon. My approval above still stands for the code (head c377c42c), but GitHub kept this PR blocked as "review required" after #467 merged, and I couldn't merge it. Meanwhile #503 merged, and it adds its own #[cfg(test)] mod tests at the end of apps/victory/src/inspect.rs, so this branch now conflicts there.

Could you merge current main into the branch and fold the two test modules into one (imports_by_dll's tests next to dll_flags's, with both imports)? The new push should also clear the stuck review state. Once CI is green on the new head, we'll merge it.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6095060811 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#pullrequestreview-6095060811). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-28T01:58:24Z. **Review:** CHANGES_REQUESTED --- Sorry for the back and forth, @AnastasisKon. My approval above still stands for the code (head c377c42c), but GitHub kept this PR blocked as "review required" after #467 merged, and I couldn't merge it. Meanwhile #503 merged, and it adds its own `#[cfg(test)] mod tests` at the end of `apps/victory/src/inspect.rs`, so this branch now conflicts there. Could you merge current `main` into the branch and fold the two test modules into one (`imports_by_dll`'s tests next to `dll_flags`'s, with both imports)? The new push should also clear the stuck review state. Once CI is green on the new head, we'll merge it.
AnastasisKon commented 2026-11-28 10:18:28 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T10:18:28Z.


Merged current main into the branch and resolved the conflict keeping both sides, as requested. CI is green on the new head and the PR shows mergeable. Ready for re-review.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7237810254 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#issuecomment-7237810254). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T10:18:28Z. --- Merged current main into the branch and resolved the conflict keeping both sides, as requested. CI is green on the new head and the PR shows mergeable. Ready for re-review.
AnastasisKon commented 2026-11-28 12:31:50 +00:00 (Migrated from github.com)

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


Re-requesting review: conflicts with current main are resolved, CI is green on the latest head, and the earlier approval was noted as still standing. Ready to merge when you are.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7239290390 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#issuecomment-7239290390). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T12:31:50Z. --- Re-requesting review: conflicts with current main are resolved, CI is green on the latest head, and the earlier approval was noted as still standing. Ready to merge when you are.
AnastasisKon commented 2026-11-28 15:27:21 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:27:21Z.


The branch is now based on the current public main (26817285), which already contains the #467/#494/#503 merges, and GitHub shows mergeable=true (the earlier conflict was against the newer private main). The requested shape is in place: one `#[cfg(test)] mod tests` in `apps/victory/src/inspect.rs` with both import sets (`imports_by_dll` next to `dll_flags`). Could you re-review when you get a chance?

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7241479404 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#issuecomment-7241479404). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T15:27:21Z. --- The branch is now based on the current public `main` (26817285), which already contains the #467/#494/#503 merges, and GitHub shows `mergeable=true` (the earlier conflict was against the newer private main). The requested shape is in place: one \`#[cfg(test)] mod tests\` in \`apps/victory/src/inspect.rs\` with both import sets (\`imports_by_dll\` next to \`dll_flags\`). Could you re-review when you get a chance?
AnastasisKon commented 2026-11-28 18:16:44 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T18:16:44Z.


Pushed a new head (b347a47b, an empty commit on top of 3a1fbacf) to clear the stuck review state, as suggested. No code change: the branch already merges public main 26817285, which carries both #467 and #503, and git merge-tree shows zero conflicts against it. CI is re-running on the new head. Ready to merge when you are.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7243668308 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#issuecomment-7243668308). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T18:16:44Z. --- Pushed a new head (b347a47b, an empty commit on top of 3a1fbacf) to clear the stuck review state, as suggested. No code change: the branch already merges public `main` 26817285, which carries both #467 and #503, and `git merge-tree` shows zero conflicts against it. CI is re-running on the new head. Ready to merge when you are.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/471:upstream-pr/471'
git switch 'upstream-pr/471'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/471'
git switch 'upstream-pr/471'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/471'
git switch 'upstream-pr/471'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/471'
git switch 'main'
git merge --squash 'upstream-pr/471'
git switch 'main'
git merge --ff-only 'upstream-pr/471'
git switch 'main'
git merge 'upstream-pr/471'
git push origin 'main'
Sign in to join this conversation.
No reviewers
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!471
No description provided.