-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core] Add World.status and improved mechanisms for world hiding/disabling #3775
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like what I'm seeing so far, but since the PR isn't complete, I'm not approving yet. Will look again later, don't hesitate to ping me if/when it's updated
Logging some early feedback from black sliver in discord
|
Pytest compatibility, new "warning" level
…get_testable_world_types for better future extensibility.
@agilbert1412 this is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one very small comment. Other than that, I like the way this has been implemented. A lot of the changes are the same thing over and over, which seems to suggest maybe some code duplication could be improved in these files, but definitely out of scope for this PR. Just keep an eye out, if you do make changes, that you might need to do it many times.
@@ -33,7 +33,7 @@ class ArchipIDLEWorld(World): | |||
""" | |||
game = "ArchipIDLE" | |||
topology_present = False | |||
hidden = (datetime.now().month != 4) # ArchipIDLE is only visible during April | |||
status = Status.enabled if (datetime.now().month == 4) else Status.hidden_enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still keep the comment explaining the April thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
status = Status.enabled if (datetime.now().month == 4) else Status.hidden_enabled | |
status = Status.enabled if (datetime.now().month == 4) else Status.hidden_enabled # Only visible during April |
Yeah, all the code duplication is there already and painful to adjust en masse. Not really sure if there would be a better way to deal with it, as it's all "iterate and subtest each testable world" and at the very least that code duplication will always be there in every relevant test even if we did something like introduce a decorator that does it automatically (which is actually not a half-bad idea tbh but is definitely out of scope and would not prevent a similar problem in the future) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed wording changes in docs files,
tested generating with a broken but soft_disabled world to see the warning
tested pytest with a broken world using all enum values, seeing the failures on enabled and hidden, and not seeing test failures on the two disabled versions
retested with unittest to see the same results
Didn't extensively review the code changes but did skim for any glaring issues
Didn't test hidden feature on webhost (although that seems mostly untouched, just set differently)
The one big issue I saw was:
Disabled worlds don't get considered in the Exception: No world found to handle game . . .
error message, there should probably be a unique error message if a world in generation is disabled noting that.
|
||
In the case that an unmaintained world is completely broken, the world can be marked as disabled. For each disabled | ||
world, a README file can be found detailing when the world was disabled and the reasons that it was disabled. In order | ||
to be considered for reactivation, these concerns should be handled at a bare minimum. However, each world may have\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be considered for reactivation, these concerns should be handled at a bare minimum. However, each world may have\ | |
to be considered for reactivation, these concerns should be handled at a bare minimum. However, each world may have |
looked like a typo, and on the resolved markdown just puts a random newline in the paragraph
@@ -228,6 +228,10 @@ def set_options(self, args: Namespace) -> None: | |||
|
|||
for player in self.player_ids: | |||
world_type = AutoWorld.AutoWorldRegister.world_types[self.game[player]] | |||
if world_type.status == AutoWorld.Status.soft_disabled: | |||
logging.warning(f"Player {player} is playing {world_type.game}, " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may be confusing as slot number instead of slot name
since it will trigger for every slot playing that game i'm not that worried about it, but it could make tracking down people's yamls in a submitted multi harder
Also, the pytest handling seems to run before even |
When a world becomes unmaintained, it can stay enabled as long as it is not breaking. At the discretion of the core | ||
maintainers, unmaintained worlds may also have their tests disabled at which point they will be marked as hidden | ||
and a warning will be provided when players try to generate with that world. This provides the core maintainers | ||
a mechanism to "soft disable" a world in order to allow core changes/tests to be merge which would not strictly break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a mechanism to "soft disable" a world in order to allow core changes/tests to be merge which would not strictly break | |
a mechanism to "soft disable" a world in order to allow core changes/tests to be merged which would not strictly break |
@@ -228,6 +228,10 @@ def set_options(self, args: Namespace) -> None: | |||
|
|||
for player in self.player_ids: | |||
world_type = AutoWorld.AutoWorldRegister.world_types[self.game[player]] | |||
if world_type.status == AutoWorld.Status.soft_disabled: | |||
logging.warning(f"Player {player} is playing {world_type.game}, " | |||
f"which is currently considered to be unstable." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space
f"which is currently considered to be unstable." | |
f"which is currently considered to be unstable. " |
When using this I got "OriBlindForest Assigned options through option_definitions which is now deprecated. Please use options_dataclass instead." which seems unintended |
That does seem unintentional, I guess the classvar assignments would still get to happen for disabled worlds in this scheme (don't mind the closing and opening my mobile keyboard was too close to close with comment) |
Unfortunately the pytest handling is not really my area of expertise, @Silvris any clue if this is avoidable? |
After some research I believe the fix here is to just check the attr early and return None, short circuiting past any other logic which may or may not happen including during |
Closing this. There is general alignment this is not the right solution to the problem. |
What is this fixing or adding?
Adds improvements to hiding/disabling worlds via a Status enum for worlds, rather than just using world.hidden
The goals of this PR are as follows:
Having the webhost surface the warning to website users is currently being considered out of scope for this change. In the future we should likely consider this before actually soft-disabling worlds.
If there is anything we should be doing in setup.py around worlds_disabled (there is a reference to it there) I'm not sure what.
How was this tested?
Tested that ori does not load/run tests and that hidden worlds are still hidden to the website. Ran the entire test suite in both pycharm and pytest with xdist.