Skip to content

Fix 500 on fleet movement during moon destruction missions#1492

Open
tiweb442 wants to merge 2 commits into
lanedirt:mainfrom
tiweb442:fix/1446-fleet-movement-moon-destruction
Open

Fix 500 on fleet movement during moon destruction missions#1492
tiweb442 wants to merge 2 commits into
lanedirt:mainfrom
tiweb442:fix/1446-fleet-movement-moon-destruction

Conversation

@tiweb442

Copy link
Copy Markdown
Contributor

Summary

  • Add missing $friendlyStatus = Hostile to MoonDestructionMission
  • /fleet/movement calls GameMission::getFriendlyStatus() for every active mission; type 9 crashed with an uninitialized static property (PHP 8.2+)
  • The fleet event widget was unaffected because it uses ownership-based determineFriendly() instead

Fixes #1446

Test plan

  • ./vendor/bin/phpunit tests/Unit/MoonDestructionMissionTest.php --filter testFriendlyStatusIsHostile
  • ./vendor/bin/phpunit tests/Feature/FleetMovementTest.php --filter testFleetMovementShowsMoonDestructionMission
  • With an active moon destruction fleet, /fleet/movement returns 200 instead of 500

Made with Cursor

MoonDestructionMission was missing the static friendlyStatus property,
causing getFriendlyStatus() to throw when FleetController rendered
mission type 9 on /fleet/movement. Fixes lanedirt#1446

Co-authored-by: Cursor <cursoragent@cursor.com>
@tiweb442

Copy link
Copy Markdown
Contributor Author

Related PRs from tiweb442 (same deployment / review batch)

Issue PR
#1446 Fleet movement 500 during moon destruction #1492 (this)
#1472 Phalanx wrap-around #1491
#1395 Unban + vacation lock #1493
#1341 Destroyed moons break messages #1494
#1327 Email system #1375

Context: /fleet/movement calls GameMission::getFriendlyStatus() for every active mission. Mission type 9 (MoonDestructionMission) was missing $friendlyStatus, causing a PHP 8.2+ error while the fleet event widget (which uses determineFriendly() instead) kept working.

Merge order: Independent of #1491#1494 — no conflicts expected.

@tiweb442

Copy link
Copy Markdown
Contributor Author

Ready for maintainer review — preview is live and mergeable with main.

@lanedirt @jackbayliss Could you review when you have a moment? Fork PRs may also need “Approve and run workflows” so Pint / PHPStan / Docker tests run (currently only PR Preview has completed).

Test on preview: https://pr-1492.preview.ogamex.dev

@Geda173

Geda173 commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Hi @tiweb442,

thank you for your contribution(s). Please check out CONTRIBUTING.md, there is loads of (necessary) information there that should be taken into consideration when opening a PR.

Be advised that there is currently a wait time attached to getting PRs reviewed. The project's development speed has slowed down somewhat in the last few weeks and it may take some time until this gets a proper review.

@tiweb442

Copy link
Copy Markdown
Contributor Author

ok thx for the head up

The class defaults to transport (3), so the regression test was
dispatching the wrong mission and never asserted Moon Destruction.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tiweb442

Copy link
Copy Markdown
Contributor Author

CI fix pushed: the new fleet-movement regression test was still using the class default missionType = 3 (Transport). It now sets missionType = 9 (Moon Destruction) before dispatching.

@github-actions

Copy link
Copy Markdown

Preview deployment

Preview environment for this PR is ready for functional testing. Use one of the test accounts below to log in.

Status URL Commit Last deployed
✅ Live https://pr-1492.preview.ogamex.dev ea062f0 2026-07-19 22:48:26 UTC
Test accounts (click to expand)
Email (login) Password Role Class Planets Description
test1@ogamex.dev test admin Collector 2 Admin, high resources, mining focus
test2@ogamex.dev test player General 1 Military focus, ships & fleet
test3@ogamex.dev test player Discoverer 1 Exploration, probes & cargo ships
test4@ogamex.dev test player None 1 New player, no class selected yet
test5@ogamex.dev test moderator Collector 1 Moderator, balanced setup
test6@ogamex.dev test player General 1 Vacation mode enabled
test7@ogamex.dev test player General 3 Heavy defense across planets
test8@ogamex.dev test player Discoverer 1 Fleet focus, inactive (i) 8 days
test9@ogamex.dev test player Collector 1 Beginner, long inactive (I) 40 days
test10@ogamex.dev test player General 5 Endgame, 90 unread messages

This preview will be automatically destroyed when the PR is closed.

@Geda173 Geda173 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the fix by removing the added property and confirming both new tests fail with the exact must not be accessed before initialization error, then pass again once restored. Good regression coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 500 Server Error when you click on fleet movement when moon is being destroyed by deathstar

2 participants