Skip to content
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

Closed
wants to merge 12 commits into from

Conversation

BadMagic100
Copy link
Collaborator

@BadMagic100 BadMagic100 commented Aug 11, 2024

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:

  • Add a way to disable a world without using worlds_disabled. This allows any work on these worlds to be done more seamlessly without risking conflicts when worlds are enabled/disabled
  • Add a way to disable tests for and "soft disable" a world, causing it to be hidden and warn users when the world is used in generation. This would allow the world to be disabled in some way while still keeping it available for website users as long as it is not strictly broken
  • Document the process for soft disabling vs hard disabling a world
  • Use the new disabling mechanism for our 1 disabled world

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.

@github-actions github-actions bot added the affects: core Issues/PRs that touch core and may need additional validation. label Aug 11, 2024
@agilbert1412 agilbert1412 self-requested a review August 11, 2024 20:25
Copy link
Collaborator

@agilbert1412 agilbert1412 left a 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

@Exempt-Medic Exempt-Medic added the is: enhancement Issues requesting new features or pull requests implementing new features. label Aug 11, 2024
@BadMagic100
Copy link
Collaborator Author

Logging some early feedback from black sliver in discord

  1. He doesn't like the name of the enum/field (minor)
  2. Apparently pytest discovery will not play nice with these changes as written at this point in time

@BadMagic100 BadMagic100 changed the title [Core] Add World.visibility and improved mechanisms for world hiding/disabling [Core] Add World.status and improved mechanisms for world hiding/disabling Sep 15, 2024
@github-actions github-actions bot added the affects: webhost Issues/PRs that touch webhost and may need additional validation. label Sep 15, 2024
@BadMagic100 BadMagic100 removed the affects: webhost Issues/PRs that touch webhost and may need additional validation. label Sep 15, 2024
@BadMagic100 BadMagic100 marked this pull request as ready for review September 15, 2024 20:44
@BadMagic100 BadMagic100 added the waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. label Sep 15, 2024
@BadMagic100
Copy link
Collaborator Author

@agilbert1412 this is ready for review

Copy link
Collaborator

@agilbert1412 agilbert1412 left a 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
Copy link
Collaborator

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@BadMagic100
Copy link
Collaborator Author

BadMagic100 commented Sep 25, 2024

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)

Copy link
Collaborator

@qwint qwint left a 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\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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}, "
Copy link
Collaborator

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

@qwint
Copy link
Collaborator

qwint commented Oct 4, 2024

Also, the pytest handling seems to run before even pytest -h which is annoying but not end of the world

@Exempt-Medic Exempt-Medic added the waiting-on: author Issue/PR is waiting for feedback or changes from its author. label Nov 20, 2024
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space

Suggested change
f"which is currently considered to be unstable."
f"which is currently considered to be unstable. "

@Exempt-Medic
Copy link
Member

Exempt-Medic commented Nov 28, 2024

When using this I got "OriBlindForest Assigned options through option_definitions which is now deprecated. Please use options_dataclass instead." which seems unintended

@BadMagic100
Copy link
Collaborator Author

BadMagic100 commented Jan 15, 2025

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)

@BadMagic100 BadMagic100 reopened this Jan 15, 2025
@BadMagic100
Copy link
Collaborator Author

Also, the pytest handling seems to run before even pytest -h which is annoying but not end of the world

Unfortunately the pytest handling is not really my area of expertise, @Silvris any clue if this is avoidable?

@BadMagic100 BadMagic100 reopened this Jan 27, 2025
@BadMagic100
Copy link
Collaborator Author

When using this I got "OriBlindForest Assigned options through option_definitions which is now deprecated. Please use options_dataclass instead." which seems unintended

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 super().__new__

@BadMagic100
Copy link
Collaborator Author

Closing this. There is general alignment this is not the right solution to the problem.

@BadMagic100 BadMagic100 deleted the world_visibility branch January 28, 2025 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features. waiting-on: author Issue/PR is waiting for feedback or changes from its author. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants