Improve message reading API to prevent leakage#44
Merged
Conversation
YanzeJeremy
approved these changes
Jul 17, 2025
Contributor
YanzeJeremy
left a comment
There was a problem hiding this comment.
I have tested out these changes and the modifications look to me!
8144d83 to
966820a
Compare
This will make the refactoring in later commits easier.
`Game.messages` is unfiltered, which can cause accidental leakage. Using `Game.get_messages()` is safer.
These are general-purpose methods that are useful to have for any bot.
The logic was used 6 separate times throughout the repository!
The logic was used 5 separate times throughout the repository!
cb1ba89 to
7d0cc8e
Compare
Contributor
Author
|
I have merged #43, so this PR is ready to merge now! I will merge once CI passes. |
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.
I wrote most of these commits last month, but I haven't rushed to create a PR because no leakage was actually happening. However, I feel these API improvements will still be useful both for the bots in this repository and the bots in other repositories (which might be using leaked messages).
I tested this PR using
RandomProposerAdvisor,LrProbsTextVisualAdvisor, andFaafAdvisorwithout encountering any relevant issues. I also confirmed that no advice leakage was happening withFaafAdvisor.I have made this PR as a draft because it needs to be merged after #43, which brings in a
diplomacyupdate to provide a better message reading API.