fix(team-randomizer): add safety improvements#417
Open
lbzepoqo wants to merge 2 commits into
Open
Conversation
fantinodavide
suggested changes
Apr 15, 2026
fantinodavide
left a comment
Contributor
There was a problem hiding this comment.
@lbzepoqo the plugin file itself looks good, but the pre-commit hook didn't run, which is a mandatory step for changes like this one.
lbzepoqo
commented
Apr 16, 2026
lbzepoqo
left a comment
Contributor
Author
There was a problem hiding this comment.
Pre-commit hook steps have now been applied: lint (ESLint + Prettier) reformatted team-randomizer.js, and yarn build-all regenerated README.md and config.json. Sorry for the oversight!
872d622 to
8f1c661
Compare
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
Several safety and UX issues in
TeamRandomizerthat affect production servers:defaultEnabledfromtruetofalse. This is a destructive, irreversible-during-round operation; it shouldn't be on without explicit opt-in.!randomizecalls from multiple admins would run simultaneously and clobber each other. Added athis.randomizingflag withtry/finallyto ensure it always resets even on error.switchTeamRCON call would abort mid-shuffle, leaving teams in a partially-randomized state. Now each switch is caught individually, logs the failure, and continues.AdminBroadcastbefore switching starts.warnon completion with the count of players switched.temporaryValuetemp variable; replaced with destructuring swap.Test plan
!randomizein admin chat — confirm broadcast fires, teams are shuffled, admin receives completion message!randomizetwice simultaneously — confirm second call is rejected with "already in progress" message