Repository navigation
Refactor Xtense payload handling into modules - #64
Open
darknoon29 wants to merge 3 commits into
Open
darknoon29 wants to merge 3 commits into
darknoon29 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Missing alliance points can overwrite existing scores with zero, while non-array spy sections can leave updates incomplete and ranking callbacks lose the existing ally_name field.
3 open issues
What changed in this PR
This PR modularizes Xtense’s game-data ingestion, replacing the large endpoint switch with dedicated payload handlers while keeping request handling and the shared callback/response lifecycle in xtense.php.
Changes:
- Extracts 11 payload handlers, with message subtypes grouped in
MessageHandler. - Uses
AbstractHandlerhelpers for permissions, callbacks, logging, and responses. - Adds handler tests and updates combat-report assertions and database test doubles.
| File | Description |
|---|---|
xtense.php |
Replaces inline payload processing with handler dispatch. |
tests/unit/SpyDatabase.php |
Adds row-count and combat-object lookup responses. |
tests/unit/SimplePayloadHandlersTest.php |
Tests defense, fleet, and alliance-list handlers. |
tests/unit/MessageSubtypeHandlerTest.php |
Tests message subtypes and report persistence. |
tests/unit/MessageHandlerTest.php |
Tests personal messages, response overrides, and unknown types. |
tests/unit/CombatReportHandlerTest.php |
Targets main report inserts in SQL assertions. |
tests/bootstrap.php |
Adds report table constants and a booster stub. |
Handler/SystemHandler.php |
Encapsulates solar-system imports. |
Handler/ResourceSettingsHandler.php |
Encapsulates resource-setting updates. |
Handler/ResearchsHandler.php |
Encapsulates research updates. |
Handler/RankingHandler.php |
Handles player and alliance rankings with batched writes. |
Handler/OverviewHandler.php |
Handles player, universe, and planet overview updates. |
Handler/MessageHandler.php |
Groups message callbacks and report persistence. |
Handler/FleetHandler.php |
Handles fleet and production-unit updates. |
Handler/DefenseHandler.php |
Handles defense updates and callbacks. |
Handler/CombatReportHandler.php |
Separates combat-report, round, and fleet processing. |
Handler/BuildingsHandler.php |
Encapsulates building updates. |
Handler/AllyListHandler.php |
Builds alliance-list callbacks and responses. |
Review effort: Balanced
|
| with: | ||
| fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
| - name: Set up PHP with Xdebug | ||
| uses: shivammathur/setup-php@v2 |
This branch has not been deployed
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.






Summary
xtense.phpfrom 1,887 lines to a request/bootstrap/auth/dispatch/response entrypoint.Handler/; group message subtypes inMessageHandler.Validation
php vendor/bin/phpunit --display-warningspassed: 110 tests, 385 assertions, no skips or warnings.git diff --checkpassed.composer testuses Unix shell environment syntax and cannot run directly in PowerShell; PHPUnit was run directly instead.Database and upgrade impact
Dependencies and security