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:
+3
-3
@@ -16,12 +16,12 @@ fbs/scrabblefb/ # committed generated Go for the schema
|
||||
- **`proto/push/v1`** is the single gRPC server-stream the backend exposes and
|
||||
the gateway subscribes to (`Event{user_id, kind, payload, event_id}`); the
|
||||
`payload` is an opaque FlatBuffers body the gateway forwards verbatim.
|
||||
- **`proto/telegram/v1`** is the Telegram connector's RPC contract (Stage 9; Stage 11
|
||||
added `ValidateLoginWidget` for the web Login Widget sign-in).
|
||||
- **`proto/telegram/v1`** is the Telegram connector's RPC contract (including
|
||||
`ValidateLoginWidget` for the web Login Widget sign-in).
|
||||
- **`fbs`** holds the client↔gateway request/response and event payloads as
|
||||
FlatBuffers tables. The backend encodes the push payloads from these types; the
|
||||
gateway transcodes the rest to and from the backend's JSON; the UI generates
|
||||
TypeScript from the same `.fbs` (Stage 7).
|
||||
TypeScript from the same `.fbs`.
|
||||
|
||||
## Generated code
|
||||
|
||||
|
||||
+26
-26
@@ -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).
|
||||
|
||||
@@ -84,7 +84,7 @@ type Event struct {
|
||||
Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"`
|
||||
Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
EventId string `protobuf:"bytes,4,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty"`
|
||||
// language routes an out-of-app push to a specific per-language bot (Stage 17): for a game
|
||||
// language routes an out-of-app push to a specific per-language bot: for a game
|
||||
// event it carries the game's language ("en"/"ru") so the notification comes from the game's
|
||||
// bot rather than the recipient's last-login bot. Empty falls back to the recipient's service
|
||||
// language at the gateway.
|
||||
|
||||
@@ -33,7 +33,7 @@ message Event {
|
||||
string kind = 2;
|
||||
bytes payload = 3;
|
||||
string event_id = 4;
|
||||
// language routes an out-of-app push to a specific per-language bot (Stage 17): for a game
|
||||
// language routes an out-of-app push to a specific per-language bot: for a game
|
||||
// event it carries the game's language ("en"/"ru") so the notification comes from the game's
|
||||
// bot rather than the recipient's last-login bot. Empty falls back to the recipient's service
|
||||
// language at the gateway.
|
||||
|
||||
@@ -23,7 +23,7 @@ service Telegram {
|
||||
// ValidateLoginWidget verifies Telegram Login Widget authorization data (the web
|
||||
// sign-in flow, HMAC under SHA-256(bot_token)) and returns the authenticated
|
||||
// user. The gateway calls it during the link.telegram edge operation to attach a
|
||||
// Telegram identity to an existing account (Stage 11).
|
||||
// Telegram identity to an existing account.
|
||||
rpc ValidateLoginWidget(ValidateLoginWidgetRequest) returns (ValidateLoginWidgetResponse);
|
||||
// Notify delivers an out-of-app notification for a backend push event. The
|
||||
// gateway calls it only for a recipient with no live in-app stream (so the
|
||||
@@ -32,11 +32,11 @@ service Telegram {
|
||||
// payload; unrenderable kinds are skipped (delivered=false).
|
||||
rpc Notify(NotifyRequest) returns (NotifyResponse);
|
||||
// SendToUser sends an arbitrary text message to one user through the bot the
|
||||
// request selects by language (admin use, wired in Stage 10). delivered is false
|
||||
// request selects by language (admin use). delivered is false
|
||||
// when the user has not started that bot.
|
||||
rpc SendToUser(SendToUserRequest) returns (SendResponse);
|
||||
// SendToGameChannel posts an arbitrary text message to the game channel of the
|
||||
// bot the request selects by language (admin use, wired in Stage 10); the channel
|
||||
// bot the request selects by language (admin use); the channel
|
||||
// ids live only in the connector configuration.
|
||||
rpc SendToGameChannel(SendToGameChannelRequest) returns (SendResponse);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ type TelegramClient interface {
|
||||
// ValidateLoginWidget verifies Telegram Login Widget authorization data (the web
|
||||
// sign-in flow, HMAC under SHA-256(bot_token)) and returns the authenticated
|
||||
// user. The gateway calls it during the link.telegram edge operation to attach a
|
||||
// Telegram identity to an existing account (Stage 11).
|
||||
// Telegram identity to an existing account.
|
||||
ValidateLoginWidget(ctx context.Context, in *ValidateLoginWidgetRequest, opts ...grpc.CallOption) (*ValidateLoginWidgetResponse, error)
|
||||
// Notify delivers an out-of-app notification for a backend push event. The
|
||||
// gateway calls it only for a recipient with no live in-app stream (so the
|
||||
@@ -59,11 +59,11 @@ type TelegramClient interface {
|
||||
// payload; unrenderable kinds are skipped (delivered=false).
|
||||
Notify(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*NotifyResponse, error)
|
||||
// SendToUser sends an arbitrary text message to one user through the bot the
|
||||
// request selects by language (admin use, wired in Stage 10). delivered is false
|
||||
// request selects by language (admin use). delivered is false
|
||||
// when the user has not started that bot.
|
||||
SendToUser(ctx context.Context, in *SendToUserRequest, opts ...grpc.CallOption) (*SendResponse, error)
|
||||
// SendToGameChannel posts an arbitrary text message to the game channel of the
|
||||
// bot the request selects by language (admin use, wired in Stage 10); the channel
|
||||
// bot the request selects by language (admin use); the channel
|
||||
// ids live only in the connector configuration.
|
||||
SendToGameChannel(ctx context.Context, in *SendToGameChannelRequest, opts ...grpc.CallOption) (*SendResponse, error)
|
||||
}
|
||||
@@ -139,7 +139,7 @@ type TelegramServer interface {
|
||||
// ValidateLoginWidget verifies Telegram Login Widget authorization data (the web
|
||||
// sign-in flow, HMAC under SHA-256(bot_token)) and returns the authenticated
|
||||
// user. The gateway calls it during the link.telegram edge operation to attach a
|
||||
// Telegram identity to an existing account (Stage 11).
|
||||
// Telegram identity to an existing account.
|
||||
ValidateLoginWidget(context.Context, *ValidateLoginWidgetRequest) (*ValidateLoginWidgetResponse, error)
|
||||
// Notify delivers an out-of-app notification for a backend push event. The
|
||||
// gateway calls it only for a recipient with no live in-app stream (so the
|
||||
@@ -148,11 +148,11 @@ type TelegramServer interface {
|
||||
// payload; unrenderable kinds are skipped (delivered=false).
|
||||
Notify(context.Context, *NotifyRequest) (*NotifyResponse, error)
|
||||
// SendToUser sends an arbitrary text message to one user through the bot the
|
||||
// request selects by language (admin use, wired in Stage 10). delivered is false
|
||||
// request selects by language (admin use). delivered is false
|
||||
// when the user has not started that bot.
|
||||
SendToUser(context.Context, *SendToUserRequest) (*SendResponse, error)
|
||||
// SendToGameChannel posts an arbitrary text message to the game channel of the
|
||||
// bot the request selects by language (admin use, wired in Stage 10); the channel
|
||||
// bot the request selects by language (admin use); the channel
|
||||
// ids live only in the connector configuration.
|
||||
SendToGameChannel(context.Context, *SendToGameChannelRequest) (*SendResponse, error)
|
||||
mustEmbedUnimplementedTelegramServer()
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
// required locally or in CI), "stdout" (debugging) and "otlp" (gRPC export to a
|
||||
// collector). The OTLP endpoint and security are taken from the standard
|
||||
// OTEL_EXPORTER_OTLP_* environment variables read by the SDK, so no bespoke
|
||||
// configuration is introduced; the collector itself is stood up with the deploy
|
||||
// (PLAN.md Stage 14).
|
||||
// configuration is introduced; the collector itself is stood up with the deploy.
|
||||
package telemetry
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user