Skip to content

Commit 7eebcf3

Browse files
author
DavidQ
committed
BUILD PR: centralize asPositiveNumber across exact network sample batch.
1 parent badd1ff commit 7eebcf3

16 files changed

Lines changed: 810 additions & 93 deletions

MASTER_ROADMAP_HIGH_LEVEL_status_only_updated.md

Lines changed: 577 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# MASTER ROADMAP — HIGH LEVEL (v6 ADDITIVE) — UPDATED
2+
3+
## Status Key
4+
- [x] complete
5+
- [.] in progress
6+
- [ ] planned
7+
8+
---
9+
10+
## 1. Repo Structure Normalization
11+
- [.] target structure defined at high level
12+
- [.] `src/engine` target established
13+
- [.] `src/shared` target established
14+
- [.] `games/` target established
15+
- [.] `games/_template/` target established
16+
- [.] `tools/shared` target established
17+
- [.] phase-based `samples/` grouping target established
18+
- [.] dependency direction rules defined
19+
- [.] shared asset promotion rules defined
20+
- [.] network samples classified as sample-phase content
21+
- [ ] current folder inventory mapped to target homes
22+
- [ ] move-map defined for root `engine/` -> `src/engine/`
23+
- [x] duplicate-helper migration map defined
24+
- [ ] ambiguous-name rename map defined
25+
- [ ] legacy migration map defined
26+
- [ ] implementation PRs executed
27+
- [x] imports normalized after moves
28+
- [ ] post-move validation complete
29+
30+
---
31+
32+
## 3. Shared Foundation (`src/shared`)
33+
- [x] core shared extraction pipeline executed
34+
- [x] enforcement guard in place
35+
- [x] numbers utilities consolidated
36+
- [x] objects utilities consolidated
37+
- [.] arrays utilities consolidated
38+
- [.] strings utilities consolidated
39+
- [ ] ids utilities consolidated
40+
- [ ] shared math layer consolidated
41+
- [ ] shared state guards consolidated
42+
- [ ] shared state normalization consolidated
43+
- [ ] shared selectors consolidated
44+
- [ ] shared contracts consolidated
45+
- [ ] shared io/data/types stabilized
46+
47+
### Duplicate / Rename Focus
48+
- [x] `asFiniteNumber` unified
49+
- [x] `asPositiveInteger` unified
50+
- [x] `isPlainObject` unified
51+
- [.] `getState` variants bucketed by domain
52+
- [ ] `getSimulationState` naming established where needed
53+
- [ ] `getReplayState` naming established where needed
54+
- [ ] `getEditorState` naming established where needed
55+
56+
---
57+
58+
## 6. Samples Program
59+
- [.] sample numbering normalization completed
60+
- [.] sample formatting alignment completed
61+
- [ ] phase grouping normalized
62+
- [ ] `samples/shared` boundaries defined and used
63+
- [ ] sample index normalized to phase structure
64+
- [ ] sample-to-engine dependency cleanup completed
65+
- [x] sample duplicate helper usage reduced
66+
- [ ] sample curriculum progression validated
67+
68+
---
69+
70+
## 7. Phase 13 — Network Concepts
71+
72+
### Track Q — Network Debug Panels
73+
- [x] Connection status panel
74+
- [.] Latency / RTT panel
75+
- [ ] Replication state viewer
76+
- [x] Client/server divergence inspector
77+
- [x] Event tracing panel
78+
79+
### Track R — Network Debug Commands
80+
- [ ] network.help
81+
- [x] network.status
82+
- [x] network.latency
83+
- [.] network.replication
84+
- [x] network.divergence
85+
- [x] network.trace
86+
- [.] network.sample.*
87+
88+
---
89+
90+
## Dependency-Ordered Future Build Sequence
91+
- [ ] Finish current promotion-gate lane (BUILD → APPLY)
92+
- [ ] Apply master roadmap baseline
93+
- [ ] Apply repo structure normalization implementation plan
94+
- [.] Extract / normalize shared utilities
95+
- [ ] Normalize samples phase structure
96+
- [ ] Normalize phase-13 network concepts samples
97+
- [ ] Establish games/_template and normalize games layer
98+
- [ ] Normalize tools/shared and tool boundaries
99+
- [ ] Normalize assets/data ownership
100+
- [ ] Expand testing/validation structure
101+
- [ ] Execute 2D capability polish lanes
102+
- [ ] Execute phase-16 / 3D capability lanes
103+
- [ ] Reduce legacy footprint after replacements are proven

docs/dev/CODEX_COMMANDS.md

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,14 @@
11
MODEL: GPT-5.3-codex
22
REASONING: high
33
COMMAND:
4-
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_31_CLONE_JSON_BATCH_RETRY.md exactly.
4+
Execute docs/pr/BUILD_PR_SHARED_EXTRACTION_34_AS_POSITIVE_NUMBER_NETWORK_BATCH.md exactly.
55
Edit only these files:
6-
- src/shared/utils/jsonUtils.js (new file)
7-
- tools/dev/devConsoleIntegration.js
8-
- tools/dev/advanced/debugMacroRegistry.js
9-
- tools/dev/advanced/debugPanelGroupRegistry.js
10-
- tools/dev/inspectors/inspectorStore.js
11-
- tools/dev/plugins/debugPluginSystem.js
12-
- tools/dev/presets/debugPresetApplier.js
13-
- tools/dev/presets/debugPresetRegistry.js
14-
- tools/shared/assetMarketplace.js
15-
- tools/shared/asteroidsPlatformDemo.js
16-
- tools/shared/cloudRuntime.js
17-
- tools/shared/collaborationSystem.js
18-
- tools/shared/contractVersioning.js
19-
- tools/shared/devConsoleDebugOverlay.js
20-
- tools/shared/hotReloadSystem.js
21-
- tools/shared/multiTargetExport.js
22-
- tools/shared/performanceBenchmarks.js
23-
- tools/shared/platformValidationSuite.js
24-
- tools/shared/pluginArchitecture.js
25-
- tools/shared/renderPipelineContract.js
26-
- tools/shared/runtimeAssetLoader.js
27-
- tools/shared/runtimeSceneLoaderHotReload.js
28-
- tools/shared/runtimeStreaming.js
29-
- tools/shared/vectorAssetSystem.js
30-
- tools/shared/vectorGeometryRuntime.js
31-
- tools/shared/vectorNativeTemplate.js
32-
- tools/shared/vectorTemplateSampleGame.js
33-
- tools/shared/vector/vectorAssetContract.js
34-
- tools/shared/vector/vectorRenderPrep.js
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
3513
Do not expand scope.
36-
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_31_CLONE_JSON_BATCH_RETRY_delta.zip
14+
Package the delta output to <project folder>/tmp/BUILD_PR_SHARED_EXTRACTION_34_AS_POSITIVE_NUMBER_NETWORK_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 cloneJson across exact tools/dev + tools/shared batch.
1+
BUILD PR: centralize asPositiveNumber across exact network sample 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_32_IS_OBJECT_BATCH_RETRY after this batch.
1+
Next: run BUILD_PR_SHARED_EXTRACTION_35_NETWORK_DEBUG_SERIALIZATION_BATCH after this batch.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Replaced the blocked cloneJson BUILD with an execution-grade retry using the exact target file list from the duplicate report.
1+
Execution-grade batch for asPositiveNumber 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; no guessing; one PR purpose only.
1+
Exact file list present; one PR purpose only; no guessing.

docs/dev/roadmaps/MASTER_ROADMAP_HIGH_LEVEL.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@
9292
- [.] network samples classified as sample-phase content
9393
- [ ] current folder inventory mapped to target homes
9494
- [ ] move-map defined for root `engine/` -> `src/engine/`
95-
- [ ] duplicate-helper migration map defined
95+
- [x] duplicate-helper migration map defined
9696
- [ ] ambiguous-name rename map defined
9797
- [ ] legacy migration map defined
9898
- [ ] implementation PRs executed
99-
- [ ] imports normalized after moves
99+
- [x] imports normalized after moves
100100
- [ ] post-move validation complete
101101

102102
### Structure Targets
@@ -156,8 +156,8 @@
156156
- [x] enforcement guard in place
157157
- [x] numbers utilities consolidated
158158
- [x] objects utilities consolidated
159-
- [ ] arrays utilities consolidated
160-
- [ ] strings utilities consolidated
159+
- [.] arrays utilities consolidated
160+
- [.] strings utilities consolidated
161161
- [ ] ids utilities consolidated
162162
- [ ] shared math layer consolidated
163163
- [ ] shared state guards consolidated
@@ -170,7 +170,7 @@
170170
- [x] `asFiniteNumber` unified
171171
- [x] `asPositiveInteger` unified
172172
- [x] `isPlainObject` unified
173-
- [ ] `getState` variants bucketed by domain
173+
- [.] `getState` variants bucketed by domain
174174
- [ ] `getSimulationState` naming established where needed
175175
- [ ] `getReplayState` naming established where needed
176176
- [ ] `getEditorState` naming established where needed
@@ -337,16 +337,16 @@
337337
- [.] Latency / RTT panel
338338
- [ ] Replication state viewer
339339
- [x] Client/server divergence inspector
340-
- [.] Event tracing panel
340+
- [x] Event tracing panel
341341

342342
### Track R — Network Debug Commands
343343
- [ ] network.help
344344
- [x] network.status
345345
- [x] network.latency
346-
- [ ] network.replication
346+
- [.] network.replication
347347
- [x] network.divergence
348348
- [x] network.trace
349-
- [ ] network.sample.*
349+
- [.] network.sample.*
350350

351351
### Track S — Readiness To Promote
352352
- [.] Sample-backed provider validation
@@ -557,7 +557,7 @@
557557
- [ ] Finish current promotion-gate lane (BUILD → APPLY)
558558
- [ ] Apply master roadmap baseline
559559
- [ ] Apply repo structure normalization implementation plan
560-
- [ ] Extract / normalize shared utilities
560+
- [.] Extract / normalize shared utilities
561561
- [ ] Normalize samples phase structure
562562
- [ ] Normalize phase-13 network concepts samples
563563
- [ ] Establish games/_template and normalize games layer
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# BUILD_PR_SHARED_EXTRACTION_34_AS_POSITIVE_NUMBER_NETWORK_BATCH
2+
3+
## Purpose
4+
Centralize duplicated `asPositiveNumber(value, fallback)` implementations across the exact network sample batch identified in the duplicate report.
5+
6+
## Single PR Purpose
7+
Normalize ONLY this helper:
8+
9+
- `asPositiveNumber(value, fallback)`
10+
11+
## Exact Files Allowed
12+
13+
### Shared source
14+
1. `src/shared/utils/numberUtils.js`
15+
16+
### Consumer files
17+
2. `games/network_sample_a/game/FakeLoopbackNetworkModel.js`
18+
3. `games/network_sample_a/game/NetworkSampleAScene.js`
19+
4. `games/network_sample_b/game/FakeHostClientNetworkModel.js`
20+
5. `games/network_sample_b/game/NetworkSampleBScene.js`
21+
6. `games/network_sample_c/game/FakeDivergenceTraceNetworkModel.js`
22+
7. `games/network_sample_c/game/NetworkSampleCScene.js`
23+
24+
Do not edit any other file.
25+
26+
## Source of Truth
27+
This exact file list comes from the provided duplicate report entry for:
28+
29+
`function asPositiveNumber(value, fallback)`
30+
31+
No other numeric helpers are in scope for this PR.
32+
33+
## Shared Helper Assumption
34+
Use the existing shared utility:
35+
36+
`src/shared/utils/numberUtils.js`
37+
38+
Fail fast unless that file exists and exports:
39+
40+
- `asPositiveNumber`
41+
42+
If the file exists and contains `asPositiveNumber` but does not export it correctly, the only allowed shared-file change is the minimum export-only fix.
43+
44+
If the helper does not exist in the shared file, create ONLY this helper in `src/shared/utils/numberUtils.js` by copying one existing local implementation exactly, with no behavior change and no other edits to that file.
45+
46+
## Exact Consumer Changes
47+
For each of the 6 listed consumer files:
48+
49+
If the file contains a local function definition matching:
50+
```js
51+
function asPositiveNumber(value, fallback)
52+
```
53+
then:
54+
- remove the local `asPositiveNumber(value, fallback)` function definition
55+
- import `asPositiveNumber` from the correct relative path to:
56+
- `src/shared/utils/numberUtils.js`
57+
- if the file already imports from that module, add `asPositiveNumber` with the minimum safe edit
58+
- do not duplicate imports
59+
- do not touch unrelated helpers
60+
- do not change logic
61+
62+
If a listed file already imports and uses shared `asPositiveNumber`, leave it unchanged.
63+
64+
## Relative Import Rule
65+
Use the correct relative path from each consumer file to:
66+
67+
`src/shared/utils/numberUtils.js`
68+
69+
Do not use aliases.
70+
Do not change `.js` extension usage.
71+
72+
## Hard Constraints
73+
- no engine changes outside `src/shared/utils/numberUtils.js`
74+
- no game files outside the 6 listed consumers
75+
- no sample files
76+
- no repo-wide number helper cleanup
77+
- no behavior changes
78+
- keep one PR purpose only
79+
80+
## Validation Checklist
81+
1. Confirm no more than the 7 listed files changed
82+
2. Confirm `src/shared/utils/numberUtils.js` exports `asPositiveNumber`
83+
3. Confirm local `function asPositiveNumber(value, fallback)` definitions no longer exist in changed listed consumer files
84+
4. Confirm changed consumer files import `asPositiveNumber` from the correct relative path to `src/shared/utils/numberUtils.js`
85+
5. Confirm no unrelated engine, game, or sample files changed
86+
6. Confirm no behavior changes were made
87+
88+
## Non-Goals
89+
- no cleanup of `asPositiveInteger`
90+
- no cleanup of `asPositiveInt`
91+
- no cleanup outside the 6 listed consumer files
92+
- no refactor beyond this exact duplicate-removal batch

games/network_sample_a/game/FakeLoopbackNetworkModel.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,10 @@ FakeLoopbackNetworkModel.js
66
*/
77

88
import { clamp } from '../../../src/engine/utils/math.js';
9+
import { asPositiveNumber } from '../../../src/shared/utils/numberUtils.js';
910

1011
const MAX_TRACE_EVENTS = 80;
1112

12-
function asPositiveNumber(value, fallback) {
13-
const numeric = Number(value);
14-
if (!Number.isFinite(numeric) || numeric <= 0) {
15-
return fallback;
16-
}
17-
return numeric;
18-
}
19-
2013
function normalizePhase(value) {
2114
const normalized = typeof value === "string" ? value.trim().toLowerCase() : "";
2215
if (normalized === "disconnected" || normalized === "connecting" || normalized === "synchronizing" || normalized === "connected") {

0 commit comments

Comments
 (0)