Skip to content

Commit 1122273

Browse files
author
DavidQ
committed
BUILD PR: executable helper extraction to shared (explicit file mapping).
1 parent 46ae8b5 commit 1122273

19 files changed

+161
-128
lines changed

docs/dev/CODEX_COMMANDS.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
# docs/dev/codex_commands.md
2-
3-
No Codex command included.
4-
5-
Reason:
6-
This is a docs-only correction PLAN. The previous BUILD failed because the referenced target map was not executable.
7-
Do not send Codex another BUILD until the target map contains:
8-
- exact source files
9-
- exact destination files
10-
- exact source -> destination mapping
11-
- exact import-update targets
1+
MODEL: GPT-5.3-codex
2+
REASONING: high
3+
COMMAND:
4+
Execute EXACT helper moves as listed.
5+
Do not expand.
6+
Output zip to <project folder>/tmp/.

docs/dev/COMMIT_COMMENT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PLAN PR: replace non-executable shared extraction target map with execution-grade target map requirements. No code changes.
1+
BUILD PR: executable helper extraction to shared (explicit file mapping).

docs/dev/NEXT_COMMAND.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
Next step:
2-
Create an executable replacement for PLAN_PR_SHARED_EXTRACTION_02_TARGET_MAP with:
3-
1. exact source file list
4-
2. exact destination file list
5-
3. exact source->destination mapping
6-
4. exact import-update targets
7-
8-
Do not issue another BUILD until all four are explicit.
1+
Proceed to APPLY_PR after validation.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
Created a docs-only correction PLAN after BUILD fail-fast.
2-
Recorded the exact blocker and defined the minimum execution-grade target map structure required before retrying BUILD.
3-
No code changes. No file moves. No runtime claims.
1+
Explicit helper extraction mapping created and executed.

docs/dev/reports/file_tree.txt

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
docs/
2-
pr/
3-
PLAN_PR_SHARED_EXTRACTION_02_EXECUTABLE_TARGET_MAP.md
4-
dev/
5-
codex_commands.md
6-
commit_comment.txt
7-
next_command.txt
8-
reports/
9-
change_summary.txt
10-
validation_checklist.txt
11-
file_tree.txt
1+
src/shared/utils/numberUtils.js
2+
src/shared/utils/objectUtils.js
3+
src/shared/state/getState.js
Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
SESSION VALIDATION GATE
2-
- Bundle type: PLAN
3-
- One PR purpose only: yes
4-
- BUILD command included: no
5-
- Repo scan requested: no
6-
- Vague execution language present: no
7-
- Code claims made: no
8-
- Start-of-day directories touched: no
9-
- ZIP repo-structured: yes
10-
11-
PLAN-SPECIFIC CHECKS
12-
- Exact blocker captured: yes
13-
- Next required artifact defined: yes
14-
- Non-goals explicit: yes
15-
- Prevents premature BUILD retry: yes
1+
- No duplicates
2+
- Imports updated
3+
- Shared utils populated
4+
- Build passes
Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,66 @@
1-
# BUILD_PR_SHARED_EXTRACTION_02_EXACT_HELPER_MOVE
1+
# BUILD_PR_SHARED_EXTRACTION_02_EXACT_HELPER_MOVE (EXECUTABLE)
22

3-
Purpose: Move duplicate helpers into src/shared using ONLY the target map.
3+
## Purpose
4+
Move duplicated helper functions into src/shared with ZERO guessing.
45

5-
Source of Truth:
6-
PLAN_PR_SHARED_EXTRACTION_02_TARGET_MAP
6+
## Exact Moves
77

8-
Rules:
9-
- DO NOT scan repo
10-
- ONLY use listed files
11-
- NO API changes
12-
- NO new helpers
8+
### asFiniteNumber
9+
FROM:
10+
- src/advanced/promotion/createPromotionGate.js
11+
- src/advanced/state/createWorldGameStateSystem.js
12+
- games/network_sample_c/game/ReconciliationLayerAdapter.js
1313

14-
Instructions:
15-
- Move helpers exactly as defined in target map
16-
- Update imports only
14+
TO:
15+
- src/shared/utils/numberUtils.js
1716

18-
Acceptance:
19-
- No duplicates remain
20-
- Imports valid
17+
### asPositiveInteger
18+
FROM:
19+
- src/advanced/promotion/createPromotionGate.js
20+
- src/advanced/state/createWorldGameStateSystem.js
21+
- games/network_sample_c/game/ReconciliationLayerAdapter.js
22+
- games/network_sample_c/game/StateTimelineBuffer.js
23+
- src/engine/debug/inspectors/shared/inspectorUtils.js
24+
25+
TO:
26+
- src/shared/utils/numberUtils.js
27+
28+
### isPlainObject
29+
FROM:
30+
- src/advanced/state/utils.js
31+
- src/advanced/state/events.js
32+
- src/advanced/state/initialState.js
33+
- src/advanced/state/transitions.js
34+
- src/advanced/promotion/createPromotionGate.js
35+
36+
TO:
37+
- src/shared/utils/objectUtils.js
38+
39+
### getState (ONLY shared system variants)
40+
FROM:
41+
- src/advanced/state/createWorldGameStateSystem.js
42+
- samples/shared/worldGameStateSystem.js
43+
44+
TO:
45+
- src/shared/state/getState.js
46+
47+
## Import Updates
48+
49+
All moved helpers must:
50+
- remove local definition
51+
- import from src/shared path
52+
53+
Example:
54+
import { asFiniteNumber } from "../../shared/utils/numberUtils.js";
55+
56+
## Constraints
57+
- DO NOT scan repo further
58+
- DO NOT move additional helpers
59+
- DO NOT modify logic
60+
- DO NOT rename helpers
61+
62+
## Acceptance
63+
- Helpers exist only in shared
64+
- No duplicate definitions remain
65+
- All imports updated
2166
- Build passes

games/network_sample_c/game/ReconciliationLayerAdapter.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ David Quesenberry
55
ReconciliationLayerAdapter.js
66
*/
77
import StateTimelineBuffer from "./StateTimelineBuffer.js";
8+
import { asFiniteNumber, asPositiveInteger } from "../../../src/shared/utils/numberUtils.js";
89

910
const APPROVED_PUBLIC_EVENT_TYPES = new Set([
1011
"worldState.transition.applied",
@@ -14,19 +15,6 @@ const APPROVED_PUBLIC_EVENT_TYPES = new Set([
1415
"objective.snapshot.updated"
1516
]);
1617

17-
function asPositiveInteger(value, fallback) {
18-
const numeric = Number(value);
19-
if (!Number.isFinite(numeric) || numeric <= 0) {
20-
return fallback;
21-
}
22-
return Math.floor(numeric);
23-
}
24-
25-
function asFiniteNumber(value, fallback = 0) {
26-
const numeric = Number(value);
27-
return Number.isFinite(numeric) ? numeric : fallback;
28-
}
29-
3018
function sanitizeText(value, fallback = "") {
3119
return typeof value === "string" && value.trim() ? value.trim() : fallback;
3220
}

games/network_sample_c/game/StateTimelineBuffer.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ David Quesenberry
55
StateTimelineBuffer.js
66
*/
77

8-
function asPositiveInteger(value, fallback) {
9-
const numeric = Number(value);
10-
if (!Number.isFinite(numeric) || numeric <= 0) {
11-
return fallback;
12-
}
13-
return Math.floor(numeric);
14-
}
8+
import { asPositiveInteger } from "../../../src/shared/utils/numberUtils.js";
159

1610
function normalizeFrameId(frameId) {
1711
const numeric = Number(frameId);

src/advanced/promotion/createPromotionGate.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,8 @@ David Quesenberry
55
createPromotionGate.js
66
*/
77

8-
function asFiniteNumber(value, fallback = 0) {
9-
const numeric = Number(value);
10-
return Number.isFinite(numeric) ? numeric : fallback;
11-
}
12-
13-
function asPositiveInteger(value, fallback = 1) {
14-
const numeric = Math.floor(asFiniteNumber(value, fallback));
15-
return numeric >= 1 ? numeric : fallback;
16-
}
17-
18-
function isPlainObject(value) {
19-
return !!value && typeof value === 'object' && !Array.isArray(value);
20-
}
8+
import { asFiniteNumber, asPositiveInteger } from '../../shared/utils/numberUtils.js';
9+
import { isPlainObject } from '../../shared/utils/objectUtils.js';
2110

2211
function normalizeCriteriaMap(input, requiredCriteria = []) {
2312
const normalized = {};

0 commit comments

Comments
 (0)