15 Commits
Author SHA1 Message Date
woggioni 3da0c463de Merge branch 'backup' into opencode
# Conflicts:
#	server/src/tavolo/app.py
2026-09-18 11:00:52 +00:00
woggioni 26464bce43 Configure CORS headers from environment variables 2026-09-18 08:41:03 +00:00
woggioni 8a2941eccc updated Docker builder 2026-09-18 13:55:11 +08:00
woggioni 57c6ffb032 Reconnect the game websocket after connectivity loss
CI / Build and push docker image (push) Successful in 2m59s
The socket had no recovery path: a mid-game drop left the table showing
stale state with no indication, and plays were silently swallowed by the
dead channel. Surface the server close code from ws::connect and add a
reconnect driver in the game page: transient losses retry with
exponential backoff (capped, then a manual Retry), while deliberate
closes (session expired, game gone) stop retrying. Reconnects are free
resyncs because the server pushes a full state snapshot on connect.

Also gate card clicks while disconnected, show a connection banner, and
drop the ticking interval and pending retries on unmount.
2026-09-18 13:48:34 +08:00
woggioni c10d45523a Fix deadline consumer startup under granian RSGI
The mixin received the event loop from Kaya but ignored it, calling
asyncio.get_running_loop() instead. Under granian RSGI __rsgi_init__ runs
before the loop starts, so that raised RuntimeError and killed the
worker. Use the loop passed to setup(), falling back to the running loop
for the lazy calls from sync_deadline().
2026-09-18 13:48:34 +08:00
woggioni bbd12ce674 Reconnect the game websocket after connectivity loss
The socket had no recovery path: a mid-game drop left the table showing
stale state with no indication, and plays were silently swallowed by the
dead channel. Surface the server close code from ws::connect and add a
reconnect driver in the game page: transient losses retry with
exponential backoff (capped, then a manual Retry), while deliberate
closes (session expired, game gone) stop retrying. Reconnects are free
resyncs because the server pushes a full state snapshot on connect.

Also gate card clicks while disconnected, show a connection banner, and
drop the ticking interval and pending retries on unmount.
2026-09-18 05:47:35 +00:00
woggioni c40ebd84d8 Fix deadline consumer startup under granian RSGI
The mixin received the event loop from Kaya but ignored it, calling
asyncio.get_running_loop() instead. Under granian RSGI __rsgi_init__ runs
before the loop starts, so that raised RuntimeError and killed the
worker. Use the loop passed to setup(), falling back to the running loop
for the lazy calls from sync_deadline().
2026-09-18 02:33:00 +00:00
woggioni 658e3d6ec7 Show own captured and scopa counts in game view
CI / Build and push docker image (push) Successful in 2m46s
2026-09-18 09:18:18 +08:00
woggioni 5e4e1310b4 Drive timeouts from a shared Redis deadline queue
Turn auto-play and hand-end auto-continue were process-local asyncio
tasks armed only by client connects and state broadcasts: with no
sockets connected the next turn's timer was never armed, a hand-end
timer died with its worker, and neither survived a pod restart.

Deadlines are now driven by the absolute timestamps persisted on the
game state and enqueued in a shared Redis sorted set. Every worker runs
a consumer that fires due entries under the per-game lock after
revalidating them against the live state, so timeouts no longer depend
on any player being connected and survive the death of any worker.
Delivery is at-least-once: entries are removed only after processing,
and revalidation makes duplicate deliveries no-ops.

Queue entries carry the deadline as integer epoch milliseconds, which
also serves as the revalidation token, and the score derives from the
same value.
2026-09-18 09:18:17 +08:00
woggioni db7ba30d13 Add configurable napola rule with instant win on a full denari sweep 2026-09-18 09:18:17 +08:00
woggioni f7fa8e78e5 Auto-dismiss error toasts after 10 seconds 2026-09-18 09:18:17 +08:00
woggioni 5b9e998739 Show own captured and scopa counts in game view 2026-09-18 01:17:26 +00:00
woggioni 5dc3f4cb17 Drive timeouts from a shared Redis deadline queue
Turn auto-play and hand-end auto-continue were process-local asyncio
tasks armed only by client connects and state broadcasts: with no
sockets connected the next turn's timer was never armed, a hand-end
timer died with its worker, and neither survived a pod restart.

Deadlines are now driven by the absolute timestamps persisted on the
game state and enqueued in a shared Redis sorted set. Every worker runs
a consumer that fires due entries under the per-game lock after
revalidating them against the live state, so timeouts no longer depend
on any player being connected and survive the death of any worker.
Delivery is at-least-once: entries are removed only after processing,
and revalidation makes duplicate deliveries no-ops.

Queue entries carry the deadline as integer epoch milliseconds, which
also serves as the revalidation token, and the score derives from the
same value.
2026-09-18 00:59:54 +00:00
woggioni 22ef689092 Add configurable napola rule with instant win on a full denari sweep 2026-09-17 22:50:59 +00:00
woggioni aa1fecae43 Auto-dismiss error toasts after 10 seconds 2026-09-17 21:30:36 +00:00
+6 -10
View File
@@ -48,21 +48,17 @@ RUN --mount=type=cache,target=/var/cache/apk \
WORKDIR /build
COPY server/requirements.txt ./
RUN --mount=type=cache,target=/root/.cache/pip \
python3 -m venv /opt/venv \
&& /opt/venv/bin/pip install --upgrade pip \
&& /opt/venv/bin/pip install -r requirements.txt
COPY server/pyproject.toml server/README.md ./
COPY server/pyproject.toml server/README.md server/requirements.txt ./
COPY server/src/ ./src/
RUN --mount=type=cache,target=/root/.cache/pip \
/opt/venv/bin/pip install .
# aerich migration files are a release artifact: the db-migrate compose
# service runs `aerich upgrade` from this image before the app starts.
COPY server/migrations/ ./migrations/
RUN --mount=type=cache,target=/root/.cache/pip \
python3 -m venv /opt/venv \
&& /opt/venv/bin/pip install --upgrade pip \
&& /opt/venv/bin/pip install -r requirements.txt .
# --- Runtime ---------------------------------------------------------------
FROM alpine:3.24