Skip to content

Commit 79df11b

Browse files
author
DavidQ
committed
BUILD PR: remove remaining network_sample_c number helper duplicates and use shared number utils.
1 parent 10e5874 commit 79df11b

6 files changed

Lines changed: 135 additions & 15 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_11_CONSUMER_EDGE_VALIDATION.md exactly.
5-
Edit only these files if needed:
6-
- src/advanced/promotion/createPromotionGate.js
7-
- src/advanced/state/createWorldGameStateSystem.js
4+
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_12_NETWORK_SAMPLE_C_NUMBER_HELPERS.md exactly.
5+
Edit only these files:
86
- games/network_sample_c/game/ReconciliationLayerAdapter.js
9-
- src/shared/utils/numberUtils.js
10-
- src/shared/utils/objectUtils.js
11-
- src/shared/state/createPromotionStateSnapshot.js
12-
Fail fast if any required shared file is missing or a required helper/export is absent entirely.
7+
- games/network_sample_c/game/StateTimelineBuffer.js
8+
- src/shared/utils/numberUtils.js (only if minimum export fix is needed)
9+
Fail fast if src/shared/utils/numberUtils.js does not already exist and export or contain asFiniteNumber and asPositiveInteger.
1310
Do not expand scope.
14-
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_11_CONSUMER_EDGE_VALIDATION_delta.zip
11+
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_12_NETWORK_SAMPLE_C_NUMBER_HELPERS_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: validate direct consumer import/export edges for extracted shared helpers only.
1+
BUILD PR: remove remaining network_sample_c number helper duplicates and use shared number utils.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Built a narrow consumer-edge validation BUILD limited to the known extracted helper consumers and their shared export files.
1+
Built the next executable extraction step by targeting the remaining local number-helper duplication in network_sample_c only.

docs/dev/reports/file_tree.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
docs/
22
pr/
3-
BUILD_PR_SHARED_EXTRACTION_11_CONSUMER_EDGE_VALIDATION.md
3+
BUILD_PR_SHARED_EXTRACTION_12_NETWORK_SAMPLE_C_NUMBER_HELPERS.md
44
dev/
55
codex_commands.md
66
commit_comment.txt

docs/dev/reports/validation_checklist.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ SESSION VALIDATION GATE
22
- Bundle type: BUILD
33
- One PR purpose only: yes
44
- Exact target files listed: yes
5-
- Exact expected imports/exports listed: yes
6-
- Fail-fast rule explicit: yes
7-
- No repo-wide scan language: yes
5+
- Fail-fast dependency gate explicit: yes
6+
- No guessing/new helper creation: yes
7+
- Repo-wide scan/refactor language avoided: yes
88
- Scope minimized: yes
99
- ZIP repo-structured and execution-ready: yes
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# BUILD_PR_SHARED_EXTRACTION_12_NETWORK_SAMPLE_C_NUMBER_HELPERS
2+
3+
## Purpose
4+
Remove remaining local number-helper duplication in the network_sample_c game slice and switch those files to the shared number helper module.
5+
6+
## Single PR Purpose
7+
Normalize only these helper usages inside network_sample_c:
8+
- `asFiniteNumber`
9+
- `asPositiveInteger`
10+
11+
Target files:
12+
- `games/network_sample_c/game/ReconciliationLayerAdapter.js`
13+
- `games/network_sample_c/game/StateTimelineBuffer.js`
14+
15+
This BUILD does **not** change any other helper or file.
16+
17+
## Exact Files Allowed
18+
Edit only these 3 files:
19+
20+
1. `games/network_sample_c/game/ReconciliationLayerAdapter.js`
21+
2. `games/network_sample_c/game/StateTimelineBuffer.js`
22+
3. `src/shared/utils/numberUtils.js` **only if minimum export fix is required**
23+
24+
Do not edit any other file.
25+
26+
## Shared Dependency Assumption
27+
Use the shared helper path:
28+
29+
- `src/shared/utils/numberUtils.js`
30+
31+
Consumer import path from both network_sample_c files must be:
32+
33+
```js
34+
../../../src/shared/utils/numberUtils.js
35+
```
36+
37+
## Fail-Fast Gate
38+
Before making consumer edits, confirm:
39+
40+
1. `src/shared/utils/numberUtils.js` exists
41+
2. it exports `asFiniteNumber`
42+
3. it exports `asPositiveInteger`
43+
44+
If any condition is false:
45+
- stop
46+
- report blocker
47+
- make no changes
48+
- do not create a delta ZIP
49+
50+
Do **not** create a new shared number helper in this PR.
51+
52+
## Exact Source Changes
53+
54+
### 1) `games/network_sample_c/game/ReconciliationLayerAdapter.js`
55+
- remove the local `asPositiveInteger` function definition
56+
- remove the local `asFiniteNumber` function definition
57+
- add exactly one shared import, or minimally update the existing import block, to provide:
58+
59+
```js
60+
import { asFiniteNumber, asPositiveInteger } from "../../../src/shared/utils/numberUtils.js";
61+
```
62+
63+
Rules:
64+
- if separate imports from the same shared file already exist, collapse only if minimal and safe
65+
- do not duplicate imports
66+
- do not touch `sanitizeText`
67+
- do not touch snapshot cloning helpers
68+
- do not change logic
69+
70+
### 2) `games/network_sample_c/game/StateTimelineBuffer.js`
71+
- remove the local `asPositiveInteger` function definition
72+
- add exactly one shared import, or minimally update the existing import block, to provide:
73+
74+
```js
75+
import { asPositiveInteger } from "../../../src/shared/utils/numberUtils.js";
76+
```
77+
78+
Rules:
79+
- do not add `asFiniteNumber` here
80+
- do not touch `normalizeFrameId`
81+
- do not touch snapshot cloning helpers
82+
- do not change logic
83+
84+
### 3) `src/shared/utils/numberUtils.js`
85+
Do not modify implementation logic.
86+
87+
Allowed edit only:
88+
- if `asFiniteNumber` or `asPositiveInteger` already exists in this file but is not exported correctly, make the minimum export change required
89+
90+
If both helpers are already exported, leave this file unchanged.
91+
92+
## Hard Constraints
93+
- do not edit any file other than the 3 listed above
94+
- do not change helper behavior
95+
- do not modify `network_sample_a`
96+
- do not modify engine debug inspector files
97+
- do not change `isPlainObject`
98+
- do not change promotion snapshot logic
99+
- do not perform repo-wide helper cleanup
100+
- keep one PR purpose only
101+
102+
## Validation Checklist
103+
1. Confirm no more than the 3 listed files changed
104+
2. Confirm `src/shared/utils/numberUtils.js` exists
105+
3. Confirm `src/shared/utils/numberUtils.js` exports:
106+
- `asFiniteNumber`
107+
- `asPositiveInteger`
108+
4. Confirm local helper definitions no longer exist in:
109+
- `games/network_sample_c/game/ReconciliationLayerAdapter.js` for:
110+
- `asFiniteNumber`
111+
- `asPositiveInteger`
112+
- `games/network_sample_c/game/StateTimelineBuffer.js` for:
113+
- `asPositiveInteger`
114+
5. Confirm consumer imports now point exactly to:
115+
- `../../../src/shared/utils/numberUtils.js`
116+
6. Confirm no other logic changed
117+
118+
## Non-Goals
119+
- no work in `games/network_sample_a/server/networkSampleADashboardServer.mjs`
120+
- no work in `src/engine/debug/inspectors/shared/inspectorUtils.js`
121+
- no broader number helper normalization
122+
- no new shared helper creation
123+
- no refactor beyond this exact duplicate-removal step

0 commit comments

Comments
 (0)