Skip to content

Commit 10e5874

Browse files
author
DavidQ
committed
BUILD PR: validate direct consumer import/export edges for extracted shared helpers only.
1 parent 8d6e35b commit 10e5874

9 files changed

Lines changed: 227 additions & 11 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
MODEL: GPT-5.3-codex
22
REASONING: high
33
COMMAND:
4-
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_10_SHARED_UTIL_CONSOLIDATION_CHECK.md exactly.
5-
Edit only these files:
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
8+
- games/network_sample_c/game/ReconciliationLayerAdapter.js
69
- src/shared/utils/numberUtils.js
710
- src/shared/utils/objectUtils.js
8-
Fail fast if either file does not exist.
11+
- src/shared/state/createPromotionStateSnapshot.js
12+
Fail fast if any required shared file is missing or a required helper/export is absent entirely.
913
Do not expand scope.
10-
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_10_SHARED_UTIL_CONSOLIDATION_CHECK_delta.zip
14+
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_11_CONSUMER_EDGE_VALIDATION_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: consolidate duplicate definitions and export consistency inside shared util files only.
1+
BUILD PR: validate direct consumer import/export edges for extracted shared helpers only.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Built the next executable shared-extraction step focused only on internal consistency of the shared utility files.
1+
Built a narrow consumer-edge validation BUILD limited to the known extracted helper consumers and their shared export files.

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_10_SHARED_UTIL_CONSOLIDATION_CHECK.md
3+
BUILD_PR_SHARED_EXTRACTION_11_CONSUMER_EDGE_VALIDATION.md
44
dev/
55
codex_commands.md
66
commit_comment.txt

docs/dev/reports/validation_checklist.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +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
56
- Fail-fast rule explicit: yes
6-
- No consumer changes allowed: yes
7-
- No guessing: yes
7+
- No repo-wide scan language: yes
8+
- Scope minimized: yes
89
- ZIP repo-structured and execution-ready: yes
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# BUILD_PR_SHARED_EXTRACTION_11_CONSUMER_EDGE_VALIDATION
2+
3+
## Purpose
4+
Validate the immediate consumer edges for the helpers extracted into shared utilities and fix only direct import-path breakage if present.
5+
6+
## Single PR Purpose
7+
Check and, if necessary, repair direct consumer imports for these shared helpers only:
8+
9+
- `asFiniteNumber`
10+
- `asPositiveInteger`
11+
- `isPlainObject`
12+
- `createPromotionStateSnapshot`
13+
14+
This BUILD is a narrow consumer-edge validation pass, not a refactor.
15+
16+
## Exact Files Allowed
17+
Edit only these files if needed:
18+
19+
1. `src/advanced/promotion/createPromotionGate.js`
20+
2. `src/advanced/state/createWorldGameStateSystem.js`
21+
3. `games/network_sample_c/game/ReconciliationLayerAdapter.js`
22+
4. `src/shared/utils/numberUtils.js`
23+
5. `src/shared/utils/objectUtils.js`
24+
6. `src/shared/state/createPromotionStateSnapshot.js`
25+
26+
Do not edit any other file.
27+
28+
## Allowed Validation Scope
29+
Only validate the direct import/export edge among the 6 exact files above.
30+
31+
That means:
32+
- confirm the 3 consumer files import the expected shared helpers correctly
33+
- confirm the 3 shared files export the expected helpers correctly
34+
35+
Do not inspect, modify, or normalize unrelated consumers.
36+
37+
## Exact Expected Consumer Imports
38+
39+
### 1) `src/advanced/promotion/createPromotionGate.js`
40+
Expected shared helper imports:
41+
```js
42+
import { asFiniteNumber } from '../../shared/utils/numberUtils.js';
43+
import { asPositiveInteger } from '../../shared/utils/numberUtils.js';
44+
import { isPlainObject } from '../../shared/utils/objectUtils.js';
45+
import { createPromotionStateSnapshot } from '../shared/state/createPromotionStateSnapshot.js';
46+
```
47+
48+
Rules:
49+
- if imports are already correct, leave them unchanged
50+
- if duplicate imports exist for any of the listed helpers, collapse to one correct import
51+
- if one combined import from the same file is possible without changing behavior/style, prefer the minimum-edit option
52+
- do not touch unrelated imports
53+
54+
### 2) `src/advanced/state/createWorldGameStateSystem.js`
55+
Expected shared helper imports:
56+
```js
57+
import { asFiniteNumber } from '../../shared/utils/numberUtils.js';
58+
import { asPositiveInteger } from '../../shared/utils/numberUtils.js';
59+
import { isPlainObject } from '../../shared/utils/objectUtils.js';
60+
import { createPromotionStateSnapshot } from '../../shared/state/createPromotionStateSnapshot.js';
61+
```
62+
63+
Rules:
64+
- if imports are already correct, leave them unchanged
65+
- if duplicate imports exist for any of the listed helpers, collapse to one correct import
66+
- if one combined import from the same file is possible without changing behavior/style, prefer the minimum-edit option
67+
- do not touch unrelated imports
68+
69+
### 3) `games/network_sample_c/game/ReconciliationLayerAdapter.js`
70+
Expected shared helper import:
71+
```js
72+
import { asFiniteNumber } from '../../../src/shared/utils/numberUtils.js';
73+
```
74+
75+
Rules:
76+
- if import is already correct, leave it unchanged
77+
- do not add any other helper import to this file
78+
- do not touch unrelated imports
79+
80+
## Exact Expected Shared Exports
81+
82+
### 4) `src/shared/utils/numberUtils.js`
83+
Must export exactly these helpers for this PR's validation scope:
84+
- `asFiniteNumber`
85+
- `asPositiveInteger`
86+
87+
Allowed edits:
88+
- minimum export-fix only if one of those helpers is present but not exported correctly
89+
- if exports are already correct, leave unchanged
90+
91+
Not allowed:
92+
- no behavior changes
93+
- no new helper additions
94+
- no renaming
95+
96+
### 5) `src/shared/utils/objectUtils.js`
97+
Must export:
98+
- `isPlainObject`
99+
100+
Allowed edits:
101+
- minimum export-fix only if present but not exported correctly
102+
- if already correct, leave unchanged
103+
104+
Not allowed:
105+
- no behavior changes
106+
- no new helper additions
107+
- no renaming
108+
109+
### 6) `src/shared/state/createPromotionStateSnapshot.js`
110+
Must export:
111+
- `createPromotionStateSnapshot`
112+
113+
Allowed edits:
114+
- minimum export-fix only if present but not exported correctly
115+
- if already correct, leave unchanged
116+
117+
Not allowed:
118+
- no behavior changes
119+
- no renaming
120+
- no file move
121+
122+
## Fail-Fast Rule
123+
If any of the 3 shared files do not exist:
124+
- stop
125+
- report blocker
126+
- make no changes
127+
- do not produce a delta ZIP
128+
129+
If a required helper is missing entirely from a listed shared file:
130+
- stop
131+
- report blocker
132+
- make no changes
133+
- do not invent implementation in this PR
134+
135+
## Hard Constraints
136+
- edit only the 6 listed files
137+
- fix import/export edge issues only
138+
- no logic changes
139+
- no file creation
140+
- no repo-wide scan
141+
- no broader consumer normalization
142+
- no engine or sample refactor
143+
- keep one PR purpose only
144+
145+
## Validation Checklist
146+
1. Confirm no more than the 6 listed files changed
147+
2. Confirm `src/shared/utils/numberUtils.js` exports:
148+
- `asFiniteNumber`
149+
- `asPositiveInteger`
150+
3. Confirm `src/shared/utils/objectUtils.js` exports:
151+
- `isPlainObject`
152+
4. Confirm `src/shared/state/createPromotionStateSnapshot.js` exports:
153+
- `createPromotionStateSnapshot`
154+
5. Confirm the 3 consumer files import the expected helpers from the exact paths listed above
155+
6. Confirm no helper behavior changed
156+
7. Confirm no unrelated consumers were touched
157+
158+
## Non-Goals
159+
- no repo-wide consumer audit
160+
- no alias path migration
161+
- no formatting cleanup
162+
- no lint-only edits
163+
- no helper redesign
164+
- no new shared helper creation

find_dupes.bat

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
set "temp_raw=%temp%\js_raw.txt"
5+
set "temp_sorted=%temp%\js_sorted.txt"
6+
7+
:: Clean up old files
8+
if exist "%temp_raw%" del "%temp_raw%"
9+
10+
echo Searching for functions...
11+
12+
:: Extract potential function names
13+
:: This looks for 'function NAME(' or 'NAME = function' or 'NAME: function'
14+
for /r %%f in (*.js) do (
15+
findstr /r /c:"function [a-zA-Z0-9_]*(" /c:"[a-zA-Z0-9_]* = function" /c:"[a-zA-Z0-9_]*: function" "%%f" >> "%temp_raw%" 2>nul
16+
)
17+
18+
if not exist "%temp_raw%" (
19+
echo No JS files or functions found.
20+
pause
21+
exit /b
22+
)
23+
24+
echo Checking for duplicates...
25+
echo -----------------------
26+
27+
:: Sort the raw lines to bring duplicates together
28+
sort "%temp_raw%" > "%temp_sorted%"
29+
30+
set "prev="
31+
set "found=0"
32+
33+
:: Compare current line to previous line
34+
for /f "tokens=*" %%g in (%temp_sorted%) do (
35+
if "%%g"=="!prev!" (
36+
echo Duplicate line: %%g
37+
set "found=1"
38+
)
39+
set "prev=%%g"
40+
)
41+
42+
if %found%==0 echo No duplicates found.
43+
44+
:: Cleanup
45+
del "%temp_raw%"
46+
del "%temp_sorted%"
47+
pause

src/advanced/promotion/createPromotionGate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ David Quesenberry
55
createPromotionGate.js
66
*/
77

8-
import { asPositiveInteger } from '../../shared/utils/numberUtils.js';
8+
import { asFiniteNumber, asPositiveInteger } from '../../shared/utils/numberUtils.js';
99
import { isPlainObject } from '../../shared/utils/objectUtils.js';
1010
import { createPromotionStateSnapshot } from '../shared/state/createPromotionStateSnapshot.js';
1111

src/advanced/state/createWorldGameStateSystem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
createTransitionRejectedEvent
2020
} from './events.js';
2121
import { createPromotionStateSnapshot } from '../../shared/state/createPromotionStateSnapshot.js';
22-
import { asPositiveInteger } from '../../shared/utils/numberUtils.js';
22+
import { asFiniteNumber, asPositiveInteger } from '../../shared/utils/numberUtils.js';
2323
import { isPlainObject } from '../../shared/utils/objectUtils.js';
2424
import {
2525
cloneDeep,

0 commit comments

Comments
 (0)