HLE: pin a call's task queue at XAsyncBegin #503

Open
Quat3rnion wants to merge 1 commit from upstream-pr/503 into main
Quat3rnion commented 2026-11-24 04:16:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T04:16:08Z.


What

An XAsync call resolved its queue again at schedule and completion time. If
the title changed the process default between Begin and completion, work
submitted to the old queue could deliver its completion to the new one,
where the title may never dispatch it. This resolves the queue once at Begin,
retains it in the call, and uses it for work and completion. Starting a
provider with no available queue now returns E_NO_TASK_QUEUE as GDK
requires, instead of completing inline and reporting success.

An AI tool wrote part of this change.

Tested

  • Linux: cargo test --workspace: 166 passed, 0 failed, 3 ignored. Two new hermetic tests: one starts a call with no queue through a test seam and checks the refusal; the other changes the block's queue mid-call and asserts both work and completion stay on the original manual queue.
  • Windows cross-build: cargo check --target x86_64-pc-windows-gnu --workspace --tests passes. No Windows host here.
  • cargo xtask policy passes (150 files ok). No game files or data from them were added.

Checklist

  • Workspace tests and Windows cross-check pass.
  • cargo xtask policy passes. No game files or data from them were added.
  • AI authorship is disclosed above.
<!-- greyfinch-sync:Marvisak/VIctory:issue:5465976306 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/503). Originally posted by [Quat3rnion](https://github.com/Quat3rnion) on 2026-11-24T04:16:08Z. --- ## What An XAsync call resolved its queue again at schedule and completion time. If the title changed the process default between Begin and completion, work submitted to the old queue could deliver its completion to the new one, where the title may never dispatch it. This resolves the queue once at Begin, retains it in the call, and uses it for work and completion. Starting a provider with no available queue now returns `E_NO_TASK_QUEUE` as GDK requires, instead of completing inline and reporting success. An AI tool wrote part of this change. ## Tested - Linux: `cargo test --workspace`: 166 passed, 0 failed, 3 ignored. Two new hermetic tests: one starts a call with no queue through a test seam and checks the refusal; the other changes the block's queue mid-call and asserts both work and completion stay on the original manual queue. - Windows cross-build: `cargo check --target x86_64-pc-windows-gnu --workspace --tests` passes. No Windows host here. - `cargo xtask policy` passes (150 files ok). No game files or data from them were added. ## Checklist - [x] Workspace tests and Windows cross-check pass. - [x] `cargo xtask policy` passes. No game files or data from them were added. - [x] AI authorship is disclosed above.
mercuryVM commented 2026-11-24 12:18:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T12:18:38Z.

Review: APPROVED


Tested 3e4d52c on Windows 11, RTX 5070, MSVC: cargo test -p victory-hle 89 passed, including begin_without_a_task_queue_is_refused and the pinned-queue test.

  • Resolving the queue once at XAsyncBegin and storing the Arc<Queue> in the call means work and completion both go to the port the call started on, whatever the title changes afterwards. A missing queue returns E_NO_TASK_QUEUE (0x800701AB, HRESULT_FROM_WIN32(ERROR_NO_TASK_QUEUE)) instead of starting a provider with nowhere to run.
  • Nit, new clippy warning: xasync.rs:1153, "value assigned to block is never read", on block.queue = second; in the test. The compiler sees the local written after &mut block was passed as a raw pointer and nothing in Rust reading it. Write through the same raw pointer (unsafe { (*ptr).queue = second }) so the test really changes what the runtime could read, and the warning goes away.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6039059871 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/503#pullrequestreview-6039059871). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T12:18:38Z. **Review:** APPROVED --- Tested 3e4d52c on Windows 11, RTX 5070, MSVC: `cargo test -p victory-hle` 89 passed, including `begin_without_a_task_queue_is_refused` and the pinned-queue test. - Resolving the queue once at `XAsyncBegin` and storing the `Arc<Queue>` in the call means work and completion both go to the port the call started on, whatever the title changes afterwards. A missing queue returns `E_NO_TASK_QUEUE` (`0x800701AB`, `HRESULT_FROM_WIN32(ERROR_NO_TASK_QUEUE)`) instead of starting a provider with nowhere to run. - Nit, new clippy warning: `xasync.rs:1153`, "value assigned to `block` is never read", on `block.queue = second;` in the test. The compiler sees the local written after `&mut block` was passed as a raw pointer and nothing in Rust reading it. Write through the same raw pointer (`unsafe { (*ptr).queue = second }`) so the test really changes what the runtime could read, and the warning goes away. AI-assisted (Claude Code).
jeremygold02 commented 2026-11-24 18:05:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T17:31:05Z.


Verification ran against PR head 43710396895e6bce2ea3de27b96380f05ef4af51; the PR was open at refresh.

  • cargo test -p victory-hle xasync: 8 passed; modules::xasync::tests::begin_without_a_task_queue_is_refused failed because PINNED_COMPLETED changed from 0 to 1 between the snapshots.
  • cargo test -p victory-hle xasync -- --test-threads=1: all 9 xasync tests passed, including begin_without_a_task_queue_is_refused and a_call_keeps_the_queue_it_began_on.

The first failure is a test-isolation race: both new tests share PINNED_COMPLETED, so the queue-pinning test can increment it while the no-queue test asserts it is unchanged. Serial execution passes the queue-resolution and pinned work/completion checks.

This verification was AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139313059 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/503#issuecomment-7139313059). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T17:31:05Z. --- Verification ran against PR head `43710396895e6bce2ea3de27b96380f05ef4af51`; the PR was open at refresh. - `cargo test -p victory-hle xasync`: 8 passed; `modules::xasync::tests::begin_without_a_task_queue_is_refused` failed because `PINNED_COMPLETED` changed from 0 to 1 between the snapshots. - `cargo test -p victory-hle xasync -- --test-threads=1`: all 9 xasync tests passed, including `begin_without_a_task_queue_is_refused` and `a_call_keeps_the_queue_it_began_on`. The first failure is a test-isolation race: both new tests share `PINNED_COMPLETED`, so the queue-pinning test can increment it while the no-queue test asserts it is unchanged. Serial execution passes the queue-resolution and pinned work/completion checks. This verification was AI-assisted.
Marvisak commented 2026-11-25 01:07:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:22:12Z.


Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: crates/victory-hle/src/modules/xasync.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148437696 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/503#issuecomment-7148437696). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:22:12Z. --- <!-- victory-triage v1 head=43710396895e6bce2ea3de27b96380f05ef4af51 verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `crates/victory-hle/src/modules/xasync.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
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/503:upstream-pr/503'
git switch 'upstream-pr/503'

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/503'
git switch 'upstream-pr/503'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/503'
git switch 'upstream-pr/503'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/503'
git switch 'main'
git merge --squash 'upstream-pr/503'
git switch 'main'
git merge --ff-only 'upstream-pr/503'
git switch 'main'
git merge 'upstream-pr/503'
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
Marvisak/VIctory!503
No description provided.