This repository was archived by the owner on Jul 16, 2026. It is now read-only.
Repository navigation
Conversation
Unblocks CI for PRs that import discord-bridge.py in tests when DISCORD_BOT_TOKEN is not set in the CI environment. The exit(1) at module import time killed the entire test loop for any PR touching the bridge, silently dropping approved PRs (#60, #62, #52). The process should still exit when run directly (not imported), so the guard uses __name__ == "__main__" — the standard Python idiom.
bassilkhilo-ag2
approved these changes
Jun 5, 2026
bassilkhilo-ag2
left a comment
There was a problem hiding this comment.
Correct guard. exit(1) at import time breaks any test or script that does import discord-bridge (or importlib load) without DISCORD_BOT_TOKEN set. Wrapping in if __name__ == '__main__' is the standard Python pattern for import-safe exit guards. sys.exit preferred over bare exit in scripts — same effect here since sys is already imported. Approved.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
discord-bridge.pycallsexit(1)at module level whenDISCORD_BOT_TOKENis not set. Any process thatimports the module (test runner, type checker, or future skill that introspects the bridge) gets silently killed.exit(1)behindif __name__ == "__main__":so imports are safeexit(1)withsys.exit(1)for explicitnessTest plan
🤖 Generated with Claude Code