fix(hle): skip unavailable host exports in net test #256

Closed
CesarLopesO wants to merge 1 commit from upstream-pr/256 into main
CesarLopesO commented 2026-11-24 01:52:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by CesarLopesO on 2026-11-24T01:52:45Z.


Summary

  • Skip host-export presence checks when the corresponding export is unavailable on the running Windows version.
  • Avoid failing only_loopback_is_reachable for HLE-provided APIs absent from older Windows releases.

Closes #118

Validation

  • rustfmt check: passed.
  • git diff --check: passed.
  • cargo test -p victory-hle --lib net: blocked on Debian by an unrelated compilation error in victory-gpu.
  • Windows 10 test was not independently reproduced.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6572799550 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/256). Originally posted by [CesarLopesO](https://github.com/CesarLopesO) on 2026-11-24T01:52:45Z. --- ## Summary - Skip host-export presence checks when the corresponding export is unavailable on the running Windows version. - Avoid failing only_loopback_is_reachable for HLE-provided APIs absent from older Windows releases. Closes #118 ## Validation - rustfmt check: passed. - git diff --check: passed. - cargo test -p victory-hle --lib net: blocked on Debian by an unrelated compilation error in victory-gpu. - Windows 10 test was not independently reproduced.
mercuryVM commented 2026-11-24 06:48:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T06:48:29Z.

Review: CHANGES_REQUESTED


Tested 4c57d95 on Windows 11, RTX 5070, MSVC: cargo test -p victory-hle --lib net:: passes (1 test).

crates/victory-hle/src/modules/net.rs, only_loopback_is_reachable: the test can no longer fail. The new if crate::host::function(dll, e.name).is_none() { continue; } runs right before the assert! with the same condition. The assert only runs when the condition is true, so it never fires. A typo in an override name, or an export that is wrong for every Windows version, now passes silently. That is the case this check exists for.

Suggested fix: skip only the exports known to be missing on older Windows, by name. For #118 that is the WinHTTP proxy call; #349 handles the same case for WinHttpGetProxy.... Then keep asserting on the rest:

const OPTIONAL: &[&str] = &["WinHttpGetProxyForUrlEx" /* … the ones Windows 10 lacks */];
if OPTIONAL.contains(&e.name) && crate::host::function(dll, e.name).is_none() {
    continue;
}
assert!(crate::host::function(dll, e.name).is_some(), "{dll} lacks {}", e.name);

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6034845674 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/256#pullrequestreview-6034845674). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T06:48:29Z. **Review:** CHANGES_REQUESTED --- Tested 4c57d95 on Windows 11, RTX 5070, MSVC: `cargo test -p victory-hle --lib net::` passes (1 test). **`crates/victory-hle/src/modules/net.rs`, `only_loopback_is_reachable`: the test can no longer fail.** The new `if crate::host::function(dll, e.name).is_none() { continue; }` runs right before the `assert!` with the same condition. The assert only runs when the condition is true, so it never fires. A typo in an override name, or an export that is wrong for every Windows version, now passes silently. That is the case this check exists for. Suggested fix: skip only the exports known to be missing on older Windows, by name. For #118 that is the WinHTTP proxy call; #349 handles the same case for `WinHttpGetProxy...`. Then keep asserting on the rest: ```rust const OPTIONAL: &[&str] = &["WinHttpGetProxyForUrlEx" /* … the ones Windows 10 lacks */]; if OPTIONAL.contains(&e.name) && crate::host::function(dll, e.name).is_none() { continue; } assert!(crate::host::function(dll, e.name).is_some(), "{dll} lacks {}", e.name); ``` AI-assisted (Claude Code).
jeremygold02 commented 2026-11-24 06:56:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T05:56:55Z.


Tested current PR head 4c57d95c6c15aac53f91a9cd803f586ec0a43eac.

  • cargo test --locked -p victory-hle --lib only_loopback_is_reachable -- --test-threads=1: 1 passed, 85 filtered out. The test allows a local loopback connection, expects a TEST-NET-1 destination to fail with WSAENETUNREACH, rejects external-name lookups, and checks numeric reverse lookup plus the ConnectEx extension path. Its export-validation loop now asserts the mapping only for host functions that are available (network test and export check).

Unavailable host exports are deliberately skipped, so this run does not validate their runtime resolution path. The test uses loopback and reserved TEST-NET-1 addresses; it does not require a game or outbound network access.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123426607 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/256#issuecomment-7123426607). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T05:56:55Z. --- Tested current PR head `4c57d95c6c15aac53f91a9cd803f586ec0a43eac`. - `cargo test --locked -p victory-hle --lib only_loopback_is_reachable -- --test-threads=1`: 1 passed, 85 filtered out. The test allows a local loopback connection, expects a TEST-NET-1 destination to fail with `WSAENETUNREACH`, rejects external-name lookups, and checks numeric reverse lookup plus the `ConnectEx` extension path. Its export-validation loop now asserts the mapping only for host functions that are available ([network test and export check](https://github.com/Marvisak/VIctory/blob/4c57d95c6c15aac53f91a9cd803f586ec0a43eac/crates/victory-hle/src/modules/net.rs#L898-L1067)). Unavailable host exports are deliberately skipped, so this run does not validate their runtime resolution path. The test uses loopback and reserved TEST-NET-1 addresses; it does not require a game or outbound network access.
Exorion1er commented 2026-11-24 10:03:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Exorion1er on 2026-11-24T09:33:13Z.


Both this PR and #349 change only_loopback_is_reachable for Windows 10 hosts without the newer winhttp exports (#118). #152 (merged 07:52 today) already does this on main: it skips the exports only when the host lacks them. Both PRs now conflict with main in that test, so I think both can be closed.

Checked by reading the diffs against main. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7127572352 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/256#issuecomment-7127572352). Originally posted by [Exorion1er](https://github.com/Exorion1er) on 2026-11-24T09:33:13Z. --- Both this PR and #349 change `only_loopback_is_reachable` for Windows 10 hosts without the newer winhttp exports (#118). #152 (merged 07:52 today) already does this on `main`: it skips the exports only when the host lacks them. Both PRs now conflict with `main` in that test, so I think both can be closed. Checked by reading the diffs against `main`. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-24 23:04:00 +00:00

Pull request closed

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
Marvisak/VIctory!256
No description provided.