Skip to content

feat(manage/games): cap to the max number of similar games to 6 per game ID#4978

Open
wescopeland wants to merge 5 commits into
RetroAchievements:masterfrom
wescopeland:similar-games-cap
Open

feat(manage/games): cap to the max number of similar games to 6 per game ID#4978
wescopeland wants to merge 5 commits into
RetroAchievements:masterfrom
wescopeland:similar-games-cap

Conversation

@wescopeland

Copy link
Copy Markdown
Member

https://discord.com/channels/310192285306454017/888607146290343976/1514281892562604092

This PR caps the max number of similar games at 6 per each game ID. The cap is bidirectional.

Screenshot 2026-06-11 at 6 11 02 PM Screenshot 2026-06-11 at 6 17 10 PM

@wescopeland wescopeland requested a review from a team June 11, 2026 22:18
@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

Safe to merge — cap logic is correct, validation runs before any writes, and the UI properly reflects the new constraint.

Cap validation is complete on both directions before the transaction opens, the exception is cleanly caught with a user-friendly message, and the button disable/tooltip state recalculates correctly on re-render.

No files require special attention.

Reviews (2): Last reviewed commit: "Merge branch 'master' into similar-games..." | Re-trigger Greptile

Comment thread app/Platform/Actions/LinkSimilarGamesAction.php
public readonly int $offendingGameId,
public readonly int $cap,
) {
parent::__construct("Game #{$offendingGameId} would exceed the {$cap}-similar-game cap.");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

App\Exceptions\SimilarGamesCapExceededException::__construct(): Argument #1 ($offendingGameId) must be of type int, string given, called in /var/www/html/app/Platform/Actions/LinkSimilarGamesAction.php on line 49

When trying to link a game by ID where the count would exceed.

Image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks, fixed in latest.

Notification::make()
->danger()
->title('Cap exceeded')
->body("Cannot add: {$title} would exceed the {$e->cap}-similar-game cap. Remove an entry first.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you try to add more games than would be supported (i.e. add 4 games to a list already containing 3), the error message that comes back is misleading:

Image

It seems to indicate that the "self" games cannot be added to itself.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated the copy when hitting this edge in latest:
Screenshot 2026-06-15 at 4 55 03 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants