Skip to content

Commit df128b2

Browse files
author
DavidQ
committed
BUILD PR: switch network_sample_c shared helper imports to @shared alias only.
1 parent 7f32e33 commit df128b2

10 files changed

Lines changed: 143 additions & 14 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
MODEL: GPT-5.3-codex
22
REASONING: high
33
COMMAND:
4-
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_15B_ALIAS_CONFIG_BOOTSTRAP_JSCONFIG_ONLY.md exactly.
4+
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_16_ALIAS_IMPORTS_NETWORK_SAMPLE_C.md exactly.
55
Edit only these files:
6-
- jsconfig.json (new file)
7-
- src/advanced/promotion/createPromotionGate.js
8-
- src/advanced/state/createWorldGameStateSystem.js
9-
Fail fast if any required shared target file is missing.
6+
- games/network_sample_c/game/ReconciliationLayerAdapter.js
7+
- games/network_sample_c/game/StateTimelineBuffer.js
8+
Fail fast if jsconfig.json is missing, the @shared alias is not present, or required shared target files are missing.
109
Do not expand scope.
11-
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_15B_ALIAS_CONFIG_BOOTSTRAP_JSCONFIG_ONLY_delta.zip
10+
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_16_ALIAS_IMPORTS_NETWORK_SAMPLE_C_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: add minimal jsconfig @shared alias bootstrap and switch advanced shared imports only.
1+
BUILD PR: switch network_sample_c shared helper imports to @shared alias only.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Replaced the blocked alias BUILD with an execution-grade retry that explicitly creates a minimal jsconfig.json and switches only the two advanced files to @shared imports.
1+
Built the next executable alias rollout step, limited to network_sample_c only and assuming the existing @shared alias bootstrap.

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_15B_ALIAS_CONFIG_BOOTSTRAP_JSCONFIG_ONLY.md
3+
BUILD_PR_SHARED_EXTRACTION_16_ALIAS_IMPORTS_NETWORK_SAMPLE_C.md
44
dev/
55
codex_commands.md
66
commit_comment.txt
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
SESSION VALIDATION GATE
22
- Bundle type: BUILD
33
- One PR purpose only: yes
4-
- Exact files listed: yes
5-
- Exact new file content listed: yes
6-
- Prior failure cause addressed directly: yes
4+
- Exact target files listed: yes
5+
- Config untouched by design: yes
76
- Fail-fast gate explicit: yes
87
- Scope minimized: yes
98
- ZIP repo-structured and execution-ready: yes
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# BUILD_PR_SHARED_EXTRACTION_16_ALIAS_IMPORTS_NETWORK_SAMPLE_C
2+
3+
## Purpose
4+
Extend the proven `@shared/*` alias usage to the network_sample_c consumer slice only.
5+
6+
## Single PR Purpose
7+
Switch shared-helper imports in these 2 files from relative paths to the existing `@shared/*` alias:
8+
9+
1. `games/network_sample_c/game/ReconciliationLayerAdapter.js`
10+
2. `games/network_sample_c/game/StateTimelineBuffer.js`
11+
12+
This BUILD assumes the prior alias bootstrap is already present and does not modify config.
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+
## Alias Assumption
23+
The repo already contains alias support for:
24+
25+
```js
26+
@shared/
27+
```
28+
29+
resolving to:
30+
31+
```js
32+
src/shared/
33+
```
34+
35+
Do not modify `jsconfig.json` or any other config file in this PR.
36+
37+
## Fail-Fast Gate
38+
Before making source edits, confirm:
39+
40+
1. `jsconfig.json` exists
41+
2. it contains `@shared/*` -> `src/shared/*`
42+
3. these shared targets exist:
43+
- `src/shared/utils/numberUtils.js`
44+
- `src/shared/utils/objectUtils.js`
45+
46+
If any condition is false:
47+
- stop
48+
- report blocker
49+
- make no changes
50+
- do not create a delta ZIP
51+
52+
## Exact Source Changes
53+
54+
### 1) `games/network_sample_c/game/ReconciliationLayerAdapter.js`
55+
Replace only shared-helper relative imports with alias imports.
56+
57+
Target alias forms:
58+
```js
59+
import { asFiniteNumber, asPositiveInteger } from '@shared/utils/numberUtils.js';
60+
import { isPlainObject } from '@shared/utils/objectUtils.js';
61+
```
62+
63+
Rules:
64+
- preserve existing imported specifiers
65+
- if imports from the same aliased module can be combined without changing behavior/style, minimum-edit combination is allowed
66+
- do not touch unrelated imports
67+
- do not change logic
68+
- do not add snapshot helper import unless this file already uses it
69+
70+
### 2) `games/network_sample_c/game/StateTimelineBuffer.js`
71+
Replace only shared-helper relative imports with alias imports.
72+
73+
Target alias forms:
74+
```js
75+
import { asPositiveInteger } from '@shared/utils/numberUtils.js';
76+
import { isPlainObject } from '@shared/utils/objectUtils.js';
77+
```
78+
79+
Rules:
80+
- preserve existing imported specifiers
81+
- if imports from the same aliased module can be combined without changing behavior/style, minimum-edit combination is allowed
82+
- do not touch unrelated imports
83+
- do not change logic
84+
- do not add `asFiniteNumber` unless this file already imports/uses it
85+
86+
## Hard Constraints
87+
- edit only the 2 listed files
88+
- no config changes
89+
- no engine changes
90+
- no advanced-file changes
91+
- no repo-wide alias rollout
92+
- no removal of `.js` extensions
93+
- no helper behavior changes
94+
- keep one PR purpose only
95+
96+
## Validation Checklist
97+
1. Confirm only the 2 listed files changed
98+
2. Confirm both files now import shared helpers via `@shared/...`
99+
3. Confirm no unrelated imports changed
100+
4. Confirm no logic changed
101+
5. Confirm no config file was touched
102+
103+
## Non-Goals
104+
- no alias rollout to engine
105+
- no alias rollout repo-wide
106+
- no import cleanup outside the 2 exact files
107+
- no toolchain redesign
108+
- no helper redesign

games/network_sample_c/game/ReconciliationLayerAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ David Quesenberry
55
ReconciliationLayerAdapter.js
66
*/
77
import StateTimelineBuffer from "./StateTimelineBuffer.js";
8-
import { asFiniteNumber, asPositiveInteger } from "../../../src/shared/utils/numberUtils.js";
8+
import { asFiniteNumber, asPositiveInteger } from "@shared/utils/numberUtils.js";
99

1010
const APPROVED_PUBLIC_EVENT_TYPES = new Set([
1111
"worldState.transition.applied",

games/network_sample_c/game/StateTimelineBuffer.js

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

8-
import { asPositiveInteger } from "../../../src/shared/utils/numberUtils.js";
8+
import { asPositiveInteger } from "@shared/utils/numberUtils.js";
99

1010
function normalizeFrameId(frameId) {
1111
const numeric = Number(frameId);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# 1. Get all .js files recursively
2+
# 2. Look for function patterns
3+
# 3. Group them by the text found
4+
# 4. Filter for groups with more than 1 occurrence
5+
6+
# .\find_dupes_called.ps1 > found_dupes_called.txt
7+
# .\find_dupes_called.ps1 | Out-File -FilePath "found_dupes_called.txt" -Encoding utf8
8+
9+
# Goes up 3 levels to reach HTML-JavaScript-Gaming from tools\shared\powerShell\
10+
Get-ChildItem -Path "$PSScriptRoot\..\..\..\" -Recurse -Filter *.js |
11+
Select-String -Pattern "function\s+[a-zA-Z0-9_]*\(", "[a-zA-Z0-9_]*\s*=\s*function", "[a-zA-Z0-9_]*:\s*function" |
12+
Group-Object Line |
13+
Where-Object { $_.Count -gt 1 } |
14+
ForEach-Object {
15+
# Print the duplicate line and the count
16+
"($($_.Count)) Duplicate line: $($_.Name.Trim())"
17+
18+
# Loop through each occurrence in the group to show where it is
19+
$_.Group | ForEach-Object {
20+
" -> Line $($_.LineNumber): $($_.Path)"
21+
}
22+
"" # Adds a blank line for better readability
23+
}

tools/shared/powerShell/found_dupes_called.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)