Skip to content

Commit 8e35798

Browse files
committed
Finish shared ownership of protocol validation
1 parent 70d2621 commit 8e35798

File tree

5 files changed

+1207
-1211
lines changed

5 files changed

+1207
-1211
lines changed

docs/BACKLOG.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@ Current direction is good. This plan is aimed at removing the
1010
main correctness and coordination risks found in the latest
1111
project review without rewriting working systems.
1212

13-
### Phase 1. Consolidate protocol validation
14-
15-
- Move C2S/S2C runtime schema ownership next to the shared
16-
protocol message definitions instead of maintaining a large
17-
hand-written parser island in `src/server/protocol.ts`.
18-
- Keep room-code, token, and seat-assignment helpers separate if
19-
they stay generic; focus schema consolidation on message
20-
payloads first.
21-
- Use the shared schema layer for both runtime validation and
22-
compile-time TypeScript inference where practical.
23-
- Target outcome: one source of truth for protocol shape, smaller
24-
validator surface area, and cheaper message evolution.
25-
2613
### Phase 2. Finish consolidating client state ownership
2714

2815
- Extract `ClientContext` and `PlanningState` mutation behind a
@@ -50,9 +37,8 @@ project review without rewriting working systems.
5037

5138
### Suggested order
5239

53-
1. Phase 1: protocol schema consolidation.
54-
2. Phase 2: client store/transition consolidation.
55-
3. Phase 3: direct shared-type imports and boundary enforcement.
40+
1. Phase 2: client store/transition consolidation.
41+
2. Phase 3: direct shared-type imports and boundary enforcement.
5642

5743
---
5844

src/server/game-do/game-do.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
findBaseHex,
2323
SCENARIOS,
2424
} from '../../shared/map-data';
25+
import { validateClientMessage } from '../../shared/protocol';
2526
import type {
2627
AstrogationOrder,
2728
C2S,
@@ -40,7 +41,6 @@ import {
4041
parseInitPayload,
4142
type RoomConfig,
4243
resolveSeatAssignment,
43-
validateClientMessage,
4444
} from '../protocol';
4545
import {
4646
deriveCombatEvents,

0 commit comments

Comments
 (0)