Skip to content

Commit 8107dbe

Browse files
author
DavidQ
committed
Clean samples shared barrel and utility patterns - PR_26140_078-clean-samples-shared-barrel-and-utils
1 parent f18284f commit 8107dbe

28 files changed

Lines changed: 79 additions & 62 deletions
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# PR_26140_078 Samples Shared Cleanup Report
2+
3+
## Scope
4+
- Removed sample-level pass-through utility files in `samples/shared`:
5+
- `debugConfigUtils.js`
6+
- `networkDebugUtils.js`
7+
- `numberUtils.js`
8+
- `snapshotCloneUtils.js`
9+
- Removed the sample-level `worldSystems.js` barrel.
10+
- Updated sample imports to direct canonical owners:
11+
- shared debug config from `/src/shared/debug/config.js`
12+
- shared network debug helpers from `/src/shared/debug/network.js`
13+
- shared number helpers from `/src/shared/number/numbers.js`
14+
- shared snapshot clone helper from `/src/shared/runtime/snapshotClone.js`
15+
- world system classes/functions from `samples/shared/worldSystems/*`
16+
- Updated `tests/samples/SamplesProgramCombinedPass.test.mjs` so its canonical samples/shared list no longer expects removed pass-through files.
17+
- Kept sample entry `index.js` files intact.
18+
- No sample JSON files were changed.
19+
- No schema files were changed.
20+
- No replacement pass-through files or shims were created.
21+
22+
## Validation Notes
23+
- The first focused `SamplesProgramCombinedPass` run exposed an existing UTF-8 BOM in `samples/metadata/samples.index.metadata.json`. Sample JSON was not modified; the test reader now tolerates a leading BOM so the affected sample/shared boundary test can run.
24+
25+
## Validation Results
26+
- PASS: targeted syntax validation for all changed existing `.js` and `.mjs` files using `node --check`.
27+
- PASS: targeted import-resolution validation confirmed import targets exist for 22 changed JS/MJS files.
28+
- PASS: `rg -n "worldSystems\.js|debugConfigUtils\.js|networkDebugUtils\.js|numberUtils\.js|snapshotCloneUtils\.js" samples tests --glob "*.js" --glob "*.mjs" --glob "*.html" --glob "*.css" --glob "!tests/results/**"` returned no active references.
29+
- PASS: `rg -n "^export .* from" samples/shared --glob "*.js"` returned no remaining samples/shared barrel-style re-exports.
30+
- PASS: `node --input-type=module -e "const m = await import('./tests/samples/SamplesProgramCombinedPass.test.mjs'); await m.run(); console.log('PASS SamplesProgramCombinedPass');"`.
31+
- PASS: `npm run test:workspace-v2` passed 59 tests.
32+
- PASS: JSON change audit found no changed `.json` files.
33+
34+
## Full Samples Smoke Test
35+
- Skipped. This PR changes sample import plumbing and sample shared helper ownership; targeted syntax/import validation plus `SamplesProgramCombinedPass` covered the affected sample/shared paths without broadly changing sample loader behavior.
36+
37+
## Manual Validation Notes
38+
- Confirm code search finds no active references to the removed sample shared helper names.
39+
- Confirm the phase 13 world-system samples still import their world-system components from `samples/shared/worldSystems/*`.
40+
- Confirm sample JSON remains untouched.

samples/phase-12/1205/main.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Engine from '/src/engine/core/Engine.js';
88
import InputService from '/src/engine/input/InputService.js';
99
import { Theme } from '/src/engine/theme/Theme.js';
1010
import { ThemeTokens } from '/src/engine/theme/ThemeTokens.js';
11-
import { resolveDebugConfig } from '../../shared/debugConfigUtils.js';
11+
import { resolveDebugConfig } from '/src/shared/debug/config.js';
1212
import { createSampleGameDevConsoleIntegration } from '../../../tools/dev/devConsoleIntegration.js';
1313
import MultiSystemDemoScene from './MultiSystemDemoScene.js';
1414

@@ -49,4 +49,3 @@ engine.start();
4949
// Keep explicit palette JSON discoverable by audit tooling.
5050
const SAMPLE_1205_PALETTE_PATH = './sample.1205.palette.json';
5151
void SAMPLE_1205_PALETTE_PATH;
52-

samples/phase-12/1208/ToolFormattedTilesParallaxScene.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Camera2D from '/src/engine/camera/Camera2D.js';
1212
import { worldRectToScreen } from '/src/engine/camera/CameraSystem.js';
1313
import Tilemap from '/src/engine/tilemap/Tilemap.js';
1414
import { resolveRectVsTilemap } from '/src/engine/tilemap/TilemapCollision.js';
15-
import { isFiniteNumber } from '../../shared/numberUtils.js';
15+
import { isFiniteNumber } from '/src/shared/number/numbers.js';
1616

1717
const theme = new Theme(ThemeTokens);
1818
const TILEMAP_PRESET_PATH = './sample.1208.tile-map-editor.json';

samples/phase-13/1303/AsteroidsWorldSystemsScene.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ import Scene from '/src/engine/scene/Scene.js';
88
import { Theme } from '/src/engine/theme/Theme.js';
99
import { ThemeTokens } from '/src/engine/theme/ThemeTokens.js';
1010
import { drawFrame, drawPanel } from '/src/engine/debug/DebugPanel.js';
11-
import { isFiniteNumber } from '../../shared/numberUtils.js';
12-
import { SpawnSystem, LifecycleSystem, WorldStateSystem, EventsSystem, distanceSq } from '/samples/shared/worldSystems.js';
11+
import { isFiniteNumber } from '/src/shared/number/numbers.js';
12+
import { SpawnSystem } from '/samples/shared/worldSystems/SpawnSystem.js';
13+
import { LifecycleSystem } from '/samples/shared/worldSystems/LifecycleSystem.js';
14+
import { WorldStateSystem } from '/samples/shared/worldSystems/WorldStateSystem.js';
15+
import { EventsSystem } from '/samples/shared/worldSystems/EventsSystem.js';
16+
import { distanceSq } from '/samples/shared/worldSystems/distanceSq.js';
1317

1418
const theme = new Theme(ThemeTokens);
1519
const ASTEROID_MIN_SPEED = 20;

samples/phase-13/1309/SpaceInvadersWorldSystemsScene.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import Scene from '/src/engine/scene/Scene.js';
88
import { Theme } from '/src/engine/theme/Theme.js';
99
import { ThemeTokens } from '/src/engine/theme/ThemeTokens.js';
1010
import { drawFrame, drawPanel } from '/src/engine/debug/DebugPanel.js';
11-
import { SpawnSystem, LifecycleSystem, WorldStateSystem, EventsSystem, distanceSq } from '/samples/shared/worldSystems.js';
11+
import { SpawnSystem } from '/samples/shared/worldSystems/SpawnSystem.js';
12+
import { LifecycleSystem } from '/samples/shared/worldSystems/LifecycleSystem.js';
13+
import { WorldStateSystem } from '/samples/shared/worldSystems/WorldStateSystem.js';
14+
import { EventsSystem } from '/samples/shared/worldSystems/EventsSystem.js';
15+
import { distanceSq } from '/samples/shared/worldSystems/distanceSq.js';
1216

1317
const theme = new Theme(ThemeTokens);
1418
const INVADERS_VALIDATION_PRESETS = {

samples/phase-13/1313/PacmanLiteWorldSystemsScene.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import Scene from '/src/engine/scene/Scene.js';
88
import { Theme } from '/src/engine/theme/Theme.js';
99
import { ThemeTokens } from '/src/engine/theme/ThemeTokens.js';
1010
import { drawFrame, drawPanel } from '/src/engine/debug/DebugPanel.js';
11-
import { SpawnSystem, LifecycleSystem, WorldStateSystem, EventsSystem, distanceSq } from '/samples/shared/worldSystems.js';
11+
import { SpawnSystem } from '/samples/shared/worldSystems/SpawnSystem.js';
12+
import { LifecycleSystem } from '/samples/shared/worldSystems/LifecycleSystem.js';
13+
import { WorldStateSystem } from '/samples/shared/worldSystems/WorldStateSystem.js';
14+
import { EventsSystem } from '/samples/shared/worldSystems/EventsSystem.js';
15+
import { distanceSq } from '/samples/shared/worldSystems/distanceSq.js';
1216

1317
const theme = new Theme(ThemeTokens);
1418

samples/phase-13/1316/debug/networkSampleADebug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
commandLinesForTrace,
1414
getCommandSnapshot,
1515
toNetworkSnapshot
16-
} from "../../../shared/networkDebugUtils.js";
16+
} from "/src/shared/debug/network.js";
1717

1818
const NETWORK_SAMPLE_KEY = "networkSampleA";
1919

samples/phase-13/1316/game/FakeLoopbackNetworkModel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FakeLoopbackNetworkModel.js
66
*/
77

88
import { clamp } from "../../../../src/shared/math/scalars.js";
9-
import { asPositiveNumber } from '../../../shared/numberUtils.js';
9+
import { asPositiveNumber } from '/src/shared/number/numbers.js';
1010
import { createLatencyModel } from "../../_shared/latencyModel.js";
1111

1212
const MAX_TRACE_EVENTS = 80;

samples/phase-13/1316/game/NetworkSampleAScene.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ NetworkSampleAScene.js
77
import Scene from '/src/engine/scene/Scene.js';
88
import FakeLoopbackNetworkModel from "./FakeLoopbackNetworkModel.js";
99
import { clamp } from "/src/shared/math/scalars.js";
10-
import { asPositiveNumber } from "../../../shared/numberUtils.js";
10+
import { asPositiveNumber } from "/src/shared/number/numbers.js";
1111

1212
const VIEW_WIDTH = 960;
1313
const VIEW_HEIGHT = 720;

samples/phase-13/1316/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Engine from "/src/engine/core/Engine.js";
88
import InputService from "/src/engine/input/InputService.js";
99
import { Theme } from "/src/engine/theme/Theme.js";
1010
import { ThemeTokens } from "/src/engine/theme/ThemeTokens.js";
11-
import { resolveDebugConfig } from "../../shared/debugConfigUtils.js";
11+
import { resolveDebugConfig } from "/src/shared/debug/config.js";
1212
import { createSampleGameDevConsoleIntegration } from "../../../tools/dev/devConsoleIntegration.js";
1313
import { createNetworkSampleADebugPlugin } from "./debug/networkSampleADebug.js";
1414
import NetworkSampleAScene from "./game/NetworkSampleAScene.js";

0 commit comments

Comments
 (0)