[Bug] ACS Defend destroyed fleet stays in host widget after hold expires #1321#1383
[Bug] ACS Defend destroyed fleet stays in host widget after hold expires #1321#1383piciolo wants to merge 2 commits into
Conversation
Deployed on tiweb442 production pending mergeApplied the same one-line query simplification ( Related tiweb442 PRs in the same batch: #1491, #1492, #1494. Email: #1375 (production-tested — comment). Looks good to merge when maintainers have bandwidth — CI was green on last run. |
Geda173
left a comment
There was a problem hiding this comment.
Hi @piciolo,
Sorry for the long wait time. I am slowly clearing the backlog of submitted PRs.
I have looked at the work and the fix is correct, but it needs the test the checklist says is here.
Two things before this can merge:
- There's no test, though the checklist marks "I have added tests" as done. The diff is just the one-line query change. I verified the gap by restoring the old buggy query and running the ACS Defend, Attack, and MultiDefenderBattle suites. All 61 tests still pass. So nothing currently guards this behavior, and since this touches a query shared by every mission type in the fleet widget, a future change could silently bring the bug back.
Could you add a regression test along these lines?
- Dispatch an ACS Defend fleet with a hold time
- Destroy it in battle during hold
- Advance time past
time_arrival(hold end) - Assert
getActiveFleetMissionsForCurrentPlayer()does not return the destroyed mission (and ideally assert a normal, non-destroyed ACS Defend fleet is still returned during hold, to lock in both sides)
- This branch is ~4 months old, mind rebasing on
mainso CI runs against current checks (note phpstan is now level 8) before we merge.
…t after hold expires When an ACS Defend fleet was completely destroyed during hold time, AttackMission set processed=1 immediately. The stale orWhere fallback in getActiveFleetMissionsForCurrentPlayer() would then re-include the destroyed mission once time_arrival passed, causing it to appear stuck in the host's fleet widget until time_arrival + time_holding elapsed. Removed the fallback entirely: processArrival() now runs at time_arrival (hold end) while processed=0, so the outbound is visible throughout hold normally. The only early processed=1 case is battle destruction, where the mission must disappear immediately. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…idget (lanedirt#1321) Add regression tests in FleetDispatchMultiDefenderBattleTest covering the query change in getActiveFleetMissionsForCurrentPlayer(): - testDestroyedAcsDefendMissionNotReturnedByActiveFleetMissionsAfterHoldExpires: dispatch an ACS Defend fleet with hold, destroy it in battle during hold, advance past time_arrival (hold end) and assert the destroyed mission is NOT returned by getActiveFleetMissionsForCurrentPlayer(). Fails against the old query (which re-included processed=1 ACS Defend outbound missions in the [time_arrival, time_arrival+time_holding) window), passes with the processed=0 fix. - testHoldingAcsDefendMissionReturnedByActiveFleetMissionsDuringHold: assert a normal (non-destroyed, processed=0) ACS Defend fleet is still returned during hold, locking in both sides of the behavior.
4f4ed68 to
86402ca
Compare
Preview deploymentPreview environment for this PR is ready for functional testing. Use one of the test accounts below to log in.
Test accounts (click to expand)
This preview will be automatically destroyed when the PR is closed. |
Hi thanks for the review — both points are addressed. 1. Regression test Added two tests in
Why it guards the fix: a fleet destroyed in battle is marked 2. Rebase Rebased onto the current |
Description
When an ACS Defend fleet was completely destroyed in battle during its hold time, the fleet mission would disappear from the host's widget immediately after the battle — but then reappear and stay stuck in the widget once the original
time_arrival(hold end time) was reached, remaining there for another fulltime_holdingduration before finally clearing.Root Cause
getActiveFleetMissionsForCurrentPlayer()contained a legacyorWherefallback that re-included ACS Defend outbound missions withprocessed=1in the windowtime_arrival <= now < time_arrival + time_holding.When
AttackMissiondestroys an ACS Defend fleet it setsprocessed=1immediately (beforetime_arrival). Oncetime_arrivalpassed, the fallback conditiontime_arrival <= nowbecametrueand the destroyed mission was re-included as "active".checkEvents(called when the hold-end countdown expired) then found the mission as active and refused to remove the DOM rows, leaving them stuck.Fix
Removed the stale
orWherefallback fromgetActiveFleetMissionsForCurrentPlayer(). The query now simply filtersprocessed = 0.This is safe because with the current architecture
processArrival()fires attime_arrival(hold end) whileprocessed=0throughout hold — so the outbound is visible normally during travel and hold. The only timeprocessed=1is set beforetime_arrivalis battle destruction, where the mission must disappear immediately.Type of Change:
Related Issues
Fixes #1321
Checklist:
php artisan test— 1041 passed)