thewca / wca-live

Platform for running WCA competitions and sharing live results with the world
https://live.worldcubeassociation.org
70 stars 23 forks source link

Results are marked as records unexpectedly #145

Closed jonatanklosko closed 2 weeks ago

jonatanklosko commented 1 year ago

Happened here and here, I re-submitted results form to recompute records, and it's been corrected.

In both cases competitors had an NR (one in single, one in average), even though those results were much slower than the actual NR, and there were multiple competitors from the same country with better results in those rounds.

jonatanklosko commented 1 year ago

This is very confusing given that there are other better results in the round. The record tags for all results are recomputed when a new result is entered (since it may potentially overturn a record), so it means that NR for the particular competitor was consistently computed as other results were entered.

The only case I could think of so far is if the competitors had a wrong country and it changed after sync. However, in one of the examples the competitor already had a WCA ID, so I don't think that was the case.

On a side note, it haven't really popped up before as far as I know, so it's likely a very specific edge case.

JonEsparaz commented 1 year ago

It looks like both examples are gone now (likely because the Delegates synced before results submission).

However, in one of the examples the competitor already had a WCA ID, so I don't think that was the case.

Could've been a 2e2 country change if it was their first competition of the year.

jonatanklosko commented 1 year ago

It looks like both examples are gone now

I re-submitted the results, both to see that records are recomputed as expected and to correct them :)

The relevant competitors were: one, two.

Could've been a 2e2 country change if it was their first competition of the year.

I thought that too, but doesn't seem to be the case. The alternative option would be if they registered with account not linked to the WCA ID and wrong country, only later connected. But that's an absurdly unlikely scenario :D

jonatanklosko commented 2 months ago

Another possibly related case is described in #218. Basically everyone in 6x6 and 7x7 Round 1 got PR for their single, but not average. Resubmitting the first result recomputed everything as expected.

jonatanklosko commented 2 months ago

Another WR false-positive #220, there is clearly something wrong, interestingly it seems to have intensified recently. I plan to have a closer look soon.

jonatanklosko commented 2 months ago

I believe the underlying issue has to do with the WCA API returning incomplete records. It is a race condition where WCA Live would fetch regional records while ranks are being recomputed in the WCA database. I opened https://github.com/thewca/worldcubeassociation.org/issues/9569 to track this.

It explains why a false-positive record would be computed consistently while entering the results, but re-submitting the result later would correctly update the tag. That's because the regional records are re-fetched after an hour.

It also explains the case with everyone getting average PR. The competition must've been synchronized while CAD was running, so there was no personal best data. Resubmitting the result later computed correctly, because the competition was synchronized again, with personal bests in place.

I'm going to keep this issue open as a reference, until it's fixed on the main site.

dunkOnIT commented 2 weeks ago

Some more evidence for this issue:

jonatanklosko commented 2 weeks ago

@dunkOnIT I've just resubmitted the 2x2 WR and the tag is gone. As described above, the root problem is on the main website side, though its origin is still a bit confusing.

dunkOnIT commented 2 weeks ago

Ah that's interesting! I did do a sync after posting that comment - is it perhaps necessary to do the following:

jonatanklosko commented 2 weeks ago

It depends on which tags are wrong. For regional records you need to wait for <= hour, since WCA Live fetches the records hourly. For personal records you need to sync (since personal bests are taken from WCIF). In both cases the data relies on tables recreated during CAD.

dunkOnIT commented 2 weeks ago

Suggestion from Manu Vereecken, which would lessen the severity of this:

Might be possible to fix on wca live's side by not storing a WR that is worse than the currently stored WR?

If we implemented this for WR and CR, that would drastically lower the severity of this issue. I think a fix to try and make the CAD job transactional could come in the next 2 weeks - 1 month, which I would assume is the ultimate solution here

jonatanklosko commented 2 weeks ago

@dunkOnIT that should work as a workaround yeah, but since you are already exploring the CAD fix I think it's fine to wait :)

jonatanklosko commented 2 weeks ago

This should now be fixed upstream :)