Skip to content

Commit 31aabd0

Browse files
author
DavidQ
committed
Combine the Shared Foundation lane into one low-PR consolidation pass
BUILD_PR_LEVEL_03_SHARED_FOUNDATION_COMBINED_PASS
1 parent 9452273 commit 31aabd0

32 files changed

Lines changed: 680 additions & 98 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,42 @@ MODEL: GPT-5.4
22
REASONING: high
33

44
COMMAND:
5-
Create `BUILD_PR_LEVEL_02_2D_CAPABILITY_COMBINED_FOUNDATION` as one combined 2D capability PR.
5+
Create `BUILD_PR_LEVEL_03_SHARED_FOUNDATION_COMBINED_PASS` as one combined Section-3 PR.
66

77
Goal:
8-
Finish the 2D Engine Capability cluster in the fewest practical PRs.
8+
Finish as much of Shared Foundation (`src/shared`) as truthfully possible in one pass.
99

10-
Target items to close in this PR if truthfully possible:
11-
- 2D scene boot
12-
- 2D render loop
13-
- 2D camera
14-
- 2D tilemap integration
15-
- 2D collision patterns
16-
- 2D gameplay hooks
10+
Target items to close in this PR if supported:
11+
- arrays utilities consolidated
12+
- strings utilities consolidated
13+
- ids utilities consolidated
14+
- shared math layer consolidated
15+
- shared state guards consolidated
16+
- shared state normalization consolidated
17+
- shared selectors consolidated
18+
- shared contracts consolidated
19+
- shared io/data/types stabilized
1720

1821
Required work:
19-
1. Treat these as one coherent 2D engine slice, not six isolated tasks.
20-
2. Bundle the work logically:
21-
- scene boot + render loop + gameplay hooks
22-
- camera + tilemap integration
23-
- collision patterns + gameplay hooks
24-
3. Reuse existing validated repo patterns where possible.
25-
4. Keep the implementation engine-facing and reusable.
26-
5. Avoid game-specific hacks unless they are already the accepted engine pattern.
27-
6. Close as many of the six items as truthfully possible in this one PR.
28-
7. If anything remains open:
22+
1. Treat the utility cluster as one lane:
23+
- arrays
24+
- strings
25+
- ids
26+
- shared math
27+
28+
2. Treat the shared-state cluster as one lane:
29+
- state guards
30+
- state normalization
31+
- selectors
32+
- contracts
33+
34+
3. Stabilize shared io/data/types enough to support and close as much of the above as possible.
35+
36+
4. Reuse existing exact-cluster extraction patterns already established in the repo.
37+
38+
5. Close as many Section-3 items as truthfully possible in this one PR.
39+
40+
6. If anything remains open:
2941
- keep the residue very small
3042
- report exact blockers
3143
- leave it suitable for one residue-only PR
@@ -36,10 +48,10 @@ Roadmap:
3648

3749
Final packaging step is REQUIRED:
3850
- package ALL changed files into this exact repo-structured ZIP:
39-
`<project folder>/tmp/BUILD_PR_LEVEL_02_2D_CAPABILITY_COMBINED_FOUNDATION.zip`
51+
`<project folder>/tmp/BUILD_PR_LEVEL_03_SHARED_FOUNDATION_COMBINED_PASS.zip`
4052

4153
Hard rules:
4254
- combine aggressively to reduce PR count
43-
- coherent implementation over scattered edits
55+
- keep the changes coherent
4456
- no unrelated repo changes
4557
- no missing ZIP

docs/dev/COMMIT_COMMENT.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Combine the 2D engine capability foundation into one low-PR pass
2-
BUILD_PR_LEVEL_02_2D_CAPABILITY_COMBINED_FOUNDATION
1+
Combine the Shared Foundation lane into one low-PR consolidation pass
2+
BUILD_PR_LEVEL_03_SHARED_FOUNDATION_COMBINED_PASS

docs/dev/NEXT_COMMAND.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
BUILD_PR_LEVEL_02_2D_CAPABILITY_RESIDUE_ONLY
1+
BUILD_PR_LEVEL_03_SHARED_FOUNDATION_RESIDUE_ONLY
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
- Added a combined PR for the full 2D Engine Capability cluster
2-
- Bundles scene boot, render loop, camera, tilemap, collision, and gameplay hooks
3-
- Intended to finish the 2D capability lane in one pass or leave only a tiny residue
1+
- Added a combined PR for the Section-3 Shared Foundation lane
2+
- Bundles utilities, shared math, shared state, contracts, and io/data/types stabilization
3+
- Intended to finish most or all of Section 3 in one pass and leave only tiny residue if needed
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
- 2D scene boot addressed
2-
- 2D render loop addressed
3-
- 2D camera addressed
4-
- 2D tilemap integration addressed
5-
- 2D collision patterns addressed
6-
- 2D gameplay hooks addressed
7-
- Any residue is explicit and minimal
8-
- Roadmap updated by status markers only
9-
- Output ZIP created at:
10-
<project folder>/tmp/BUILD_PR_LEVEL_02_2D_CAPABILITY_COMBINED_FOUNDATION.zip
1+
- arrays utilities addressed
2+
- strings utilities addressed
3+
- ids utilities addressed
4+
- shared math addressed
5+
- shared state guards addressed
6+
- shared state normalization addressed
7+
- shared selectors addressed
8+
- shared contracts addressed
9+
- shared io/data/types addressed
10+
- any residue is explicit and minimal
11+
- roadmap updated by status markers only
12+
- output ZIP created at:
13+
<project folder>/tmp/BUILD_PR_LEVEL_03_SHARED_FOUNDATION_COMBINED_PASS.zip

docs/dev/roadmaps/MASTER_ROADMAP_HIGH_LEVEL.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@
176176
- [x] enforcement guard in place
177177
- [x] numbers utilities consolidated
178178
- [x] objects utilities consolidated
179-
- [.] arrays utilities consolidated
180-
- [.] strings utilities consolidated
181-
- [ ] ids utilities consolidated
182-
- [.] shared math layer consolidated
183-
- [ ] shared state guards consolidated
184-
- [ ] shared state normalization consolidated
185-
- [ ] shared selectors consolidated
186-
- [ ] shared contracts consolidated
187-
- [ ] shared io/data/types stabilized
179+
- [x] arrays utilities consolidated
180+
- [x] strings utilities consolidated
181+
- [x] ids utilities consolidated
182+
- [x] shared math layer consolidated
183+
- [x] shared state guards consolidated
184+
- [x] shared state normalization consolidated
185+
- [x] shared selectors consolidated
186+
- [x] shared contracts consolidated
187+
- [x] shared io/data/types stabilized
188188

189189
### Duplicate / Rename Focus
190190
- [x] `asFiniteNumber` unified
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# BUILD_PR_LEVEL_03_SHARED_FOUNDATION_COMBINED_PASS
2+
3+
## Purpose
4+
Complete the Section-3 Shared Foundation lane in one coherent pass centered on `src/shared` boundaries and reusable contracts.
5+
6+
## What was implemented
7+
8+
### 1) Utility cluster consolidation
9+
- Arrays:
10+
- `src/shared/utils/arrayUtils.js` now exposes `asArray` as the shared array-normalization surface.
11+
- `src/shared/utils/objectUtils.js` now reuses array normalization from `arrayUtils` (removes duplicate array normalization behavior).
12+
- Strings:
13+
- `src/shared/utils/stringUtils.js` now owns `escapeHtml`.
14+
- `src/shared/string/stringUtil.js` is now a compatibility re-export surface from shared string utils.
15+
- IDs:
16+
- `src/shared/utils/idUtils.js` normalized with shared helpers:
17+
- `normalizeId`
18+
- `createStableId`
19+
- deterministic prefix-safe `createId` / `generateId`
20+
- `isValidId`
21+
- Shared utility barrel:
22+
- Added `src/shared/utils/index.js` as the consolidated public utility surface.
23+
- Shared math barrel:
24+
- Added `src/shared/math/index.js` exposing number and vector shared math surfaces.
25+
26+
### 2) Shared-state cluster consolidation
27+
- Added explicit shared-state contracts:
28+
- `src/shared/contracts/sharedStateContracts.js`
29+
- `src/shared/contracts/index.js`
30+
- `src/shared/state/contracts.js` (state-facing contract bridge)
31+
- Added shared-state guards:
32+
- `src/shared/state/guards.js`
33+
- Added shared-state normalization:
34+
- `src/shared/state/normalization.js`
35+
- Added shared selectors surface:
36+
- `src/shared/state/selectors.js`
37+
- `src/shared/state/publicSelectors.js` now routes through selectors
38+
- Added shared-state barrel:
39+
- `src/shared/state/index.js`
40+
- Updated promotion state accessor:
41+
- `src/shared/state/getState.js` now uses shared normalization by default.
42+
43+
### 3) Shared io/data/types stabilization
44+
- Added shared types:
45+
- `src/shared/types/typeGuards.js`
46+
- `src/shared/types/index.js`
47+
- Added shared data normalization:
48+
- `src/shared/data/normalization.js`
49+
- `src/shared/data/index.js`
50+
- Added shared io/json surface:
51+
- `src/shared/io/jsonIO.js`
52+
- `src/shared/io/index.js`
53+
- Added shared root barrel:
54+
- `src/shared/index.js`
55+
56+
## Section-3 completion status
57+
- Completed in this PR:
58+
- arrays utilities consolidated
59+
- strings utilities consolidated
60+
- ids utilities consolidated
61+
- shared math layer consolidated
62+
- shared state guards consolidated
63+
- shared state normalization consolidated
64+
- shared selectors consolidated
65+
- shared contracts consolidated
66+
- shared io/data/types stabilized
67+
- Remaining residue:
68+
- no top-level Section-3 residue identified for the target item list.
69+
70+
## Roadmap handling
71+
- Updated Section-3 status markers only in `docs/dev/roadmaps/MASTER_ROADMAP_HIGH_LEVEL.md`.
72+
- No roadmap prose rewrites.
73+
74+
## Validation run
75+
- `node --check` on all touched `src/shared/**/*.js` files
76+
- `node --check tests/shared/SharedFoundationCombinedPass.test.mjs`
77+
- `node --input-type=module -e "import { run } from './tests/shared/SharedFoundationCombinedPass.test.mjs'; run();"`
78+
- Focused non-regression checks:
79+
- `node tests/core/Section1FinalResidueStructure.test.mjs`
80+
- `node tests/render/Renderer.test.mjs`
81+
82+
## Packaging
83+
`<project folder>/tmp/BUILD_PR_LEVEL_03_SHARED_FOUNDATION_COMBINED_PASS.zip`

src/shared/contracts/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
Toolbox Aid
3+
David Quesenberry
4+
04/14/2026
5+
index.js
6+
*/
7+
export {
8+
SHARED_PROMOTION_CONTRACT_ID,
9+
SHARED_PROMOTION_CONTRACT_VERSION,
10+
SHARED_PROMOTION_MODES,
11+
SHARED_STATE_KEYS,
12+
isSharedPromotionMode,
13+
} from "./sharedStateContracts.js";
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Toolbox Aid
3+
David Quesenberry
4+
04/14/2026
5+
sharedStateContracts.js
6+
*/
7+
export const SHARED_PROMOTION_CONTRACT_ID = "toolbox.shared.state.promotion";
8+
export const SHARED_PROMOTION_CONTRACT_VERSION = "1.0.0";
9+
10+
export const SHARED_PROMOTION_MODES = Object.freeze({
11+
PASSIVE: "passive",
12+
AUTHORITATIVE: "authoritative",
13+
});
14+
15+
export const SHARED_STATE_KEYS = Object.freeze({
16+
PROMOTED: "promoted",
17+
STABLE_FRAMES: "stableFrames",
18+
STABILITY_WINDOW_FRAMES: "stabilityWindowFrames",
19+
LAST_REASON: "lastReason",
20+
LAST_EVALUATION: "lastEvaluation",
21+
STATUS: "status",
22+
});
23+
24+
export function isSharedPromotionMode(value) {
25+
return value === SHARED_PROMOTION_MODES.PASSIVE || value === SHARED_PROMOTION_MODES.AUTHORITATIVE;
26+
}

src/shared/data/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
Toolbox Aid
3+
David Quesenberry
4+
04/14/2026
5+
index.js
6+
*/
7+
export { normalizeRecord, normalizeArray, normalizeRecordArray } from "./normalization.js";

0 commit comments

Comments
 (0)