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.
Summary
Two JSDoc blocks in
src/play.tsstill describemovesas aSet<BackgammonMove>insidebackgammon-corethat is flattened to anArrayat the wire. This has not been true since the migration in nodots/backgammon#159 (merged October 2025 vianodots/backgammon-corePR #57, commitaf1da46).BackgammonMovesis nowBackgammonMove[]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. TheBackgammonMovestype 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:Set<BackgammonMove>for O(1) lookups..."Array.from(game.activePlay.moves)to convert Set to Array"src/play.ts:63-72— JSDoc onBasePlay.moves. Claims:Verification
Current
packages/core/src/Play/index.ts:62:Neither
moves: Set<...>nornew Set<BackgammonMove>appears anywhere in core's Play implementation. Remainingnew Set(...)calls in core (Play/index.ts:1060,1160) are local helpers for unique origins / unique die values — not themovescollection.Proposed fix
Replace both JSDoc blocks with a simple statement that
movesisBackgammonMove[]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
docs/white-papers/02-type-system.mdhad the same stale content in §5.1; fixed on branchdocs/type-system-whitepaper-set-to-arrayinnodots/backgammon.CLAUDE.mdat the workspace root had the same stale guidance; fixed on the same branch.