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

BeatmapConverter does not clone hit objects if they are already concrete #30818

Open
frenzibyte opened this issue Nov 21, 2024 · 4 comments
Open
Labels
area:beatmap-parsing .osu file format parsing type:testing

Comments

@frenzibyte
Copy link
Member

Note that this issue only affects tests, but I'm opening it because it's totally not what I expect a BeatmapConverter to do.

This first came up in #30731 which adds a mod that modifies the states of the beatmap's hit objects, and as per #30731 (comment), a bug occurred in the mod's test scene wherein the beatmap is affected indefinitely, and running the test a second time applies the mod on the beatmap after the mod was already applied on it, and the test fails due to that.

This is happening because of this specific conditional in BeatmapConverter:

if (obj is T tObj)
{
result.Add(tObj);
continue;
}

Since the beatmap written in the tests had the hit object specs in their concrete types already (TaikoHitObjects), the beatmap converter was passing them verbatim to the "playable beatmap" where the mod is applied, rather than recreating each one of them.

This highlighted conditional above goes against the general expectations of BeatmapConverter, which is to produce a beatmap that is completely detached from the original one. #25467 may be related, but it's solving things at a completely higher scale, whereas this one seems to be easily applicable to the current codebase.

@frenzibyte frenzibyte added area:beatmap-parsing .osu file format parsing type:testing labels Nov 21, 2024
@frenzibyte
Copy link
Member Author

cc @ppy/team-client I guess since that's the main point of opening this issue, gathering feedback on whether the suggestion above makes sense or not.

@bdach
Copy link
Collaborator

bdach commented Nov 22, 2024

#25467 may be related, but it's solving things at a completely higher scale, whereas this one seems to be easily applicable to the current codebase.

It's really not. One does not just clone an arbitrary hitobject. You'd need at least a significant part of that pull.

I'm not really super willing to spend time thinking about this issue unless everyone else is.

@smoogipoo
Copy link
Contributor

Definitely not super important for now, I agree.

I'm not sure that I agree with the sentiment that BeatmapConverter is/should be the one responsible for detaching/cloning beatmaps. Maybe something to address in the future - imo the first step is to have new Beatmap(IBeatmap other) that copies things, along with non-realm models.

@frenzibyte
Copy link
Member Author

This is just meant in compliance with how the component works currently, which is literally cloning everything about the beatmap, so those lines I highlighted came across as extremely weird.

Either way I'll just leave this thread as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:beatmap-parsing .osu file format parsing type:testing
Projects
None yet
Development

No branches or pull requests

3 participants