Lichess4545/Chesster

Chesster recording old results, unsure if bug in chesster or heltour

lakinwecker opened this issue · 2 comments

Relevant logs:

info: [Watcher] lonewolf: Received game details: {"id":"seIP2jPB","rated":true,"variant":"standard","speed":"classical","perf":"classical","createdAt":1549037206372,"status":20,"players":{"white":{"userId":"nsmiller7","rating":1833},"black":{"userId":"rodrigodiazdevivar","rating":1711}},"clock":{"initial":1800,"increment":30,"totalTime":3000}}
info: ** API CALL: https://slack.com/api/chat.postMessage
info: [Watcher] lonewolf: Validation result: {"valid":true,"pairing":{"league":"lonewolf","season":"13","round":7,"white":"nsmiller7","white_rating":1833,"black":"RodrigoDiazDeVivar","black_rating":1711,"game_link":"https://en.lichess.org/RyroBAlG","result":"1/2-1/2","datetime":"2019-02-01T16:00:00.000Z","date":"2019-02-01T16:00:00.000Z","url":"https://en.lichess.org/RyroBAlG"},"pairingWasNotFound":false,"colorsAreReversed":false,"gameIsUnrated":false,"timeControlIsIncorrect":false,"variantIsIncorrect":false,"gameOutsideOfCurrentRound":false,"claimVictoryNotAllowed":false,"cheatDetected":false,"reason":""}

We are receiving the game from Lila here: https://github.com/endrawes0/Chesster/blob/master/src/watcher.js#L194-L200 the seIP2jPB game is correct.

We are validating the game here: https://github.com/endrawes0/Chesster/blob/master/src/watcher.js#L64-L65

By the time line 65 runs, the game id is incorrect and reads RyroBAlG which is an old game.

The head call here: https://github.com/endrawes0/Chesster/blob/master/src/commands/games.js#L285-L286 looks suspicious. We are asking the league for matching pairings, but only taking the first one.

However, the find pairing call https://github.com/endrawes0/Chesster/blob/master/src/league.js#L215-L237 should only return valid pairings for this league for the current round. Which should only ever be a single pairing.

So somewhere, we are getting multiple pairings. Either heltour is returning the wrong data when we refresh the pairings, or chesster isn't properly clearing the pairings when refreshing. However, refreshing the pairings https://github.com/endrawes0/Chesster/blob/master/src/league.js#L192-L213 we are only ever setting the _pairings property outright.

Perhaps the heltour.getAllPairings method is actually returning ALL pairings for the league for all time and not the current round?

From my very quick reading of this method: https://github.com/cyanfish/heltour/blob/master/heltour/tournament/api.py#L26-L57

It should only be returning active rounds.

I doubt I'll be able to reproduce this.