Seal the 12-slot piece-placement layout #121

Closed
opened 2026-05-22 12:40:22 +00:00 by root · 4 comments
root commented 2026-05-22 12:40:22 +00:00 (Migrated from gitlab.core-project.space)

Imported from GitHub amaurycoudr/chess-project#121, opened by @amaurycoudr on 2026-05-22 12:40 UTC.
Closed on GitHub on 2026-05-23 06:28 UTC as completed.


Parent

#117

What to build

Seal the 12-slot piece-placement layout now that no consumer reaches it directly. With every reader on the PieceReader port and SearchBoard on MutablePlacement, the raw record types and the aliasing constructors have no remaining external callers — make the layout a private implementation detail.

Un-export PieceSets, PieceSetKey, and pieceSetKeyOf; collapse Board's three aliasing-distinguished constructors (wrapSets, fromSets, toSets) into the single copy-only Board.fromReader builder, so silent copy-vs-alias mistakes become unrepresentable. Record PieceReader as the seam between rule logic and placement representation in the ADR lineage.

Acceptance criteria

  • PieceSets, PieceSetKey, pieceSetKeyOf no longer exported; module-private to the placement module
  • Board.wrapSets / Board.fromSets / Board.toSets removed; Board.fromReader is the single snapshot-from-anything builder (always copies)
  • No remaining callsite constructs a placement by aliasing a mutable record
  • ADR updated (a note in ADR 0007's lineage or a new ADR) recording PieceReader as the rule-logic/representation seam
  • pnpm lint, pnpm typecheck, pnpm test, pnpm build all green; perft node counts unchanged

Blocked by

> _Imported from GitHub [amaurycoudr/chess-project#121](https://github.com/amaurycoudr/chess-project/issues/121), opened by [@amaurycoudr](https://github.com/amaurycoudr) on 2026-05-22 12:40 UTC._ > _Closed on GitHub on 2026-05-23 06:28 UTC as completed._ <!-- github-issue:121 --> --- ## Parent #117 ## What to build Seal the 12-slot piece-placement layout now that no consumer reaches it directly. With every reader on the `PieceReader` port and `SearchBoard` on `MutablePlacement`, the raw record types and the aliasing constructors have no remaining external callers — make the layout a private implementation detail. Un-export `PieceSets`, `PieceSetKey`, and `pieceSetKeyOf`; collapse `Board`'s three aliasing-distinguished constructors (`wrapSets`, `fromSets`, `toSets`) into the single copy-only `Board.fromReader` builder, so silent copy-vs-alias mistakes become unrepresentable. Record `PieceReader` as the seam between rule logic and placement representation in the ADR lineage. ## Acceptance criteria - [ ] `PieceSets`, `PieceSetKey`, `pieceSetKeyOf` no longer exported; module-private to the placement module - [ ] `Board.wrapSets` / `Board.fromSets` / `Board.toSets` removed; `Board.fromReader` is the single snapshot-from-anything builder (always copies) - [ ] No remaining callsite constructs a placement by aliasing a mutable record - [ ] ADR updated (a note in ADR 0007's lineage or a new ADR) recording `PieceReader` as the rule-logic/representation seam - [ ] `pnpm lint`, `pnpm typecheck`, `pnpm test`, `pnpm build` all green; perft node counts unchanged ## Blocked by - Blocked by #120
root commented 2026-05-22 13:21:33 +00:00 (Migrated from gitlab.core-project.space)

Imported from a GitHub comment by @amaurycoudr on 2026-05-22 13:21 UTC.

Implemented by Sandcastle on branch sandcastle/sequential-reviewer/1779455557939 — awaiting review. 12-slot layout (PieceSets, PieceSetKey, pieceSetKeyOf, PIECE_SET_KEYS, PIECE_FOR_KEY) is now confined to a private piece-sets.ts shared only by Board and MutablePlacement; the three aliasing-distinguished constructors (wrapSets / fromSets / toSets) are gone — Board.fromReader is the single copy-only snapshot builder. ADR 0007 carries a lineage note recording PieceReader as the rule-logic/representation seam. All four gates green; perft node counts byte-identical.

> _Imported from a [GitHub comment](https://github.com/amaurycoudr/chess-project/issues/121#issuecomment-4519044662) by [@amaurycoudr](https://github.com/amaurycoudr) on 2026-05-22 13:21 UTC._ <!-- github-comment:4519044662 --> Implemented by Sandcastle on branch `sandcastle/sequential-reviewer/1779455557939` — awaiting review. 12-slot layout (`PieceSets`, `PieceSetKey`, `pieceSetKeyOf`, `PIECE_SET_KEYS`, `PIECE_FOR_KEY`) is now confined to a private `piece-sets.ts` shared only by `Board` and `MutablePlacement`; the three aliasing-distinguished constructors (`wrapSets` / `fromSets` / `toSets`) are gone — `Board.fromReader` is the single copy-only snapshot builder. ADR 0007 carries a lineage note recording `PieceReader` as the rule-logic/representation seam. All four gates green; perft node counts byte-identical.
root commented 2026-05-22 14:20:04 +00:00 (Migrated from gitlab.core-project.space)

Imported from a GitHub comment by @amaurycoudr on 2026-05-22 14:20 UTC.

Promoted to branch refactor/introduce-the-piecereader-read-port-118 (PR #122), not yet merged to main. A dependent slice should git fetch origin refactor/introduce-the-piecereader-read-port-118 and branch off it.

> _Imported from a [GitHub comment](https://github.com/amaurycoudr/chess-project/issues/121#issuecomment-4519525872) by [@amaurycoudr](https://github.com/amaurycoudr) on 2026-05-22 14:20 UTC._ <!-- github-comment:4519525872 --> Promoted to branch `refactor/introduce-the-piecereader-read-port-118` (PR #122), not yet merged to main. A dependent slice should `git fetch origin refactor/introduce-the-piecereader-read-port-118` and branch off it.
root (Migrated from gitlab.core-project.space) closed this issue 2026-05-23 06:28:34 +00:00
root commented 2026-10-13 10:18:45 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit ad1f9e4a14

mentioned in commit ad1f9e4a149876a49f947ab3c068abcef2e86d6d
root commented 2026-10-13 10:27:20 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 2d77134432

mentioned in commit 2d77134432473dd0c75ca22a103c89c44ee74a99
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amaurycoudr/chess-project#121
No description provided.