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:
@@ -10,7 +10,7 @@ import (
|
||||
"scrabble/backend/internal/account"
|
||||
)
|
||||
|
||||
// AdminMessage is one chat message in the admin moderation list (Stage 17): the message
|
||||
// AdminMessage is one chat message in the admin moderation list: the message
|
||||
// plus its sender's resolved display name and source, for the operator console.
|
||||
type AdminMessage struct {
|
||||
ID uuid.UUID
|
||||
|
||||
@@ -58,7 +58,7 @@ func (svc *Service) PostMessage(ctx context.Context, gameID, senderID uuid.UUID,
|
||||
return Message{}, ErrNotParticipant
|
||||
}
|
||||
// Chat is allowed only on the sender's own turn in an active game; the opponent's-turn
|
||||
// control is the nudge (Stage 17).
|
||||
// control is the nudge.
|
||||
if status != statusActive {
|
||||
return Message{}, ErrGameNotActive
|
||||
}
|
||||
@@ -115,7 +115,7 @@ func (svc *Service) Nudge(ctx context.Context, gameID, senderID uuid.UUID) (Mess
|
||||
}
|
||||
if ok && svc.now().Sub(last) < nudgeInterval {
|
||||
// The cooldown resets once the sender has acted (moved or chatted) since the last
|
||||
// nudge — engagement clears the "don't spam" limit (Stage 17).
|
||||
// nudge — engagement clears the "don't spam" limit.
|
||||
acted, err := svc.actedSince(ctx, gameID, senderID, last)
|
||||
if err != nil {
|
||||
return Message{}, err
|
||||
@@ -132,7 +132,7 @@ func (svc *Service) Nudge(ctx context.Context, gameID, senderID uuid.UUID) (Mess
|
||||
if toMove >= 0 && toMove < len(seats) {
|
||||
nudge := notify.Nudge(seats[toMove], gameID, senderID)
|
||||
if lang, err := svc.games.GameLanguage(ctx, gameID); err == nil {
|
||||
nudge.Language = lang // route by the game's bot, not the recipient's last-login one (Stage 17)
|
||||
nudge.Language = lang // route by the game's bot, not the recipient's last-login one
|
||||
}
|
||||
svc.pub.Publish(nudge)
|
||||
}
|
||||
@@ -140,7 +140,7 @@ func (svc *Service) Nudge(ctx context.Context, gameID, senderID uuid.UUID) (Mess
|
||||
}
|
||||
|
||||
// actedSince reports whether senderID made a move or posted a chat message in the game
|
||||
// after t — the events that reset the nudge cooldown (Stage 17).
|
||||
// after t — the events that reset the nudge cooldown.
|
||||
func (svc *Service) actedSince(ctx context.Context, gameID, senderID uuid.UUID, t time.Time) (bool, error) {
|
||||
if mv, ok, err := svc.games.LastMoveAt(ctx, gameID, senderID); err != nil {
|
||||
return false, err
|
||||
@@ -291,7 +291,7 @@ func (s *Store) lastNudgeAt(ctx context.Context, gameID, senderID uuid.UUID) (ti
|
||||
|
||||
// lastMessageAt returns the time of senderID's most recent non-nudge chat message in
|
||||
// gameID, if any. The nudge cooldown resets when the player chats (or moves), so a stale
|
||||
// nudge no longer blocks a new one (Stage 17).
|
||||
// nudge no longer blocks a new one.
|
||||
func (s *Store) lastMessageAt(ctx context.Context, gameID, senderID uuid.UUID) (time.Time, bool, error) {
|
||||
stmt := postgres.SELECT(table.ChatMessages.CreatedAt).
|
||||
FROM(table.ChatMessages).
|
||||
|
||||
@@ -31,7 +31,7 @@ const friendRequestTTL = 30 * 24 * time.Hour
|
||||
|
||||
// accountRef resolves accountID into a notify.AccountRef (the display name from the account
|
||||
// store, empty on a lookup failure), for enriching the friend_* live events so the client
|
||||
// updates its requests/friends state without a refetch (R4).
|
||||
// updates its requests/friends state without a refetch.
|
||||
func (svc *Service) accountRef(ctx context.Context, accountID uuid.UUID) notify.AccountRef {
|
||||
ref := notify.AccountRef{AccountID: accountID.String()}
|
||||
if acc, err := svc.accounts.GetByID(ctx, accountID); err == nil {
|
||||
|
||||
@@ -32,7 +32,7 @@ type GameReader interface {
|
||||
// has moved); the nudge cooldown resets once the player has taken a turn.
|
||||
LastMoveAt(ctx context.Context, gameID, accountID uuid.UUID) (time.Time, bool, error)
|
||||
// GameLanguage is the game's language tag ("en"/"ru"), so a nudge's out-of-app push routes
|
||||
// to the game's bot rather than the recipient's last-login bot (Stage 17).
|
||||
// to the game's bot rather than the recipient's last-login bot.
|
||||
GameLanguage(ctx context.Context, gameID uuid.UUID) (string, error)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ var (
|
||||
ErrGameNotActive = errors.New("social: game is not active")
|
||||
// ErrChatNotYourTurn is returned when a chat message is sent while it is not the
|
||||
// sender's turn — chat is allowed only on your own turn (the opponent's-turn control
|
||||
// is the nudge, Stage 17).
|
||||
// is the nudge).
|
||||
ErrChatNotYourTurn = errors.New("social: cannot chat while it is not your turn")
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user