🔄 Refactor: VATSIM.net Webhook Processing (Improved Observability & Safety)#4545
Open
MrAdder wants to merge 9 commits intoVATSIM-UK:mainfrom
Open
🔄 Refactor: VATSIM.net Webhook Processing (Improved Observability & Safety)#4545MrAdder wants to merge 9 commits intoVATSIM-UK:mainfrom
MrAdder wants to merge 9 commits intoVATSIM-UK:mainfrom
Conversation
5 tasks
Contributor
Author
|
^ The Failing check is a Github issue not myself |
Contributor
Author
|
@AxonC or @kristiankunc I have tested this as best as possible however I do not have Webhook permissions with VatsimDev if one of you could test this that would be great. |
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.
This PR further refactors the VATSIM.net webhook pipeline to improve determinism, performance, logging, and internal structure while preserving existing behaviour.
🚀 Controller Improvements (
ProcessVatsimNetWebhook)✅ Deterministic Ordering
collect()->sortBy('timestamp')->values()to guarantee correct execution order.Bus::chain()to prevent race conditions between actions.🗺️ Centralised Action Resolution
ACTION_JOB_MAPconstant to replace theswitchstatement.createActionJob()resolver method.400 Bad RequestThis makes the system easier to extend with additional webhook actions.
📊 Improved Logging & Observability
resourceactions.lengthactions.typespreparation_ms) for lightweight performance insight.🧯 Graceful Empty Payload Handling
200 OK🔐 Security
validateAuth()now strictly typed (: void)🧩 New Trait:
InteractsWithMemberDeltasIntroduced reusable delta handling logic:
Features
getDeltaAfter(field)helperchangedFields()keyed map offield => afterThis removes duplicated delta parsing logic and reduces repeated collection operations.
👤
MemberChangedActionRefactorStructural Changes
InteractsWithMemberDeltastraitACCOUNT_FIELDSconstantprocessAccountChanges()processRatingChanges()processStateChange()Behaviour Improvements
Benefits
👶
MemberCreatedActionRefactorupdateOrCreatelogicresourceandaccount_idImproves readability and consistency with the update handler.
🧪 Test Coverage Improvements
Added:
test_unknown_action_returns_bad_request()to ensure invalid webhook actions return400.Existing tests validate:
🧼 Overall Outcome
This refactor delivers:
The webhook pipeline is now more maintainable, extensible, and production-observable while preserving existing functionality.