Skip to content

Commit c8c425b

Browse files
author
DavidQ
committed
Continue cleanup of unnecessary export aliasing and canonicalize shared utility names - PR_26140_037-remove-export-alias-confusion
1 parent 29855a4 commit c8c425b

15 files changed

Lines changed: 88 additions & 19 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# PR_26140_037 Remove Export Alias Confusion Report
2+
3+
## Scope
4+
- Continued PR_26140_036 alias cleanup with a focus on export aliases.
5+
- Removed active non-default export aliases where compatibility was not required.
6+
- Kept behavior unchanged; changes are name-surface cleanup only.
7+
- Did not touch vendor, generated, archive, report snapshot, or `tests/results` files.
8+
9+
## Implementation Summary
10+
- Removed `deepClone as clone` from Collision Inspector V2 constants and imported `deepClone` directly where used.
11+
- Removed `asArray as asObjectArray` from the shared utils barrel; the canonical `asArray` export remains from `arrayUtils`.
12+
- Renamed the promotion helper export source from `getState` to canonical `getPromotionState`, removing `getState as getPromotionState` from the shared state barrel.
13+
- Removed unused compatibility exports `LegacyAttractModeController` and `legacySummary3d`.
14+
- Renamed the Asteroids boot export to canonical `bootAsteroids` and updated active tests/imports away from `bootAsteroidsNew as bootAsteroids`.
15+
- Removed the Pacman `opposite` compatibility export and updated the active ghost controller to use `oppositeCardinalDirection` directly.
16+
17+
## Alias Search Results
18+
Non-default export alias search:
19+
20+
`rg --pcre2 -n "^\\s*export\\s+\\{(?!\\s*default\\b).*\\bas\\b" games tools src -g "*.js" -g "*.mjs" -g "!**/node_modules/**" -g "!**/tests/results/**" -g "!docs/dev/reports/**" -g "!docs/archive/**"`
21+
22+
Result: no matches.
23+
24+
Broader active import/export `as` search still reports intentional leftovers:
25+
26+
- `games/Asteroids/utils/math.js` keeps `import { wrap as sharedWrap } ...` because this file exposes the Asteroids-specific `wrap(value, max)` adapter over shared `wrap(value, min, max)`. Renaming that public helper or rewriting all consumers is outside this export-alias PR and would change a game utility surface.
27+
- `src/shared/index.js` keeps `export * as sharedMath/sharedUtils/...` namespace exports as the deliberate top-level shared namespace barrel.
28+
- `export { default as ... }` entries in engine/tool barrels remain because default-export modules need named public barrel exports; changing those would require a broad public API migration.
29+
30+
Removed compatibility bridges not actively required:
31+
32+
- `tools/collision-inspector-v2/js/constants.js`: `deepClone as clone`.
33+
- `src/shared/utils/index.js`: `asArray as asObjectArray`.
34+
- `src/shared/state/index.js`: `getState as getPromotionState`.
35+
- `src/engine/scene/AttractModeController.js`: `AttractModeController as LegacyAttractModeController`.
36+
- `src/engine/debug/standard/threeD/index.js`: `export * as legacySummary3d`.
37+
- `games/Asteroids/main.js`: `bootAsteroidsNew as bootAsteroids`.
38+
- `games/Pacman/game/PacmanFullAINavigator.js`: `oppositeCardinalDirection as opposite`.
39+
40+
## Validation
41+
- INFO: `npm run build` is not defined in this repo (`Missing script: "build"`).
42+
- PASS: `npm run build:manifest`.
43+
- PASS: changed-file syntax sanity via `node --check` for every changed `.js`/`.mjs` file after fixing the duplicate `asArray` barrel export.
44+
- PASS: `node tests/games/AsteroidsValidation.test.mjs`.
45+
- PASS: `node tests/games/AsteroidsManifestScreenDimensions.test.mjs`.
46+
- PASS: `node tests/games/AsteroidsPresentation.test.mjs`.
47+
- PASS: `node tests/tools/ObjectVectorFinalRuntimeCleanup.test.mjs`.
48+
- PASS: `node tests/tools/ObjectVectorStudioV2DeleteCleanup.test.mjs`.
49+
- INFO: extra `node tests/games/PacmanFullAIValidation.test.mjs` was attempted because Pacman naming changed, but the test cannot resolve existing browser-absolute `/src/...` imports under plain Node (`C:\\src\\engine\\scene\\index.js`).
50+
- INFO: first `npm run test:workspace-v2` run had one transient checkbox interaction miss in the Object Vector Studio V2 shape drawing test; the isolated failing case passed immediately on rerun.
51+
- PASS: final `npm run test:workspace-v2` (58 passed).
52+
- PASS: `npx playwright test tests/playwright/tools/ObjectVectorStudioV2FirstClassToolStarter.spec.mjs --project=playwright --workers=1 --reporter=list` (4 passed).
53+
- PASS: `npx playwright test tests/playwright/tools/CollisionInspectorV2.spec.mjs --project=playwright --workers=1 --reporter=list` (4 passed).
54+
- PASS: `npx playwright test tests/playwright/tools/AsteroidsGameSceneCleanup.spec.mjs --project=playwright --workers=1 --reporter=list` (1 passed).
55+
- PASS: non-default export alias search found no matches.
56+
- PASS: vendor/generated/archive/report snapshot modification check found no matching changed paths.
57+
- PASS: `git diff --check` (CRLF normalization warnings only; no whitespace errors).
58+
59+
## Playwright Impact
60+
Playwright impacted: Yes. Active runtime/tool module surfaces changed for Workspace Manager V2 launch paths, Object Vector Studio V2 validation paths, Collision Inspector V2 manifest cloning, and Asteroids boot naming. Expected pass behavior is unchanged launch/load/render/collision behavior. Expected fail behavior would be module import errors, failed boot, failed tool launch, or broken manifest load; none appeared in final passing runs.
61+
62+
## Coverage
63+
- Advisory Playwright V8 coverage artifacts were refreshed at `docs/dev/reports/playwright_v8_coverage_report.txt` and `docs/dev/reports/coverage_changed_js_guardrail.txt`.
64+
- Missing changed runtime JS coverage is reported as WARN per project rules, not FAIL.
65+
66+
## Full Samples Smoke
67+
Skipped. This PR is a scoped alias/name-surface cleanup covered by targeted Workspace Manager, Asteroids, Object Vector Studio V2, and Collision Inspector V2 validation; it does not broadly change the sample loader/framework.
68+
69+
## Manual Validation Notes
70+
1. Open Workspace Manager V2, select the repo, and confirm games/tools populate.
71+
2. Launch Object Vector Studio V2 from Workspace Manager V2 and confirm schema-valid load still renders.
72+
3. Launch Collision Inspector V2 and confirm manifest objects load.
73+
4. Launch Asteroids and confirm normal gameplay smoke behavior.

games/Asteroids/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export function createAsteroidsTemplateBoot(initialFlow = "attract") {
127127
});
128128
}
129129

130-
export async function bootAsteroidsNew({
130+
export async function bootAsteroids({
131131
documentRef = globalThis.document ?? null,
132132
EngineClass = Engine,
133133
InputServiceClass = InputService,
@@ -273,7 +273,7 @@ export async function bootAsteroidsNew({
273273
}
274274

275275
function tryAutoBoot() {
276-
void bootAsteroidsNew().catch((error) => {
276+
void bootAsteroids().catch((error) => {
277277
traceBootFailure("auto-boot", error);
278278
});
279279
}

games/Asteroids/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from "./index.js";
2-
export { bootAsteroidsNew as bootAsteroids } from "./index.js";
2+
export { bootAsteroids } from "./index.js";
33
export { default } from "./index.js";

games/Pacman/game/PacmanFullAIGhostController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PacmanFullAIGhostController.js
66
*/
77

88
import { near } from '/src/shared/utils/mathUtils.js';
9-
import { chooseDirectionTowardTarget, DIRS, opposite } from './PacmanFullAINavigator.js';
9+
import { chooseDirectionTowardTarget, DIRS, oppositeCardinalDirection } from './PacmanFullAINavigator.js';
1010
import { computeTargetTile } from './PacmanFullAITargeting.js';
1111

1212
function speedForGhost(cfg, mode, ghost, tileX, tileY) {
@@ -26,7 +26,7 @@ export default class PacmanFullAIGhostController {
2626
reverseAll(ghosts) {
2727
ghosts.forEach((g) => {
2828
if (g.inHouse || g.eaten) return;
29-
g.direction = opposite(g.direction) || g.direction;
29+
g.direction = oppositeCardinalDirection(g.direction) || g.direction;
3030
});
3131
}
3232

games/Pacman/game/PacmanFullAINavigator.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,4 @@ function chooseDirectionTowardTarget(grid, tileX, tileY, currentDirection, targe
3838
return ranked[0].dir;
3939
}
4040

41-
export { oppositeCardinalDirection as opposite } from '/src/shared/utils/index.js';
42-
export { DIRS, getLegalDirections, chooseDirectionTowardTarget };
41+
export { DIRS, getLegalDirections, chooseDirectionTowardTarget, oppositeCardinalDirection };

src/engine/debug/standard/threeD/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,3 @@ export {
5151
registerStandard3dDebugPresets
5252
} from "./presets/registerStandard3dDebugPresets.js";
5353
export { createStandard3dDebugPluginDefinition } from "./bootstrap/createStandard3dDebugSurfaceIntegration.js";
54-
export * as legacySummary3d from "./legacySummarySurface.js";

src/engine/scene/AttractModeController.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,4 @@ export default class AttractModeController {
163163
}
164164
}
165165

166-
export { AttractModeController as LegacyAttractModeController };
167166
export { DEFAULT_ATTRACT_CONFIG };

src/shared/state/getState.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ getState.js
88
import { createPromotionStateSnapshot } from './createPromotionStateSnapshot.js';
99
import { createNormalizedPromotionSnapshot } from './normalization.js';
1010

11-
function getState({
11+
function getPromotionState({
1212
promoted,
1313
stableFrames,
1414
stabilityWindowFrames,
@@ -37,4 +37,4 @@ function getState({
3737
});
3838
}
3939

40-
export { getState };
40+
export { getPromotionState };

src/shared/state/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ David Quesenberry
44
04/14/2026
55
index.js
66
*/
7-
export { getState as getPromotionState } from "./getState.js";
7+
export { getPromotionState } from "./getState.js";
88
export { createPromotionStateSnapshot } from "./createPromotionStateSnapshot.js";
99
export { createNormalizedPromotionSnapshot, normalizePromotionStateInput } from "./normalization.js";
1010
export { isStateContainer, readState, isPromotionStateSnapshot } from "./guards.js";

src/shared/utils/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export {
2626
isValidId,
2727
} from "../id/index.js";
2828
export { isFiniteNumber, toFiniteNumber, asFiniteNumber, asPositiveInteger, asPositiveNumber } from "../number/index.js";
29-
export { isObject, isPlainObject, asObject, toObject, asArray as asObjectArray } from "./objectUtils.js";
29+
export { isObject, isPlainObject, asObject, toObject } from "./objectUtils.js";
3030
export { cloneJson, deepClone } from "./jsonUtils.js";
3131
export { stringifyValue } from "./stringifyValueUtils.js";
3232
export { oppositeCardinalDirection } from "./directionUtils.js";

0 commit comments

Comments
 (0)