Skip to content

[CHESS ONLINE PROGRAM] Server-authoritative challenges, live games, reconnect, matchmaking and ratings #67

Description

@spikeal8-maker

Статус

stacked implementation candidate / base PR #66 / do not merge before R0 and Chess Foundation acceptance

Продолжение Issue #65 и Draft PR #66.

Цель — реализовать следующий вертикальный слой ASA Chess: сервер-авторитетные онлайн-партии, вызовы, восстановление состояния, события, базовый matchmaking и прозрачный рейтинг. Это оригинальная реализация ASA Lab, не копия исходного кода, branding, protocol или anti-cheat Chess.com.

Первая candidate-версия

Challenge lifecycle

create challenge
→ receive opaque public code
→ opponent accepts from own session
→ server creates live game
→ challenger and opponent receive assigned colors
  • private/direct challenge;
  • exact time control;
  • rated/unrated policy;
  • expiration;
  • accept/cancel;
  • tenant and principal derived only from session;
  • idempotent commands.

Server-authoritative game aggregate

  • server validates every move with @asa-lab/chess;
  • client cannot submit FEN/result/winner/clock/user/tenant;
  • expected-version optimistic concurrency;
  • command-id idempotency;
  • server time and authoritative clocks;
  • resign;
  • offer/accept/decline draw;
  • timeout claim;
  • checkmate/stalemate/automatic draw;
  • immutable event sequence;
  • snapshot + events after sequence for reconnect;
  • spectator snapshot delay contract;
  • protected rated policy denies analysis capabilities.

Matchmaking and ratings

  • queue tickets grouped by tenant/time-control/rated pool;
  • deterministic compatible pairing;
  • cancellation and expiration;
  • transparent ASA Elo v1 rating changes;
  • provisional games and bounded K factor;
  • immutable rating ledger entries;
  • no claim of Chess.com rating formula parity.

Transport candidate

REST polling commands and event feed first. WebSocket protocol contracts are defined for the next adapter; server authority does not depend on the browser transport.

Required proof

challenge auth and tenant isolation
accept exactly once
creator cannot accept own challenge
move authority and turn checks
illegal move rejected
expectedVersion conflict
command replay idempotent
clock decrement/increment from server timestamp
timeout result
resign and draw lifecycle
automatic mate/draw result
event sequence and reconnect
spectator delay
matchmaking compatibility
rating ledger determinism
API body over-posting negatives
full regression and browser evidence later

Merge rule

This candidate remains Draft and stacked on PR #66. It must not be merged to main until R0, Module Registry and Chess Foundation are accepted, the candidate is rebased/transferred, package lock is synchronized, local tests/DB/browser gates pass and the owner accepts the live flow.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions