Skip to content

Commit 4765b89

Browse files
author
DavidQ
committed
BUILD PR: centralize network debug serialization helpers across exact network debug batch.
1 parent 7eebcf3 commit 4765b89

6 files changed

Lines changed: 125 additions & 13 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
MODEL: GPT-5.3-codex
22
REASONING: high
33
COMMAND:
4-
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_34_AS_POSITIVE_NUMBER_NETWORK_BATCH.md exactly.
4+
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_35_NETWORK_DEBUG_SERIALIZATION_BATCH.md exactly.
55
Edit only these files:
6-
- src/shared/utils/numberUtils.js (only to add/export asPositiveNumber if missing, or minimum export fix if present)
7-
- games/network_sample_a/game/FakeLoopbackNetworkModel.js
8-
- games/network_sample_a/game/NetworkSampleAScene.js
9-
- games/network_sample_b/game/FakeHostClientNetworkModel.js
10-
- games/network_sample_b/game/NetworkSampleBScene.js
11-
- games/network_sample_c/game/FakeDivergenceTraceNetworkModel.js
12-
- games/network_sample_c/game/NetworkSampleCScene.js
6+
- src/shared/utils/networkDebugUtils.js (new file)
7+
- games/network_sample_a/debug/networkSampleADebug.js
8+
- games/network_sample_b/debug/networkSampleBDebug.js
9+
- games/network_sample_c/debug/networkSampleCDebug.js
1310
Do not expand scope.
14-
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_34_AS_POSITIVE_NUMBER_NETWORK_BATCH_delta.zip
11+
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_35_NETWORK_DEBUG_SERIALIZATION_BATCH_delta.zip

docs/dev/COMMIT_COMMENT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
BUILD PR: centralize asPositiveNumber across exact network sample batch.
1+
BUILD PR: centralize network debug serialization helpers across exact network debug batch.

docs/dev/NEXT_COMMAND.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Next: run BUILD_PR_SHARED_EXTRACTION_35_NETWORK_DEBUG_SERIALIZATION_BATCH after this batch.
1+
Next: continue duplicate-family extraction from the provided duplicate report.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Execution-grade batch for asPositiveNumber using the exact duplicate-report file list.
1+
Execution-grade batch for network debug serialization helpers using the exact duplicate-report file list.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Exact file list present; one PR purpose only; no guessing.
1+
Exact file list present; exact helper list present; one PR purpose only.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# BUILD_PR_SHARED_EXTRACTION_35_NETWORK_DEBUG_SERIALIZATION_BATCH
2+
3+
## Purpose
4+
Centralize duplicated network debug serialization helpers across the exact network debug batch identified in the duplicate report.
5+
6+
## Single PR Purpose
7+
Normalize ONLY these helpers:
8+
9+
- `asNumber(value, fallback = 0)`
10+
- `toNetworkSnapshot(snapshot)`
11+
- `getCommandSnapshot(context)`
12+
- `commandLinesForTrace(context, args = [])`
13+
14+
## Exact Files Allowed
15+
16+
### New shared source
17+
1. `src/shared/utils/networkDebugUtils.js`
18+
19+
### Consumer files
20+
2. `games/network_sample_a/debug/networkSampleADebug.js`
21+
3. `games/network_sample_b/debug/networkSampleBDebug.js`
22+
4. `games/network_sample_c/debug/networkSampleCDebug.js`
23+
24+
Do not edit any other file.
25+
26+
## Source of Truth
27+
This exact scope comes from the provided duplicate report entries for:
28+
- `function asNumber(value, fallback = 0)`
29+
- `function toNetworkSnapshot(snapshot)`
30+
- `function getCommandSnapshot(context)`
31+
- `function commandLinesForTrace(context, args = [])`
32+
33+
Only the listed network debug files are in scope.
34+
35+
## Exact Shared Helper Creation
36+
Create:
37+
38+
`src/shared/utils/networkDebugUtils.js`
39+
40+
Export exactly these helpers:
41+
- `asNumber`
42+
- `toNetworkSnapshot`
43+
- `getCommandSnapshot`
44+
- `commandLinesForTrace`
45+
46+
Implementation rules:
47+
- Use ONE existing implementation as source-of-truth for each helper
48+
- Do NOT merge logic
49+
- Do NOT generalize behavior
50+
- Preserve function signatures exactly as listed above
51+
52+
Notes:
53+
- `getCommandSnapshot` is present only in `network_sample_a` and `network_sample_c`
54+
- `commandLinesForTrace` is present only in `network_sample_a` and `network_sample_c`
55+
That is expected. Export them from the shared file anyway; only import them in files that currently use them.
56+
57+
## Exact Consumer Changes
58+
59+
### `games/network_sample_a/debug/networkSampleADebug.js`
60+
- remove local definitions for any of the 4 listed helpers that exist in this file
61+
- import the helpers it uses from the correct relative path to:
62+
- `src/shared/utils/networkDebugUtils.js`
63+
- do not touch unrelated helpers
64+
- do not change logic
65+
66+
### `games/network_sample_b/debug/networkSampleBDebug.js`
67+
- remove local definitions for:
68+
- `asNumber`
69+
- `toNetworkSnapshot`
70+
- import the helpers it uses from the correct relative path to:
71+
- `src/shared/utils/networkDebugUtils.js`
72+
- do not import helpers this file does not use
73+
- do not touch unrelated helpers
74+
- do not change logic
75+
76+
### `games/network_sample_c/debug/networkSampleCDebug.js`
77+
- remove local definitions for any of the 4 listed helpers that exist in this file
78+
- import the helpers it uses from the correct relative path to:
79+
- `src/shared/utils/networkDebugUtils.js`
80+
- do not touch unrelated helpers
81+
- do not change logic
82+
83+
Import rules:
84+
- if a file already imports from that module, add needed specifiers with the minimum safe edit
85+
- if multiple listed helpers are needed from the same module, a single combined import is allowed
86+
- do not duplicate imports
87+
88+
## Relative Import Rule
89+
Use the correct relative path from each consumer file to:
90+
91+
`src/shared/utils/networkDebugUtils.js`
92+
93+
Do not use aliases.
94+
Do not change `.js` extension usage.
95+
96+
## Hard Constraints
97+
- no engine changes
98+
- no game runtime changes outside the 3 listed debug consumers
99+
- no sample files
100+
- no repo-wide network helper cleanup
101+
- no behavior changes
102+
- keep one PR purpose only
103+
104+
## Validation Checklist
105+
1. Confirm no more than the 4 listed files changed
106+
2. Confirm `src/shared/utils/networkDebugUtils.js` exists and exports the 4 listed helpers
107+
3. Confirm changed consumer files no longer contain local definitions for the listed helpers they used to own
108+
4. Confirm changed consumer files import only the needed helpers from the correct relative path to `src/shared/utils/networkDebugUtils.js`
109+
5. Confirm no unrelated engine, game runtime, or sample files changed
110+
6. Confirm no behavior changes were made
111+
112+
## Non-Goals
113+
- no cleanup of other network debug helpers beyond the 4 listed above
114+
- no cleanup outside the 3 listed network debug consumer files
115+
- no refactor beyond this exact duplicate-removal batch

0 commit comments

Comments
 (0)