Consistently handle diverging branches, aligned with the correct team shareRoster methodology. #27
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.
Apologies for the spam. Initially I had made a major misunderstanding, forgotting how the shareRoster check works. However, there is still an issue of diverging branches being handled inconsistently. I had incorrectly assumed that this branch divergence could lead to points manipulation for a team. This is not the case, however this inconsistent branch divergence can lead to the stakes of a match seeing significant change retroactively, which can be quite confusing. As well as impacting the opponent in these changed matches.
Critical Path
Currently, below is how most cases are handled, with matches 1 through 11 sharing 3 players from when the team is initialised in matchId 11. The critical path of this roster is shown below:
However, the overlap for this team is very narrow. Certain conditions will cause the critical path to split, into the continuing critical path and a newly initiated team. As a new team has been initiated at the base points level, it will casue a retroactive impact on the point calculations for this match.
Condition A
One of these conditions is when the left hand branch, makes a change which will not overlap with the original roster.
This is correctly handled, as the overlap is no longer consistent. This will lead to changed stakes for all matches, particularly 6-11 as it is treated as a brand new team. This is an accurate case though as the core has changed, indicating where the current branch logic works succesfully.
Condition B
However, there is a variety of cases where a branch divergence incosistency can occur. For example, if a right hand side branch based mix attend a local LAN, they can inadvertantly diverge the branches as shown below:
This is because Match 12 is the first match in the reverse time order, initiating this team with an earlier index. Logically the rosterId branch should have followed from matchId 5 -> matchId 6. Unfortunately the current approach creates an accidental divergence due to each match accumulation prioritising the lower index team when two teams return a true shareRoster check. This will create an alternative branch compared to the earlier divergence.
Condition C
A very similar condition to this is as shown below, where the right hand side would have inherited the points from previous matches, offering their opponents for matches 3-5 a match of set stakes at the time of the match:
But then due to a later change, these matches will be treated as a newly initialised team, significantly lowering the stakes for those played matches:
Condition D
Similar to condition B where the lower index initiated team is prioritised, you can then inadvertantly get oscillations in the rankings. If there are two branches which do not share a common overlap, but they both share a common start point, you can have a situation where the lower index team at rankings generation will be prioritised every time the rankings are run.
i.e Initially
But then swaps to:
Occurrences
These cases are very specific, and will occur rarely. However, they can occur as shown by ATOX. ATOX has had a branch divergence after 2024-10-04, where 9 matches were played on the right hand side branch:
Right hand side branch after 2024-10-04
Instead of this divergence being dead-ended, condition C occurred where the branch was then re assigned as shown below:
Left hand side branch after 2024-10-04, re-claiming the divergence point
PR Changes & Conclusion
This Pull Request aims to remove these potential conditions, by having a consistent branch divergence logic occur which applies at the point of divergence, instead of being determined by team intialisation order. This is done by when a match is accumulated with multiple eligible rosterIds (a divergence point), the rosterId with the most recent match relative to the divergence is assigned. This will create a consistent logic, that wont rely on which core has the lower index on each rankings generation.
This consistent logic would hopefully make the process simpler, as well as helping eliminate cases where match stakes change retroactively due to a branch diverging.