Skip to content

Commit 5497efb

Browse files
author
DavidQ
committed
Deep normalize shared method domains - PR_26140_064-deep-normalize-shared-method-domains
1 parent 5a30298 commit 5497efb

20 files changed

Lines changed: 84 additions & 79 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# PR_26140_064 Deep Normalize Shared Method Domains
2+
3+
## Summary
4+
- Moved JSON read/write helpers from `src/shared/io/jsonIO.js` to `src/shared/json/jsonIO.js`.
5+
- Moved shared record/object normalization into `src/shared/object/objects.js`.
6+
- Moved shared array normalization into `src/shared/array/arrays.js` and record-array normalization into `src/shared/array/recordArrays.js`.
7+
- Moved `isRecord` consumers to the object domain and `isNonEmptyString` to the string domain.
8+
- Removed unused pass-through shared files for `src/shared/index.js`, `src/shared/io/index.js`, `src/shared/data/index.js`, `src/shared/data/normalization.js`, and `src/shared/types/index.js`.
9+
10+
## Domain Audit Decisions
11+
- `safeJsonParse`, `safeJsonStringify`, `cloneJsonData`: JSON serialization/deserialization helpers; canonical file is now `src/shared/json/jsonIO.js`.
12+
- `normalizeRecord`: object/record coercion helper; canonical file is now `src/shared/object/objects.js`.
13+
- `normalizeArray`: array coercion helper; canonical file is now `src/shared/array/arrays.js`.
14+
- `normalizeRecordArray`: array-of-records helper; canonical file is now `src/shared/array/recordArrays.js`.
15+
- `isRecord`: object/record predicate; canonical file is now `src/shared/object/objects.js`.
16+
- `isNonEmptyString`: string predicate; canonical file is now `src/shared/string/strings.js`.
17+
- `isFunction` and `isBoolean`: retained in `src/shared/types/typeGuards.js` because they are primitive type predicates and not array/object/string/json methods.
18+
- Existing state, contract, debug, game, runtime, validation, math, number, id, and geometry methods were reviewed and left in their current domain folders where the file domain already matched the exported behavior.
19+
20+
## Guardrail Checks
21+
- `src/shared/io/jsonIO.js` no longer exists.
22+
- `src/shared/data/normalization.js` no longer exists, so array methods do not remain there.
23+
- No active imports or references remain for moved `shared/io`, `shared/data`, root `shared/index`, or `types/index` paths outside excluded historical/report areas.
24+
- No root-level shared pass-through export file remains at `src/shared/index.js`.
25+
- No `../` export chains exist under `src/shared/**/*.js`.
26+
- No sample JSON files were modified.
27+
28+
## Validation
29+
- PASS: targeted syntax validation for 14 changed JavaScript files, including untracked files.
30+
- PASS: targeted import-target validation for 14 changed JavaScript files, including untracked files.
31+
- PASS: `npm run test:workspace-v2` with 59 passed.
32+
- PASS: stale moved-path scan for active JavaScript.
33+
- PASS: `git diff --check` completed with only Git CRLF normalization warnings for existing files.
34+
35+
## Coverage Guardrail
36+
- Playwright generated the existing advisory V8 coverage report. Missing/low coverage entries remain WARN-only per project instructions.
37+
38+
## Full Samples Smoke Test
39+
- Skipped. This PR only changes shared import/domain placement and the requested validation covered syntax/import correctness plus Workspace V2 behavior.
40+
41+
## Manual Validation
42+
1. Review `docs/dev/reports/codex_review.diff` for the shared domain moves and import updates.
43+
2. Confirm `src/shared/json/jsonIO.js`, `src/shared/object/objects.js`, and `src/shared/array/recordArrays.js` are the canonical locations for the moved methods.
44+
3. Confirm Workspace Manager V2 still launches and runs through the tested tool flows.

games/Asteroids/game/asteroidsObjectGeometryManifest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getObjectVectorCollisionOutlinePoints } from '/src/engine/collision/index.js';
2-
import { isRecord } from '/src/shared/types/typeGuards.js';
2+
import { isRecord } from '/src/shared/object/objects.js';
33
import { deepClone } from '/src/shared/json/clone.js';
44

55
const ASTEROIDS_OBJECT_VECTOR_TOOL_KEY = 'object-vector-studio-v2';

samples/phase-17/shared/overlayGameplayRuntime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
LEVEL17_OVERLAY_CYCLE_KEY,
1111
} from '/samples/phase-17/shared/overlayCycleInput.js';
1212
import { normalizeOverlayRuntimeExtensions } from '/samples/phase-17/shared/overlayRuntimeExtensionNormalization.js';
13-
import { cloneJsonData, safeJsonParse, safeJsonStringify } from '/src/shared/io/index.js';
13+
import { cloneJsonData, safeJsonParse, safeJsonStringify } from '/src/shared/json/jsonIO.js';
1414
import { asFiniteNumber } from '/src/shared/number/index.js';
1515

1616
const overlayRuntimePreferenceMemoryStore = new Map();

src/engine/collision/objectVector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
normalizeObjectVectorTransform,
1414
transformRuntimeOrientedPoints,
1515
} from '../rendering/OrientationTransform.js';
16-
import { isRecord } from '../../shared/types/typeGuards.js';
16+
import { isRecord } from '../../shared/object/objects.js';
1717
import { deepClone } from '../../shared/json/clone.js';
1818
import { asFiniteNumber } from '../../shared/number/index.js';
1919

src/engine/rendering/ObjectVectorTransformService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isRecord } from "../../shared/types/typeGuards.js";
1+
import { isRecord } from "../../shared/object/objects.js";
22
import { asFiniteNumber } from "../../shared/number/index.js";
33

44
const DEGREES_PER_RADIAN = 180 / Math.PI;

src/shared/array/arrays.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ export function ensureArray(value) {
44
return Array.isArray(value) ? value : [];
55
}
66

7+
export function normalizeArray(value) {
8+
return Array.isArray(value) ? value : [];
9+
}
10+
711
export function asArray(value) {
812
return ensureArray(value);
913
}

src/shared/array/recordArrays.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { normalizeArray } from "./arrays.js";
2+
import { normalizeRecord } from "../object/objects.js";
3+
4+
export function normalizeRecordArray(value) {
5+
return normalizeArray(value).map((entry) => normalizeRecord(entry));
6+
}

src/shared/data/index.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/shared/data/normalization.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/shared/index.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)