fix(platforms): stop platform variants from renaming the parent platform#3693
Merged
Merged
Conversation
get_supported_platforms built a slug->platform map with a plain dict comprehension. When a folder is mapped as a variant or alias of an existing platform, scanning resolves it to the parent slug, so two platform rows share the same slug. The comprehension let the later row (the variant) overwrite the parent, renaming it in the platform picker and Folder Mappings page. Prefer the canonical platform (fs_slug == slug) when building the map so a variant folder no longer shadows its parent. Fixes #3157 Generated-By: PostHog Code Task-Id: 571866ea-86a0-49c2-b62e-dbea077d0181
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a backend bug where platform variant / folder alias rows that share the parent platform’s slug could silently overwrite the canonical platform entry in get_supported_platforms(), causing the UI to display the variant’s name (e.g., “FBneo”) instead of the parent (“Arcade”).
Changes:
- Update
get_supported_platforms()to prefer the canonical platform row (fs_slug == slug) when multiple DB rows share the sameslug. - Add a regression test ensuring a variant row cannot shadow the parent platform’s display name.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| backend/utils/platforms.py | Builds the slug→platform map in a way that prevents variant/alias rows from overwriting the canonical platform entry. |
| backend/tests/utils/test_platforms.py | Regression test covering the “variant shadows parent” slug-collision case. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
Explain the changes or enhancements you are proposing with this pull request.
When a folder is mapped as a Platform Variant (or Folder Alias) of an existing platform, the scanner resolves that folder to the parent's slug. The database then holds two platform rows sharing the same
slug(e.g. the realarcadefolder and anfbneofolder both withslug="arcade").get_supported_platforms()built its slug→platform map with a plain dict comprehension:With two rows sharing a slug, whichever came last (platforms are ordered by name) silently overwrote the parent, so the platform picker and Folder Mappings page displayed the variant's name instead of the parent's. This is what caused Arcade to be "renamed" to FBneo, and the reported WiiWare/WiiVC case.
The fix prefers the canonical platform (the one whose
fs_slugmatches itsslug) when building the map, so a variant/alias folder can no longer shadow its parent.Note: variants remain their own platform row borrowing the parent's metadata, which is the documented intent of "Platform variant". This PR only fixes the naming collision.
Fixes #3157
Checklist
Please check all that apply.
Screenshots (if applicable)
N/A (backend-only change)
AI assistance disclosure
This change was written with AI assistance (PostHog Code). The AI performed the investigation, implemented the fix, and wrote the accompanying test; the change has been reviewed before submission.
Created with PostHog Code