Skip to content

Stale JSDoc in play.ts: describes Set-vs-Array serialization seam removed in October 2025 #65

@nodots

Description

@nodots

Summary

Two JSDoc blocks in src/play.ts still describe moves as a Set<BackgammonMove> inside backgammon-core that is flattened to an Array at the wire. This has not been true since the migration in nodots/backgammon#159 (merged October 2025 via nodots/backgammon-core PR #57, commit af1da46). BackgammonMoves is now BackgammonMove[] end-to-end — in this package, in core, and across every API/WebSocket boundary.

The stale docs actively mislead consumers: several still call Array.from(game.activePlay.moves) on the belief that it is a Set. The BackgammonMoves type declaration itself is correct; only the prose is wrong.

Locations

src/play.ts:1-31 — file header block titled "Serialization Contract for `moves` Field". Claims:

  • "Core Library (nodots-backgammon-core): Uses Set<BackgammonMove> for O(1) lookups..."
  • "Use Array.from(game.activePlay.moves) to convert Set to Array"
  • "The core library handles this conversion internally for its public APIs"

src/play.ts:63-72 — JSDoc on BasePlay.moves. Claims:

  • "Serialization Note: In the core library this is internally a Set for O(1) lookups, but in API responses and type definitions it is always an Array..."

Verification

Current packages/core/src/Play/index.ts:62:

moves?: BackgammonMoves = []

Neither moves: Set<...> nor new Set<BackgammonMove> appears anywhere in core's Play implementation. Remaining new Set(...) calls in core (Play/index.ts:1060, 1160) are local helpers for unique origins / unique die values — not the moves collection.

Proposed fix

Replace both JSDoc blocks with a simple statement that moves is BackgammonMove[] everywhere and that no conversion is needed. Keep a one-line historical pointer to nodots/backgammon#159 for anyone grepping for the old Set behavior.

Related

  • Paper 2 (Type System) in the workspace docs/white-papers/02-type-system.md had the same stale content in §5.1; fixed on branch docs/type-system-whitepaper-set-to-array in nodots/backgammon.
  • The project CLAUDE.md at the workspace root had the same stale guidance; fixed on the same branch.

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