R6(a): de-stage code, docs, READMEs; split stage6_test

Mechanical, behaviour-preserving removal of Stage N / TODO-N / phase (RN)
references from comments, doc-comments, service READMEs, the current-state docs
(ARCHITECTURE, FUNCTIONAL+_ru, TESTING, UI_DESIGN), config-file comments, and the
.fbs/.proto schema comments. PLAN.md / PRERELEASE.md / CLAUDE.md keep the stage
history.

- Rename the only stage-named identifiers: registerStage8 -> registerSocialOps,
  registerStage11 -> registerLinkOps (gateway transcode).
- Split stage6_test.go: TestEmailLoginFlow -> email_test.go,
  TestGuestAutoMatchLeavesNoStats (+ provisionGuest) -> account_test.go.
- Regenerated proto bindings (push.pb.go, telegram_grpc.pb.go) from the de-staged
  .proto comments; FB Go/TS bindings unchanged (flatc strips schema comments).

go build/vet/gofmt clean across modules; integration typecheck and pnpm check green.
This commit is contained in:
Ilia Denisov
2026-06-10 16:56:03 +02:00
parent a372343797
commit 8881214213
156 changed files with 749 additions and 778 deletions
+26 -26
View File
@@ -1,9 +1,9 @@
// FlatBuffers payloads for the client <-> gateway edge transport (Stage 6).
// FlatBuffers payloads for the client <-> gateway edge transport.
//
// Every request and response that rides inside the Connect envelope
// (gateway/proto/edge) `payload` field, and every push Event payload, is one of
// these tables. They are the binary wire contract shared with the UI, which
// generates TypeScript from this same schema (Stage 7). A single namespace keeps
// generates TypeScript from this same schema. A single namespace keeps
// nested tables (GameView inside MoveResult / MatchResult) free of
// cross-namespace imports. Keep this schema and the backend JSON DTOs in lockstep
// — the gateway transcodes one to the other.
@@ -25,7 +25,7 @@ table TileRecord {
}
// PlayTile is one inbound tile to place, addressed by its alphabet index rather than a
// concrete letter (Stage 13). For a blank, letter carries the designated letter's index
// concrete letter. For a blank, letter carries the designated letter's index
// and blank is true. The board coordinate is its target square.
table PlayTile {
row:int;
@@ -34,7 +34,7 @@ table PlayTile {
blank:bool;
}
// AlphabetEntry is one letter of a variant's alphabet, sent for display only (Stage 13):
// AlphabetEntry is one letter of a variant's alphabet, sent for display only:
// index is the engine alphabet-index byte the wire uses for this letter, letter is the
// concrete character and value is its tile score. The client caches the table per variant.
table AlphabetEntry {
@@ -67,7 +67,7 @@ table GameView {
end_reason:string;
seats:[SeatView];
// last_activity_unix is the lobby sort key: the current turn's start for an active
// game, the finish time for a finished one (Stage 17).
// game, the finish time for a finished one.
last_activity_unix:long;
}
@@ -152,7 +152,7 @@ table Profile {
// --- game (authenticated) ---
// SubmitPlayRequest places tiles in a direction on the player's turn. tiles are addressed
// by alphabet index (Stage 13).
// by alphabet index.
table SubmitPlayRequest {
game_id:string;
dir:string;
@@ -161,8 +161,8 @@ table SubmitPlayRequest {
// MoveResult is the outcome of a committed move: the move and the post-move game. rack and
// bag_len carry the actor's own post-move private state — their refilled rack (alphabet indices,
// Stage 13; a blank is the sentinel index 255) and the bag size after drawing — so the mover
// renders the next state straight from this response without a follow-up game.state (R4; added
// a blank is the sentinel index 255) and the bag size after drawing — so the mover
// renders the next state straight from this response without a follow-up game.state (added
// trailing — backward-compatible).
table MoveResult {
move:MoveRecord;
@@ -172,7 +172,7 @@ table MoveResult {
}
// StateRequest asks for the requesting player's view of a game. include_alphabet asks the
// backend to embed the variant's AlphabetEntry table in the reply (Stage 13); the client
// backend to embed the variant's AlphabetEntry table in the reply; the client
// sets it only on a per-variant cache miss so the table is not resent on every poll.
table StateRequest {
game_id:string;
@@ -180,7 +180,7 @@ table StateRequest {
}
// StateView is a player's view of a game: the shared summary plus their private rack, the
// bag size and their remaining hint budget. rack carries alphabet indices (Stage 13); a
// bag size and their remaining hint budget. rack carries alphabet indices; a
// blank tile is the sentinel index 255. alphabet is present only when the request set
// include_alphabet (a display table the client caches per variant).
table StateView {
@@ -198,14 +198,14 @@ table GameActionRequest {
}
// ExchangeRequest swaps the listed rack tiles back into the bag. tiles are alphabet
// indices (Stage 13); a blank is the sentinel index 255.
// indices; a blank is the sentinel index 255.
table ExchangeRequest {
game_id:string;
tiles:[ubyte];
}
// EvalRequest previews a tentative play without committing it. tiles are addressed by
// alphabet index (Stage 13).
// alphabet index.
table EvalRequest {
game_id:string;
dir:string;
@@ -220,7 +220,7 @@ table EvalResult {
}
// CheckWordRequest looks a word up in the game's pinned dictionary. word is a sequence of
// alphabet indices (Stage 13); the client constrains input to the variant's alphabet.
// alphabet indices; the client constrains input to the variant's alphabet.
table CheckWordRequest {
game_id:string;
word:[ubyte];
@@ -245,7 +245,7 @@ table HintResult {
hints_remaining:int;
}
// DraftRequest saves the player's client-side composition for a game (Stage 17): a single
// DraftRequest saves the player's client-side composition for a game: a single
// JSON string of {rack_order, board_tiles} the client serializes itself, so the wire carries
// no tile array. The gateway forwards json verbatim to the backend, which owns its shape.
table DraftRequest {
@@ -306,7 +306,7 @@ table ChatList {
messages:[ChatMessage];
}
// --- Stage 8: account, statistics, friends, blocks, invitations, history ---
// --- account, statistics, friends, blocks, invitations, history ---
// AccountRef is a referenced account with its display name resolved — the shared
// shape for friends, blocked users and invitation participants.
@@ -330,7 +330,7 @@ table UpdateProfileRequest {
notifications_in_app_only:bool = true;
}
// --- account linking & merge (Stage 11, authenticated) ---
// --- account linking & merge (authenticated) ---
// LinkEmailRequest mails a confirm-code to email for a later link or merge. The
// code is always sent (no pre-send "taken" signal), so a probe cannot enumerate
@@ -400,7 +400,7 @@ table IncomingRequestList {
// OutgoingRequestList is the accounts the caller has already requested and cannot
// (re-)request: a live pending request or one the addressee declined. The game's
// "add to friends" item reads it to stay disabled across reloads (Stage 17).
// "add to friends" item reads it to stay disabled across reloads.
table OutgoingRequestList {
requests:[AccountRef];
}
@@ -479,12 +479,12 @@ table GcgExport {
// --- push event payloads ---
// YourTurnEvent signals that it is now the recipient's turn. The trailing fields enrich the
// out-of-app push (Stage 17): opponent_name is the player who just moved, last_action is their
// out-of-app push: opponent_name is the player who just moved, last_action is their
// move kind ("play"/"pass"/"exchange"/...), last_word is the main word of a scoring play (empty
// otherwise), and score_line is the recipient-first running score (e.g. "120:95:80"). They are
// appended (FlatBuffers-optional), so an older reader that only needs game_id/deadline is unaffected.
// move_count is the post-move count (matching the opponent_moved GameView): the client uses it to
// tell whether its cached game already reflects the move, falling back to a refetch on a gap (R4).
// tell whether its cached game already reflects the move, falling back to a refetch on a gap.
table YourTurnEvent {
game_id:string;
deadline_unix:long;
@@ -496,10 +496,10 @@ table YourTurnEvent {
}
// GameOverEvent signals that a game the recipient is seated in has finished, driving the
// out-of-app "game over" push (Stage 17). result is the outcome from the recipient's own
// out-of-app "game over" push. result is the outcome from the recipient's own
// perspective ("won"/"lost"/"draw"); score_line is the recipient-first final score. game is the
// final post-game summary (adjusted scores after rack penalties + the winner flag), so the client
// settles the finished game from the event without a refetch (R4; added trailing).
// settles the finished game from the event without a refetch (added trailing).
table GameOverEvent {
game_id:string;
result:string;
@@ -508,10 +508,10 @@ table GameOverEvent {
}
// OpponentMovedEvent carries a move another seat just committed as a delta the client applies to
// its cached game without a refetch (R4): move is the decoded play/pass/exchange (the same record
// its cached game without a refetch: move is the decoded play/pass/exchange (the same record
// game.history returns), game is the post-move summary (per-seat scores, to_move, move_count,
// status) and bag_len is the bag size after the draw. The leading seat/action/score/total scalars
// are the pre-R4 summary, now redundant with move/game and kept only for wire back-compat.
// are the older summary, now redundant with move/game and kept only for wire back-compat.
table OpponentMovedEvent {
game_id:string;
seat:int;
@@ -531,8 +531,8 @@ table NudgeEvent {
// MatchFoundEvent signals that an auto-match pairing (or robot substitution) started a game the
// recipient is seated in. state is the recipient's full initial view of the new game (empty board,
// dealt rack), so the client navigates straight in from the event with no follow-up fetch (R4;
// added trailing — an older reader still reads just game_id).
// dealt rack), so the client navigates straight in from the event with no follow-up fetch (added
// trailing — an older reader still reads just game_id).
table MatchFoundEvent {
game_id:string;
state:StateView;
@@ -543,7 +543,7 @@ table MatchFoundEvent {
// discriminator ("friend_request", "friend_added", "friend_declined", "invitation",
// "game_started"); the client re-fetches its lobby counters (and, for a requester
// watching a game, its friend state) on any of them. To let the client update its lobby without a
// follow-up fetch (R4), each event also carries the payload its kind changed: account for the
// follow-up fetch, each event also carries the payload its kind changed: account for the
// friend_* kinds (the requester/friend), invitation for "invitation" (the new invitation) and
// state for "game_started" (the started game's initial view, like match_found). Only the field
// matching kind is set (all added trailing — backward-compatible).