Skip to content

Commit cbd4e22

Browse files
committed
build(runtime-loader): add strict packaged runtime asset loader
1 parent 7592951 commit cbd4e22

12 files changed

Lines changed: 500 additions & 23 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,28 @@ MODEL: GPT-5.4
22
REASONING: high
33

44
COMMAND:
5-
Execute this atomic Level 12 package in order.
5+
Execute this atomic Level 13 package in order.
66

77
Step 1:
8-
Treat docs/pr/PLAN_PR_PROJECT_PACKAGING_SYSTEM.md as the governing architecture contract.
8+
Treat docs/pr/PLAN_PR_RUNTIME_ASSET_LOADER.md as the governing architecture contract.
99

1010
Step 2:
11-
Create BUILD_PR_PROJECT_PACKAGING_SYSTEM.
11+
Create BUILD_PR_RUNTIME_ASSET_LOADER.
1212

1313
BUILD requirements:
14-
- Implement a strict project packaging and export system
15-
- Generate deterministic package manifests and dependency-resolved asset inclusion plans
16-
- Enforce strict validation gating before guarded packaging/export
17-
- Use registry as source of truth for asset identity
18-
- Use dependency graph for dependency traversal
19-
- Produce readable, stable packaging reports
20-
- Support Sprite Editor, Tile Map Editor, and Parallax Editor packaging participation as needed
14+
- Implement a strict runtime asset loader for packaged project output
15+
- Consume package manifest as runtime entry authority
16+
- Enforce deterministic load sequencing
17+
- Produce stable loader status/reporting
18+
- Fail fast on invalid packaged input or missing required packaged assets
19+
- Provide runtime bootstrap handoff for packaged projects
2120
- Do not modify engine core APIs
2221

2322
Step 3:
24-
Validate BUILD against docs/pr/BUILD_PR_PROJECT_PACKAGING_SYSTEM.md.
23+
Validate BUILD against docs/pr/BUILD_PR_RUNTIME_ASSET_LOADER.md.
2524

2625
Step 4:
27-
Treat docs/pr/APPLY_PR_PROJECT_PACKAGING_SYSTEM.md as the acceptance boundary and package results.
26+
Treat docs/pr/APPLY_PR_RUNTIME_ASSET_LOADER.md as the acceptance boundary and package results.
2827

2928
Package:
30-
HTML-JavaScript-Gaming/tmp/LEVEL_12_PROJECT_PACKAGING_SYSTEM_STRICT_ATOMIC_PACKAGE_delta.zip
29+
HTML-JavaScript-Gaming/tmp/LEVEL_13_RUNTIME_ASSET_LOADER_STRICT_ATOMIC_PACKAGE_delta.zip

docs/dev/COMMIT_COMMENT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
build(packaging): add strict project packaging and export system
1+
build(runtime-loader): add strict packaged runtime asset loader

docs/dev/change_summary.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Single atomic Level 12 package containing PLAN, BUILD, and APPLY documentation for a strict
2-
project packaging and export system. This bundle is docs-first and Codex-ready, with implementation
1+
Single atomic Level 13 package containing PLAN, BUILD, and APPLY documentation for a strict
2+
packaged runtime asset loader. This bundle is docs-first and Codex-ready, with implementation
33
ownership delegated to Codex.

docs/dev/file_tree.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
docs/pr/PLAN_PR_PROJECT_PACKAGING_SYSTEM.md
2-
docs/pr/BUILD_PR_PROJECT_PACKAGING_SYSTEM.md
3-
docs/pr/APPLY_PR_PROJECT_PACKAGING_SYSTEM.md
1+
docs/pr/PLAN_PR_RUNTIME_ASSET_LOADER.md
2+
docs/pr/BUILD_PR_RUNTIME_ASSET_LOADER.md
3+
docs/pr/APPLY_PR_RUNTIME_ASSET_LOADER.md
44
docs/dev/codex_commands.md
55
docs/dev/commit_comment.txt
66
docs/dev/change_summary.txt
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
BUILD_PR_RUNTIME_ASSET_LOADER validation
2+
3+
Files:
4+
- tools/shared/runtimeAssetLoader.js
5+
- tests/tools/RuntimeAssetLoader.test.mjs
6+
- tests/run-tests.mjs
7+
8+
Checks passed:
9+
- node --check tools/shared/runtimeAssetLoader.js
10+
- node --check tests/tools/RuntimeAssetLoader.test.mjs
11+
- node ./scripts/run-node-tests.mjs
12+
13+
Behavior confirmed:
14+
- package manifest is the runtime authority for packaged asset enumeration
15+
- deterministic packaged asset order drives repeatable runtime load sequencing
16+
- invalid packaged manifests fail before runtime readiness
17+
- missing required packaged assets fail fast with stable reporting
18+
- successful loads produce bootstrap handoff data for packaged projects
19+
- no engine core API changes

docs/dev/validation_checklist.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
- PLAN, BUILD, and APPLY docs are all present
22
- codex_commands.md and commit_comment.txt are under docs/dev
3-
- Strict validation gating is explicit for packaging/export
4-
- Registry remains source of truth
5-
- Dependency graph remains traversal source
6-
- Output determinism is required
3+
- Strict packaged runtime contracts are explicit
4+
- Packaged manifest is runtime entry authority
5+
- Fail-fast behavior is explicit for invalid packaged input
76
- No engine core API changes are authorized
87
- APPLY remains docs-only acceptance boundary
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# APPLY_PR_RUNTIME_ASSET_LOADER
2+
3+
## Purpose
4+
Apply the completed strict runtime asset loader system as a docs-only acceptance boundary.
5+
6+
## Apply Scope
7+
- Confirm PLAN and BUILD are complete
8+
- Confirm strict runtime loader behavior remains within approved scope
9+
- Confirm APPLY introduces no implementation expansion
10+
- Lock strict runtime asset loading as accepted project architecture baseline
11+
12+
## Verification Summary
13+
- BUILD artifact exists and matches scoped runtime loader implementation
14+
- APPLY remains docs-only
15+
- Runtime loader consumes strict packaged output only
16+
- Fail-fast behavior remains limited to invalid packaged runtime input
17+
- No engine core API changes are required by APPLY
18+
19+
## Accepted Baseline
20+
- Project owns a strict packaged runtime loader
21+
- Valid packages can load deterministically to ready state
22+
- Invalid packages fail fast with readable reports
23+
- Runtime bootstrap can rely on packaged manifest authority
24+
25+
## Manual Validation Checklist
26+
1. Confirm BUILD artifact exists in repo tmp path.
27+
2. Confirm APPLY bundle only contains docs/pr and docs/dev files.
28+
3. Confirm accepted scope does not exceed BUILD scope.
29+
4. Confirm no new implementation files are introduced by APPLY.
30+
5. Confirm next planning work can build on strict runtime baseline.
31+
32+
## Approved Commit Comment
33+
build(runtime-loader): add strict packaged runtime asset loader
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# BUILD_PR_RUNTIME_ASSET_LOADER
2+
3+
## Goal
4+
Implement the strict runtime asset loader defined in `PLAN_PR_RUNTIME_ASSET_LOADER` without changing engine core APIs.
5+
6+
## Implemented Scope
7+
- Added shared strict packaged runtime loader in `tools/shared/runtimeAssetLoader.js`
8+
- validates the packaged manifest contract before runtime load begins
9+
- treats the package manifest as the runtime authority for asset enumeration
10+
- executes deterministic sequential loading using packaged asset order
11+
- returns stable `idle/loading/ready/failed` runtime loader state
12+
- fails fast on invalid manifests, missing packaged assets, or loader failures
13+
- produces runtime bootstrap handoff data for packaged project startup
14+
- Added automated coverage in `tests/tools/RuntimeAssetLoader.test.mjs`
15+
- valid packaged runtime load reaches ready state
16+
- repeated loads preserve deterministic order
17+
- missing packaged asset fails fast with stable reporting
18+
- invalid packaged manifest fails before runtime readiness
19+
- Registered the new runtime loader coverage in `tests/run-tests.mjs`
20+
21+
## Manual Validation Checklist
22+
1. Valid packaged project loads successfully. `PASS`
23+
2. Repeated loads of unchanged package produce stable load order. `PASS`
24+
3. Missing required packaged asset fails fast. `PASS`
25+
4. Invalid manifest/package contract fails fast. `PASS`
26+
5. Ready state only occurs after all required startup dependencies resolve. `PASS`
27+
6. Loader reports clearly identify failure boundaries. `PASS`
28+
7. Engine core APIs remain unchanged. `PASS`
29+
30+
## Validation Summary
31+
- Syntax checks passed:
32+
- `node --check tools/shared/runtimeAssetLoader.js`
33+
- `node --check tests/tools/RuntimeAssetLoader.test.mjs`
34+
- Full Node test suite passed:
35+
- `node ./scripts/run-node-tests.mjs`
36+
37+
## Scope Guard
38+
- Runtime loading remains limited to strict packaged output.
39+
- Package manifest remains the runtime entry authority.
40+
- Load sequencing remains deterministic and report-oriented.
41+
- Fail-fast behavior remains scoped to invalid packaged runtime input.
42+
- No engine core API files were modified.
43+
44+
## Approved Commit Comment
45+
build(runtime-loader): add strict packaged runtime asset loader
46+
47+
## Next Command
48+
APPLY_PR_RUNTIME_ASSET_LOADER
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# PLAN_PR_RUNTIME_ASSET_LOADER
2+
3+
## Goal
4+
Define a strict runtime asset loader and execution model that consumes packaged project output and resolves
5+
runtime-ready assets deterministically without changing engine core APIs.
6+
7+
## Context
8+
The project baseline now includes:
9+
- registry-aware editors
10+
- additive project-level asset dependency graph
11+
- enforced asset validation engine
12+
- assistive remediation system
13+
- strict project packaging/export system
14+
15+
The next architectural layer is runtime execution. This system must load packaged outputs in a predictable,
16+
fail-fast way under the assumption that strict packaging already guaranteed correctness.
17+
18+
## Strict Runtime Intent
19+
This PR is intentionally strict.
20+
Runtime loading should assume packaged data is valid and fail fast when required packaged contracts are violated.
21+
22+
## Scope
23+
- Define packaged-input runtime contracts
24+
- Define runtime manifest consumption rules
25+
- Define deterministic asset load ordering
26+
- Define loader lifecycle states
27+
- Define runtime failure boundaries for invalid packaged input
28+
- Define handoff contract from packaging system to runtime loader
29+
30+
## Non-Goals
31+
- No engine core API changes
32+
- No editor-side packaging redesign
33+
- No defensive missing-asset fallback layer
34+
- No runtime repair/remediation system
35+
- No support for invalid packaged content
36+
37+
## Runtime Inputs
38+
- strict package manifest
39+
- dependency-resolved packaged assets
40+
- stable export layout from packaging system
41+
42+
## Runtime Outputs
43+
- loaded runtime asset table
44+
- resolved startup dependency set
45+
- deterministic loader state/reporting
46+
- runtime-ready project bootstrap data
47+
48+
## Proposed Loader State Model
49+
```json
50+
{
51+
"runtimeLoader": {
52+
"status": "idle | loading | ready | failed",
53+
"loadedAssets": [],
54+
"failedAt": null,
55+
"reports": []
56+
}
57+
}
58+
```
59+
60+
## Core Contracts
61+
1. Runtime loader only accepts strict packaged output as input.
62+
2. Package manifest is the runtime authority for packaged asset enumeration.
63+
3. Load order must be deterministic enough for repeatable startup behavior.
64+
4. Missing or invalid required packaged assets must fail fast.
65+
5. Runtime loader does not repair invalid packages.
66+
6. Registry/graph concepts remain authoring-time sources; packaged manifest is runtime entry authority.
67+
7. Loader reports must be stable and human-readable for debugging.
68+
69+
## Runtime Categories
70+
- manifest ingestion
71+
- package layout validation
72+
- deterministic load sequencing
73+
- startup dependency resolution
74+
- fail-fast boundary reporting
75+
- runtime bootstrap handoff
76+
77+
## Shared Responsibilities
78+
- runtime loading logic should be centralized where practical
79+
- packaged manifest consumption should not be reimplemented ad hoc across samples/tools
80+
- reporting should be stable enough for validation and future automation
81+
82+
## Manual Validation Checklist
83+
1. Valid packaged project loads successfully.
84+
2. Repeated loads of unchanged package produce stable load order.
85+
3. Missing required packaged asset fails fast.
86+
4. Invalid manifest/package contract fails fast.
87+
5. Ready state only occurs after all required startup dependencies resolve.
88+
6. Loader reports clearly identify failure boundaries.
89+
7. Engine core APIs remain unchanged.
90+
91+
## Next Command
92+
BUILD_PR_RUNTIME_ASSET_LOADER

tests/run-tests.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ import { run as runStorageService } from './persistence/StorageService.test.mjs'
8787
import { run as runAssetValidationEngine } from './tools/AssetValidationEngine.test.mjs';
8888
import { run as runAssetRemediationSystem } from './tools/AssetRemediationSystem.test.mjs';
8989
import { run as runProjectPackagingSystem } from './tools/ProjectPackagingSystem.test.mjs';
90+
import { run as runRuntimeAssetLoader } from './tools/RuntimeAssetLoader.test.mjs';
9091
import './render/Renderer.test.mjs';
9192
import { run as runReplaySystem } from './replay/ReplaySystem.test.mjs';
9293
import { run as runOrbitLabModel } from './samples/OrbitLabModel.test.mjs';
@@ -168,6 +169,7 @@ const tests = [
168169
['AssetValidationEngine', runAssetValidationEngine],
169170
['AssetRemediationSystem', runAssetRemediationSystem],
170171
['ProjectPackagingSystem', runProjectPackagingSystem],
172+
['RuntimeAssetLoader', runRuntimeAssetLoader],
171173
['ReplaySystem', runReplaySystem],
172174
['OrbitLabModel', runOrbitLabModel],
173175
['OrbitLabScene', runOrbitLabScene],

0 commit comments

Comments
 (0)