Skip to content

Outcome type defines 'timeout' reason but no code sets it #7

@dennisthemenacing

Description

@dennisthemenacing

The Outcome type in src/types/index.ts defines 'timeout' as a valid game-ending reason:

export type Outcome = {
   winner?: Color;
   reason: 'checkmate' | 'resignation' | 'timeout' | 'draw' | ...;
}

However, searching the codebase shows no path that ever sets outcome.reason = 'timeout'. The disconnect handler uses 'resignation' when both players leave, and there is no timeout-based cleanup that produces an outcome.

Either the timeout reason should be removed from the type, or a timeout mechanism should be implemented (e.g., a move or action timeout tracked per game, or the reconnection grace period culminating in a timeout outcome instead of resignation).

Files likely affected:

  • src/types/index.ts — remove 'timeout' or document why it exists
  • src/gameManager/index.ts — add timeout outcome logic if implementing
  • src/sockets/chessSockets.ts — wire up timeout events if implementing

Checklist:

  • Decide whether 'timeout' is needed or should be removed
  • If needed: implement timeout tracking and outcome setting
  • If not needed: remove 'timeout' from the Outcome type

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions