Skip to content

Core: inherit option aliases in subclasses#6272

Open
patrickwehbe wants to merge 1 commit into
ArchipelagoMW:mainfrom
patrickwehbe:fix/itemsaccessibility-aliases
Open

Core: inherit option aliases in subclasses#6272
patrickwehbe wants to merge 1 commit into
ArchipelagoMW:mainfrom
patrickwehbe:fix/itemsaccessibility-aliases

Conversation

@patrickwehbe

@patrickwehbe patrickwehbe commented Jun 19, 2026

Copy link
Copy Markdown

What is this fixing or adding?

AssembleOptions.__new__ rebuilt each option class's aliases dict from only that class's own alias_* attributes, even though options and name_lookup are merged from the base classes. So any subclass of a concrete option silently dropped its inherited aliases — e.g. ItemsAccessibility.aliases was {}, so the documented none/locations aliases were missing from the alias mapping.

This addresses the root cause (option 1 from #5124) instead of hardcoding the aliases on ItemsAccessibility: aliases are now merged from the base classes as well, and any inherited alias whose name the subclass redefines as a real option is dropped (so ItemsAccessibility's items option wins over Accessibility's items alias). options is unchanged, so option resolution via from_text is unaffected — only the .aliases mapping is corrected. This fixes every subclassed option, not just ItemsAccessibility.

Fixes #5124.

How was this tested?

Rewrote test_subclassed_choice_inherits_aliases in test/general/test_options.py:

  • ItemsAccessibility.aliases == {"none": 2, "locations": 0} (the exact expected result from Bug: The ItemsAccessibility option has no aliases set #5124), Accessibility.aliases is unchanged, and none/locations still resolve via from_text.
  • A synthetic Choice subclass hierarchy proves the mechanism is general: a plain subclass inherits all parent aliases, and a subclass that redefines an inherited alias name as a real option drops that alias (the option wins).

pytest test/general/test_options.py test/webhost/test_option_presets.py → all pass (12 tests / 14202 subtests), confirming no world's options regress now that aliases are inherited.

@github-actions github-actions Bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Jun 19, 2026
@Mysteryem

Copy link
Copy Markdown
Contributor

Personally, this is not a proper fix for the issue because this is a band-aid/hardcoded fix for only ItemsAccessibility, so any other subclassed option would still have the same issues that ItemsAccessibiltiy currently has. A hardcoded fix like this increases technical debt instead of addressing and fixing the underlying issue.

`AssembleOptions.__new__` rebuilt each class's `aliases` from only that class's own
`alias_*` attributes, while `options`/`name_lookup` were merged from the base classes.
Subclasses therefore silently dropped inherited aliases -- e.g. `ItemsAccessibility.aliases`
was `{}`, so the documented `none`/`locations` aliases were missing from the mapping.

Merge aliases from the base classes too, and drop any inherited alias whose name the subclass
redefines as a real option (so `ItemsAccessibility`'s `items` option wins over `Accessibility`'s
`items` alias). `options` is unchanged, so option resolution via `from_text` is unaffected.

Fixes ArchipelagoMW#5124.
@patrickwehbe patrickwehbe force-pushed the fix/itemsaccessibility-aliases branch from 184a23f to ec03a88 Compare June 19, 2026 11:30
@patrickwehbe patrickwehbe changed the title Core: keep none/locations aliases on ItemsAccessibility Core: inherit option aliases in subclasses Jun 19, 2026
@patrickwehbe

Copy link
Copy Markdown
Author

Good call, thanks — reworked to fix the root cause (option 1 in #5124) instead of hardcoding the aliases on ItemsAccessibility.

AssembleOptions.__new__ now merges aliases from the base classes the same way it already merges options/name_lookup, and drops any inherited alias whose name the subclass redefines as a real option (so ItemsAccessibility's items option wins over Accessibility's items alias). This now fixes every subclassed option, not just ItemsAccessibility. options is unchanged, so from_text resolution is unaffected.

ItemsAccessibility.aliases is now {"none": 2, "locations": 0}, matching the expected result in the issue. The test is rewritten to cover the general mechanism (a synthetic subclass hierarchy) alongside the concrete ItemsAccessibility case.

@Mysteryem

Copy link
Copy Markdown
Contributor

Oh, this is all just AI slop isn't it? great

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. 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.

Bug: The ItemsAccessibility option has no aliases set

2 participants