Skip to content

Commit 27be571

Browse files
author
DavidQ
committed
BUILD PR: consolidate shared-helper imports in network_sample_c only.
1 parent 79df11b commit 27be571

8 files changed

Lines changed: 353 additions & 10 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
MODEL: GPT-5.3-codex
22
REASONING: high
33
COMMAND:
4-
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_12_NETWORK_SAMPLE_C_NUMBER_HELPERS.md exactly.
4+
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_14_NETWORK_SAMPLE_C_IMPORT_CONSOLIDATION.md exactly.
55
Edit only these files:
66
- games/network_sample_c/game/ReconciliationLayerAdapter.js
77
- 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.
108
Do not expand scope.
11-
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_12_NETWORK_SAMPLE_C_NUMBER_HELPERS_delta.zip
9+
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_14_NETWORK_SAMPLE_C_IMPORT_CONSOLIDATION_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: remove remaining network_sample_c number helper duplicates and use shared number utils.
1+
BUILD PR: consolidate shared-helper imports in network_sample_c only.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Built the next executable extraction step by targeting the remaining local number-helper duplication in network_sample_c only.
1+
Built the next executable step to consolidate duplicate shared-helper import lines inside 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_12_NETWORK_SAMPLE_C_NUMBER_HELPERS.md
3+
BUILD_PR_SHARED_EXTRACTION_14_NETWORK_SAMPLE_C_IMPORT_CONSOLIDATION.md
44
dev/
55
codex_commands.md
66
commit_comment.txt

docs/dev/reports/validation_checklist.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ SESSION VALIDATION GATE
22
- Bundle type: BUILD
33
- One PR purpose only: yes
44
- Exact target files listed: yes
5-
- Fail-fast dependency gate explicit: yes
6-
- No guessing/new helper creation: yes
7-
- Repo-wide scan/refactor language avoided: yes
5+
- Exact allowed consolidation rules listed: yes
6+
- No path changes or logic changes allowed: yes
87
- Scope minimized: yes
98
- ZIP repo-structured and execution-ready: yes
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# BUILD_PR_SHARED_EXTRACTION_13_NETWORK_SAMPLE_C_OBJECT_HELPERS
2+
3+
## Purpose
4+
Remove any remaining local `isPlainObject` duplication in network_sample_c and align usage with the shared object helper.
5+
6+
## Single PR Purpose
7+
Normalize `isPlainObject` usage ONLY in:
8+
9+
- `games/network_sample_c/game/ReconciliationLayerAdapter.js`
10+
- `games/network_sample_c/game/StateTimelineBuffer.js`
11+
12+
This BUILD does **not** change any other helper or file.
13+
14+
## Exact Files Allowed
15+
Edit only these 3 files:
16+
17+
1. `games/network_sample_c/game/ReconciliationLayerAdapter.js`
18+
2. `games/network_sample_c/game/StateTimelineBuffer.js`
19+
3. `src/shared/utils/objectUtils.js` (only if minimum export fix is required)
20+
21+
Do not edit any other file.
22+
23+
## Shared Dependency Assumption
24+
Use the shared helper path:
25+
26+
- `src/shared/utils/objectUtils.js`
27+
28+
Consumer import path must be:
29+
30+
```js
31+
../../../src/shared/utils/objectUtils.js
32+
```
33+
34+
## Fail-Fast Gate
35+
Before making consumer edits, confirm:
36+
37+
1. `src/shared/utils/objectUtils.js` exists
38+
2. it exports `isPlainObject`
39+
40+
If any condition is false:
41+
- stop
42+
- report blocker
43+
- make no changes
44+
- do not create a delta ZIP
45+
46+
Do **not** create a new shared object helper in this PR.
47+
48+
## Exact Source Changes
49+
50+
### 1) `games/network_sample_c/game/ReconciliationLayerAdapter.js`
51+
If a local `isPlainObject` function exists:
52+
- remove the local `isPlainObject` function definition
53+
- add exactly one import:
54+
55+
```js
56+
import { isPlainObject } from "../../../src/shared/utils/objectUtils.js";
57+
```
58+
59+
Rules:
60+
- do not duplicate imports
61+
- do not modify other helpers
62+
- do not modify logic
63+
64+
If no local `isPlainObject` exists:
65+
- leave file unchanged
66+
67+
---
68+
69+
### 2) `games/network_sample_c/game/StateTimelineBuffer.js`
70+
If a local `isPlainObject` function exists:
71+
- remove the local `isPlainObject` function definition
72+
- add exactly one import:
73+
74+
```js
75+
import { isPlainObject } from "../../../src/shared/utils/objectUtils.js";
76+
```
77+
78+
Rules:
79+
- do not duplicate imports
80+
- do not modify other helpers
81+
- do not modify logic
82+
83+
If no local `isPlainObject` exists:
84+
- leave file unchanged
85+
86+
---
87+
88+
### 3) `src/shared/utils/objectUtils.js`
89+
Do not modify implementation logic.
90+
91+
Allowed edit only:
92+
- if `isPlainObject` exists but is not exported, make the minimum export change required
93+
94+
If already exported, leave unchanged.
95+
96+
## Hard Constraints
97+
- do not edit any file other than the 3 listed above
98+
- do not change helper behavior
99+
- do not modify number helpers
100+
- do not modify promotion snapshot logic
101+
- do not perform repo-wide cleanup
102+
- keep one PR purpose only
103+
104+
## Validation Checklist
105+
1. Confirm no more than the 3 listed files changed
106+
2. Confirm `src/shared/utils/objectUtils.js` exists
107+
3. Confirm `src/shared/utils/objectUtils.js` exports `isPlainObject`
108+
4. Confirm no local `isPlainObject` definitions remain in:
109+
- `games/network_sample_c/game/ReconciliationLayerAdapter.js` (if originally present)
110+
- `games/network_sample_c/game/StateTimelineBuffer.js` (if originally present)
111+
5. Confirm consumer imports now point exactly to:
112+
- `../../../src/shared/utils/objectUtils.js`
113+
6. Confirm no other logic changed
114+
115+
## Non-Goals
116+
- no work in other samples
117+
- no work in advanced layer
118+
- no broader object helper normalization
119+
- no new helper creation
120+
- no refactor beyond this exact duplicate-removal step
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# BUILD_PR_SHARED_EXTRACTION_14_NETWORK_SAMPLE_C_IMPORT_CONSOLIDATION
2+
3+
## Purpose
4+
Consolidate duplicate shared-helper import lines inside the network_sample_c game slice without changing behavior.
5+
6+
## Single PR Purpose
7+
Normalize only shared-helper import structure in:
8+
9+
- `games/network_sample_c/game/ReconciliationLayerAdapter.js`
10+
- `games/network_sample_c/game/StateTimelineBuffer.js`
11+
12+
This BUILD does **not** remove or add helper usage. It only consolidates import statements from the same shared module when safe.
13+
14+
## Exact Files Allowed
15+
Edit only these 2 files:
16+
17+
1. `games/network_sample_c/game/ReconciliationLayerAdapter.js`
18+
2. `games/network_sample_c/game/StateTimelineBuffer.js`
19+
20+
Do not edit any other file.
21+
22+
## Exact Consolidation Rules
23+
24+
### Shared number helper imports
25+
If a file contains multiple import lines from:
26+
27+
```js
28+
../../../src/shared/utils/numberUtils.js
29+
```
30+
31+
and those imports can be combined without changing meaning, consolidate them into one import line.
32+
33+
Example target form:
34+
```js
35+
import { asFiniteNumber, asPositiveInteger } from "../../../src/shared/utils/numberUtils.js";
36+
```
37+
38+
### Shared object helper imports
39+
If a file contains multiple import lines from:
40+
41+
```js
42+
../../../src/shared/utils/objectUtils.js
43+
```
44+
45+
and those imports can be combined without changing meaning, consolidate them into one import line.
46+
47+
Example target form:
48+
```js
49+
import { isPlainObject } from "../../../src/shared/utils/objectUtils.js";
50+
```
51+
52+
## File-Specific Rules
53+
54+
### 1) `games/network_sample_c/game/ReconciliationLayerAdapter.js`
55+
Allowed:
56+
- combine multiple imports from `../../../src/shared/utils/numberUtils.js` into one line
57+
- combine multiple imports from `../../../src/shared/utils/objectUtils.js` into one line
58+
- remove duplicate imported specifiers if present
59+
60+
Not allowed:
61+
- no helper additions
62+
- no helper removals if the helper is used
63+
- no logic changes
64+
- no edits to unrelated imports
65+
66+
### 2) `games/network_sample_c/game/StateTimelineBuffer.js`
67+
Allowed:
68+
- combine multiple imports from `../../../src/shared/utils/numberUtils.js` into one line
69+
- combine multiple imports from `../../../src/shared/utils/objectUtils.js` into one line
70+
- remove duplicate imported specifiers if present
71+
72+
Not allowed:
73+
- no helper additions
74+
- no helper removals if the helper is used
75+
- no logic changes
76+
- no edits to unrelated imports
77+
78+
## Hard Constraints
79+
- do not edit any file other than the 2 listed above
80+
- do not change import paths
81+
- do not introduce alias imports
82+
- do not reorder unrelated imports
83+
- do not change formatting beyond the minimum needed to consolidate shared-helper imports
84+
- do not touch advanced files
85+
- do not touch shared helper files
86+
- keep one PR purpose only
87+
88+
## Validation Checklist
89+
1. Confirm only the 2 listed files changed
90+
2. Confirm each shared module is imported at most once per file:
91+
- `../../../src/shared/utils/numberUtils.js`
92+
- `../../../src/shared/utils/objectUtils.js`
93+
3. Confirm no used helper import was removed
94+
4. Confirm no new helper import was added unless it only came from consolidation of already-present imports
95+
5. Confirm no logic changed
96+
97+
## Non-Goals
98+
- no alias migration
99+
- no repo-wide import consolidation
100+
- no formatting cleanup beyond minimum consolidation
101+
- no helper behavior changes
102+
- no consumer redesign
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# BUILD_PR_SHARED_EXTRACTION_15_ALIAS_IMPORTS_ADVANCED_ONLY
2+
3+
## Purpose
4+
Introduce a safe alias-import proof point for shared helpers in the advanced layer only.
5+
6+
## Single PR Purpose
7+
Switch shared-helper imports in these 2 files from relative paths to the `@shared/*` alias:
8+
9+
1. `src/advanced/promotion/createPromotionGate.js`
10+
2. `src/advanced/state/createWorldGameStateSystem.js`
11+
12+
This BUILD includes the minimum repo config needed to make `@shared/*` resolve for this proof-point scope.
13+
14+
## Exact Files Allowed
15+
Edit only these files:
16+
17+
1. `src/advanced/promotion/createPromotionGate.js`
18+
2. `src/advanced/state/createWorldGameStateSystem.js`
19+
20+
Plus the minimum alias-config file(s) already present in the repo, chosen from this allowed set only if needed:
21+
22+
3. `jsconfig.json`
23+
4. `tsconfig.json`
24+
5. `vite.config.js`
25+
6. `vite.config.mjs`
26+
7. `webpack.config.js`
27+
28+
Do not edit any other file.
29+
Do not create a new config file if one suitable file already exists.
30+
31+
## Alias Target
32+
Use this alias namespace only:
33+
34+
```js
35+
@shared/
36+
```
37+
38+
It must resolve to:
39+
40+
```js
41+
src/shared/
42+
```
43+
44+
## Fail-Fast Gate
45+
Before making source edits:
46+
47+
1. Identify one existing config file from the allowed set that is actually used by the repo for import resolution.
48+
2. Confirm it can support the `@shared/*` alias with a minimal change.
49+
50+
If no suitable existing config file is present or the resolution mechanism is unclear:
51+
- stop
52+
- report blocker
53+
- make no changes
54+
- do not create a delta ZIP
55+
56+
Do **not** invent a new toolchain or add broad config in this PR.
57+
58+
## Exact Source Changes
59+
60+
### 1) `src/advanced/promotion/createPromotionGate.js`
61+
Replace only shared-helper relative imports with alias imports.
62+
63+
Expected alias forms:
64+
```js
65+
import { asFiniteNumber } from '@shared/utils/numberUtils.js';
66+
import { asPositiveInteger } from '@shared/utils/numberUtils.js';
67+
import { isPlainObject } from '@shared/utils/objectUtils.js';
68+
import { createPromotionStateSnapshot } from '@shared/state/createPromotionStateSnapshot.js';
69+
```
70+
71+
Rules:
72+
- preserve current imported specifiers
73+
- if imports from the same aliased module can be combined without changing behavior/style, minimum-edit combination is allowed
74+
- do not touch unrelated imports
75+
- do not change logic
76+
77+
### 2) `src/advanced/state/createWorldGameStateSystem.js`
78+
Replace only shared-helper relative imports with alias imports.
79+
80+
Expected alias forms:
81+
```js
82+
import { asFiniteNumber } from '@shared/utils/numberUtils.js';
83+
import { asPositiveInteger } from '@shared/utils/numberUtils.js';
84+
import { isPlainObject } from '@shared/utils/objectUtils.js';
85+
import { createPromotionStateSnapshot } from '@shared/state/createPromotionStateSnapshot.js';
86+
```
87+
88+
Rules:
89+
- preserve current imported specifiers
90+
- if imports from the same aliased module can be combined without changing behavior/style, minimum-edit combination is allowed
91+
- do not touch unrelated imports
92+
- do not change logic
93+
94+
## Exact Config Change Rules
95+
In the one chosen existing config file:
96+
- add the minimum alias mapping necessary for `@shared/*` -> `src/shared/*`
97+
- do not add unrelated aliases
98+
- do not reformat the whole config
99+
- do not change build behavior beyond what is needed for alias resolution
100+
- do not add testing, lint, or IDE settings beyond the single alias need in the chosen file
101+
102+
## Hard Constraints
103+
- do not edit any file other than the 2 source files plus one chosen existing config file from the allowed set
104+
- do not touch engine files
105+
- do not touch sample files
106+
- do not migrate aliases repo-wide
107+
- do not remove `.js` extensions from imports
108+
- do not change helper behavior
109+
- keep one PR purpose only
110+
111+
## Validation Checklist
112+
1. Confirm no more than 3 files changed
113+
2. Confirm exactly 2 advanced files now import shared helpers via `@shared/...`
114+
3. Confirm the chosen existing config file resolves `@shared/*` to `src/shared/*`
115+
4. Confirm no unrelated imports changed
116+
5. Confirm no logic changed
117+
6. Confirm no sample or engine file was touched
118+
119+
## Non-Goals
120+
- no repo-wide alias migration
121+
- no alias rollout to samples
122+
- no alias rollout to engine
123+
- no path cleanup outside the 2 exact advanced files
124+
- no toolchain redesign

0 commit comments

Comments
 (0)