bugfix(aiplayer): Improve initialization of uninitialized variable in AIPlayer::onUnitProduced - #3379
Conversation
… AIPlayer::onUnitProduced.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughFor Generals builds using MSVC earlier than 1300, spawn creation sets a flag around ChangesGenerals unit production
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The changes address legacy Generals unit initialization, with no concrete merge-blocking regression identified. No actionable merge-blocking risk remains beyond normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change is limited to legacy Generals unit production and does not appear to expose a new interface or weaken an access control. The shared callback flag has a narrow intended lifetime, though unusual nested execution remains a design consideration. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
|
Skyaero42
left a comment
There was a problem hiding this comment.
I remember testing the supplyTruck variable initialization was really finicky. Even adding a single logging line could change the outcome of a test.
@Mauller and I did a lot of testing and exploration and were keep getting issues. So we decided to be conservative. When Helmut introduced #820, we couldn't reproduce our earlier issues.
@Caball009 said that a lot of Generals replays were mismatching due to this and that the given PR resolves it.
supplyTruck is one of most sensitive uninitialized variables around there. If this solutions works as given, I would take it.
|
Replicated to Zero Hour. I think we got very lucky with how well we were able to initialize this, especially for Zero Hour. Skyaero and I will continue checking more Generals replays, so if it turns out with more replays that this fix is undesirable we'll have to readjust or revert it. |
|
Merge this now? |
Yes, as far as I'm concerned. |
#820 initialized a previously uninitialized variable
supplyTruckinAIPlayer::onUnitProduced. This was tested for Zero Hour and appears to work great there, but for Generals an unconditional initialization is inadequate. This PR aims to improve the initialization to fix the mismatches it causes with some replays.The 11 replays included in the issue mismatch with the current main branch, but play correctly again with the fix from this PR. I checked ~1000 Generals ai replays and did not see a mismatch introduced by this change.
TODO: