Fix equipment Back, keyboard navigation, and asynchronous equip ownership - #268
Merged
Conversation
Hona
force-pushed
the
work/tf2-equipment-navigation-latency
branch
2 times, most recently
from
September 1, 2026 02:25
9605f6d to
89153ef
Compare
Hona
marked this pull request as ready for review
September 1, 2026 02:27
There was a problem hiding this comment.
🔵 Needs a closer look
It touches core UI/runtime input ownership, async equipment admission, and rendering paths; cleanup error propagation needs adjustment and warrants final human review.
Pull request overview
This PR hardens TF2 equipment/navigation behavior (Back/Escape/key focus, async equip cancellation/ownership) and introduces profiling/parity coverage plus a retained-raster optimization that shares immutable bitmaps across consumers to reduce repeated pixel uploads.
Changes:
- Fix equipment navigation/focus behavior (Back/Escape, held keys, console/options ownership) and make equip ownership/cancellation robust across close/reopen, map replacement, and disconnect.
- Make equipment admission/equip failures explicit and non-poisoning for subsequent requests; add regression tests for async cancellation and failure paths.
- Optimize VGUI retained raster publishing by sharing cached ImageBitmaps; add parity fixtures and profiling runners/configs.
File summaries
| File | Description |
|---|---|
| tools/playsrc/src/profile-runner.ts | Adds new headed profile entries for equipment navigation variants and VGUI raster parity. |
| tools/playsrc/profile/vgui-raster-parity.profile.ts | New headed parity profile that asserts identical pixels between shared raster and baseline. |
| tools/playsrc/profile/equipment.profile.ts | Updates equipment profiling assertions and strengthens Back/Escape navigation expectations. |
| tools/playsrc/profile/equipment-navigation.profile.ts | New headed navigation/profile capture for trusted input, CPU sampling, transactions, and lifecycle cases. |
| tools/playsrc/profile/equipment-navigation-analysis.ts | New analysis step to compute selection visibility latency from captured native references. |
| playwright.vgui-raster-parity.config.ts | New Playwright config for the raster parity headed profile. |
| playwright.equipment-navigation.config.ts | New Playwright config for the equipment navigation headed profile. |
| packages/presentation/vgui/tests/runtime.test.ts | Adds a regression test for Enter key handling vs default dialog buttons. |
| packages/presentation/vgui/tests/retained-raster.html | New browser fixture HTML for retained-raster parity checks. |
| packages/presentation/vgui/tests/retained-raster-browser-fixture.ts | Updates fixture instrumentation to track retained raster publishes via drawImage. |
| packages/presentation/vgui/tests/image-renderer.test.ts | Adds cache disposal semantics tests and bitmap sharing/lifecycle unit coverage. |
| packages/presentation/vgui/src/runtime.ts | Improves keyboard handling (repeat/press/release), focus ownership during replacement, and cancels held button presses on blur/hidden. |
| packages/presentation/vgui/src/image-renderer.ts | Introduces bitmap-backed raster sharing via cache entries and disposal hooks. |
| packages/presentation/vgui/scripts/verify-retained-raster-browser.ts | Switches verification script to run via the shared headed profile runner. |
| games/tf2/browser/tests/equipment-profile.test.ts | New tests for async equip cancellation, failure isolation, and replacement safety. |
| games/tf2/browser/tests/equipment-presentation.test.ts | Large expansion of navigation/focus/error tests for the equipment UI presentation layer. |
| games/tf2/browser/src/equipment/profile.ts | Adds abort-signal support to queued equipment mutations. |
| games/tf2/browser/src/equipment/presentation.ts | Implements async equip cancellation/ownership, restores keyboard navigation, and adds error reporting hooks. |
| apps/web/tf2/src/runtime.ts | Integrates new equip ownership/error callbacks, preserves focus across replacements, and refines admission lifecycle semantics. |
Review details
- Files reviewed: 19/19 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| this.#equipmentPreparing = false | ||
| if (!retained) await this.#client?.releaseResources(configuration.generation).catch(() => {}) | ||
| const release = [...(!retained ? [configuration.generation] : []), ...(replacedPanel && previous ? previous.sources : [])] | ||
| await Promise.all(release.map(source => client.releaseResources(source))) |
Hona
force-pushed
the
work/tf2-equipment-navigation-latency
branch
3 times, most recently
from
September 1, 2026 02:55
7ce567f to
192be2a
Compare
Hona
force-pushed
the
work/tf2-equipment-navigation-latency
branch
from
September 1, 2026 03:05
192be2a to
ff1747c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Validation
88fa198fba3fb85d46d4c95018254693fdc3af0aand configured UI resources.putImageData, plus 22.00 ms togetContextduring a roughly 5.5-second capture. These are attribution estimates, not a claimed end-to-end speedup.Existing reviewed evidence
Only client-area captures are attached; private desktop captures remain private.
Original canvas reference:

Shared bitmap result (byte-identical client capture):

Equipment navigation capture from the existing headed interaction run:

Measurement limits
This reuses the retained pixel and interaction evidence. There is no new matched Windows end-to-end latency/retention campaign, and the additional device fault-injection/map-lifecycle cases are not claimed as completed. Asynchronous error, cancellation and focus paths have focused regression coverage. The user approved completing this fix with those additional device measurements documented as limits rather than merge gates. No production or release changes are included.