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

Fix online attribute flag in score performance command not retrieving full difficulty attributes #204

Merged

Conversation

bdach
Copy link
Contributor

@bdach bdach commented Apr 29, 2024

Found when investigating ppy/osu#28006.

If the performance score command is given the -a flag, it is supposed to use the current online beatmap difficulty attributes. It does so by querying API, which queries osu-beatmap-difficulty-cache.

Problem is, that some of the difficulty attributes, namely the ones that are already present on APIBeatmap, are not serialised out by osu-beatmap-difficulty-cache.

osu-tools is blissfully unaware of this, and as such attempts to deserialise the difficulty attributes returned from cache-then-web raw, which leads to it just using the default values (e.g. zeroes) for attributes that the difficulty lookup cache does not serialise out. This leads to obviously bogus results.

To fix, retrieve the APIBeatmap manually and do some (admittedly gnarly) grafting in order to produce a fully populated object. It's a bit ugly but it works locally without further changes so maybe fine?

The alternative would be to fix this on the beatmap difficulty cache, I guess. That said it's not like the cache/API returns these fields wrong either, it does correctly omit them, which is why I'm trying this first.

… full difficulty attributes

Found when investigating ppy/osu#28006.

If the `performance score` command is given the `-a` flag, it is
supposed to use the current online beatmap difficulty attributes. It
does so by querying API, which queries `osu-beatmap-difficulty-cache`.

Problem is, that some of the difficulty attributes, namely the ones that
are already present on `APIBeatmap`, are not serialised out by
`osu-beatmap-difficulty-cache`:

	https://github.com/ppy/osu-beatmap-difficulty-lookup-cache/blob/db2203368221109803f2031788da31deb94e0f11/BeatmapDifficultyLookupCache/DifficultyCache.cs#L125-L128

`osu-tools` is blissfully unaware of this, and as such attempts to
deserialise the difficulty attributes returned from cache-then-web raw,
which leads to it just using the default values (e.g. zeroes) for
attributes that the difficulty lookup cache does not serialise out. This
leads to obviously bogus results.

To fix, retrieve the `APIBeatmap` manually and do some (admittedly
gnarly) grafting in order to produce a fully populated object. It's a
bit ugly but it works locally without further changes so maybe fine?
Copy link
Member

@peppy peppy left a comment

Choose a reason for hiding this comment

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

Seems okay if we want to avoid serialising these in osu-beatmap-difficulty-cache. Probably best until there's another usage of them.

@peppy peppy requested a review from smoogipoo April 30, 2024 07:30
@smoogipoo smoogipoo merged commit 25ca400 into ppy:master Apr 30, 2024
3 checks passed
@bdach bdach deleted the fix-broken-online-difficulty-attribute-lookup branch May 1, 2024 04:49
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.

3 participants