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

Open
github-bot wants to merge 3 commits from github-bot/gh-471 into main AGit
Owner

@⁠AnastasisKon on GitHub · 2026-11-27 21:40 UTC · original
AnastasisKon:vibe/inspect-lib-exports-tests-1705ac → main · +58 −8 · 1 files · 3 commits · open

What this changes

Refs #474. 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
**@⁠AnastasisKon** on GitHub · 2026-11-27 21:40 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471) `AnastasisKon:vibe/inspect-lib-exports-tests-1705ac` → `main` · +58 −8 · 1 files · 3 commits · open ## What this changes Refs #474. 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
Refs #465. sources() feeds both 'victory shader' and the pre-build; pin its
exact behavior with synthetic bytes (hand-built DXBC header, hand-built
stored-deflate SGD5 record): empty input, a fake magic whose size field
disagrees, raw containers found in order at their offsets with the whole
tail kept, a packed record's label/offset/unpack, and a corrupt record
listed but yielding no bytes.
Refs #465.
Refs #470. imports_by_dll now holds the grouping lib_exports prints with
(DLL names lowercased, DLLs in name order, exports in file order, ordinals
as #N); unit tests pin those rules. No change to the printed output.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:43:25 +00:00
Author
Owner

@⁠Olima34 on GitHub · 2026-11-28 01:35 UTC · original · 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 #471'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 (#401 #403 #426 #471 #475 #479 #483 #485 #490 #493 #498 #502 #509 #515). 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** on GitHub · 2026-11-28 01:35 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#pullrequestreview-6094920616) · **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 #471'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 (#401 #403 #426 #471 #475 #479 #483 #485 #490 #493 #498 #502 #509 #515). 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!
Author
Owner

@⁠Olima34 on GitHub · 2026-11-28 01:37 UTC · original · review (dismissed)

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

**@⁠Olima34** on GitHub · 2026-11-28 01:37 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#pullrequestreview-6094931040) · **review (dismissed)** Re-approving: my approval above was dismissed automatically when #471, whose commits this branch carries, merged. The head is unchanged (c377c42c), so the check report above still applies.
Author
Owner

@⁠Olima34 on GitHub · 2026-11-28 01:58 UTC · original · requested changes

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 #471 merged, and I couldn't merge it. Meanwhile #507 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.

**@⁠Olima34** on GitHub · 2026-11-28 01:58 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#pullrequestreview-6095060811) · **requested changes** 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 #471 merged, and I couldn't merge it. Meanwhile #507 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.
Folds the two #[cfg(test)] modules in apps/victory/src/inspect.rs into one
(imports_by_dll's tests next to dll_flags's, with both imports), as the
review asked.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 10:18 UTC · original

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** on GitHub · 2026-11-28 10:18 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#issuecomment-7237810254) 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.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 12:31 UTC · original

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** on GitHub · 2026-11-28 12:31 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#issuecomment-7239290390) 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.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 15:27 UTC · original

The branch is now based on the current public main (26817285), which already contains the #471/#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** on GitHub · 2026-11-28 15:27 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#issuecomment-7241479404) The branch is now based on the current public `main` (26817285), which already contains the #471/#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?
No code change: the head already merges public main 26817285, which carries both.
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 18:16 UTC · original

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 #471 and #507, and git merge-tree shows zero conflicts against it. CI is re-running on the new head. Ready to merge when you are.

**@⁠AnastasisKon** on GitHub · 2026-11-28 18:16 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/471#issuecomment-7243668308) 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 #471 and #507, 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 can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/475/head:github-bot/gh-471'
git switch 'github-bot/gh-471'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-471'
git switch 'github-bot/gh-471'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-471'
git switch 'github-bot/gh-471'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-471'
git switch 'main'
git merge --squash 'github-bot/gh-471'
git switch 'main'
git merge --ff-only 'github-bot/gh-471'
git switch 'main'
git merge 'github-bot/gh-471'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.