Open cgolubi1 opened 1 month ago
According to the database, the game is in state 46, aka CHOOSE_TURBO_SWING
. So that explains why it's stuck --- a game shouldn't be able to get into that state and the UI can't deal with it --- but not how it got there.
The matchup is Boot2daHead (d(1) Gz(Z) !p(V) !n(Y,Y) oF(C)
) vs Aysez (s(U) z(U) %(U) n(U) g(U) t(U)
).
According to the action log, the last thing that happened was a skill attack in which [d(1):1, p(V=7)!:6, n(Y=4,Y=4)!:3]
attacked %(U=30):13
.
The attack was fire-assisted by oF(C)
, which was turned down from 5 to 2.
That should all be fine. We've played lots of replay games with Boot2daHead over time; i guess it's possible that none of those games has ever tried a fire-assisted attack where both turbo dice participate in the attack, but that strikes me as unlikely.
Hmm. What is this though:
mysql> select * from game_turbo_cache where game_id=103527;
+---------+---------+------------+
| game_id | die_idx | turbo_size |
+---------+---------+------------+
| 103527 | 2 | 127 |
| 103527 | 3 | 20 |
+---------+---------+------------+
2 rows in set (0.02 sec)
I don't know much about how this cache is used, but that first row doesn't look good.
Okay, i got it. I reproduced this in https://2928-mysql-80.cgolubi1.dev.buttonweavers.com/ui/game.html?game=262 --- it looks like when you enter turbo values during an attack that needs firing, those values aren't checked against the valid bounds. So i typed V=127 into the turbo box, submitted the skill attack, turned down fire dice, and here we are.
(I can do that again and get screencaps if it's not completely obvious what i'm talking about, but hopefully it is.)
That's the bug: the skill attack should have been rejected because the turbo selections submitted with that attack were invalid. Never mind that they're going into the cache and not being applied immediately, they should have been checked and rejected.
It looks like unsticking the game may not be trivial:
mysql> select * from game_turbo_cache where game_id=262 and die_idx=2;
+---------+---------+------------+
| game_id | die_idx | turbo_size |
+---------+---------+------------+
| 262 | 2 | 127 |
+---------+---------+------------+
1 row in set (0.00 sec)
mysql> update game_turbo_cache set turbo_size=7 where game_id=262 and die_idx=2;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from game_turbo_cache where game_id=262 and die_idx=2;
+---------+---------+------------+
| game_id | die_idx | turbo_size |
+---------+---------+------------+
| 262 | 2 | 7 |
+---------+---------+------------+
1 row in set (0.00 sec)
But the game is still stuck as before, because nothing tells it to retry applying those turbo values.
At this point it would be good if you could delete the game. I can’t use the Next Game function while it’s still around. Thanks!
Sorry about that, randomlife! Let me snag this; i should be able to test and execute a quick database change to move the game to BROKEN this evening.
Okay, so i reproduced the broken state on staging, and then set the game's status_id to BROKEN
:
mysql> select * from game_status;
+----+-----------+
| id | name |
+----+-----------+
| 1 | OPEN |
| 2 | ACTIVE |
| 3 | COMPLETE |
| 4 | CANCELLED |
| 5 | BROKEN |
| 6 | NEW |
+----+-----------+
6 rows in set (0.00 sec)
mysql> update game set status_id=5 where id=530;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from game where status_id=5;
+-----+---------------------+---------------------+-----------+------------+-----------+--------------+----------------------+---------------+----------------+-----------------+------------+-------------------+----------------+---------------+-------------+------+------------------+
| id | start_time | last_action_time | status_id | game_state | n_players | round_number | turn_number_in_round | n_target_wins | n_recent_draws | n_recent_passes | creator_id | current_player_id | last_winner_id | tournament_id | description | chat | previous_game_id |
+-----+---------------------+---------------------+-----------+------------+-----------+--------------+----------------------+---------------+----------------+-----------------+------------+-------------------+----------------+---------------+-------------+------+------------------+
| 530 | 2024-07-30 22:58:08 | 2024-07-30 23:00:14 | 5 | 46 | 2 | 1 | 2 | 3 | 0 | 0 | 1 | 37 | NULL | NULL | | NULL | NULL |
+-----+---------------------+---------------------+-----------+------------+-----------+--------------+----------------------+---------------+----------------+-----------------+------------+-------------------+----------------+---------------+-------------+------+------------------+
1 row in set (0.00 sec)
mysql>
Now i can browse to the game directly - https://staging.buttonweavers.com/ui/game.html?game=530 - and it says "can't figure out what action to take next", but it no longer shows up on my active games tab, and the "Next pending game" tab works again.
Same thing on prod:
mysql> select * from game_status;
+----+-----------+
| id | name |
+----+-----------+
| 1 | OPEN |
| 2 | ACTIVE |
| 3 | COMPLETE |
| 4 | CANCELLED |
| 5 | BROKEN |
| 6 | NEW |
+----+-----------+
6 rows in set (0.00 sec)
mysql> update game set status_id=5 where id=103527;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
randomlife, that should unblock you from using your "Next game" button. And we can always move the game back out of BROKEN
if we come up with a fix.
I put up a PR to fix the root cause. That doesn't unstick this particular game, and i don't think i have the cycles or a brilliant idea about how to easily do that, so i'm going to unassign this from myself.
https://www.buttonweavers.com/ui/game.html?game=103527 shows: "Can't figure out what action to take next"