Skip to content

Commit 0feea9b

Browse files
author
DavidQ
committed
Move shared hot-reload test helpers out of test files to fix test runner imports - PR_11_318A
1 parent e000f0f commit 0feea9b

10 files changed

Lines changed: 367 additions & 243 deletions

File tree

docs/dev/codex_commands.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,10 @@ PR_11_318
173173
```bash
174174
npx @openai/codex run --model gpt-5.3-codex --reasoning medium "Implement PR_11_318: Add Asset Manager V2 row selection + details panel with UI-only selection state and no payload mutation."
175175
```
176+
177+
---
178+
PR_11_318A
179+
180+
```bash
181+
npx @openai/codex run --model gpt-5.3-codex --reasoning medium "Implement PR_11_318A: Remove test-to-test imports by extracting RuntimeSceneLoaderHotReload shared logic into tests/helpers and updating final/tool tests to consume helper."
182+
```

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add Asset Manager V2 asset row selection and details panel with UI-only state - PR 11.318
1+
Decouple Runtime Scene Loader shared logic into tests helper and remove test-to-test imports - PR 11.318A
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# PR_11_318A Report
2+
3+
## Purpose
4+
Fix test runner coupling by removing test-to-test imports and moving shared Runtime Scene Loader hot reload validation logic into a non-test helper module.
5+
6+
## Files Changed
7+
- `tests/helpers/runtimeSceneLoaderHotReload.helpers.mjs`
8+
- `tests/tools/RuntimeSceneLoaderHotReload.test.mjs`
9+
- `tests/final/ToolchainEngineIntegrationValidation.test.mjs`
10+
- `docs/pr/PR_11_318A_TEST_IMPORT_DECOUPLE/PLAN_PR.md`
11+
- `docs/pr/PR_11_318A_TEST_IMPORT_DECOUPLE/BUILD_PR.md`
12+
- `docs/dev/reports/PR_11_318A_report.md`
13+
- `docs/dev/codex_commands.md`
14+
- `docs/dev/commit_comment.txt`
15+
16+
## Implementation Summary
17+
- Extracted shared hot reload validation logic into:
18+
- `tests/helpers/runtimeSceneLoaderHotReload.helpers.mjs`
19+
- Updated tool test to consume helper:
20+
- `tests/tools/RuntimeSceneLoaderHotReload.test.mjs` now calls helper `runRuntimeSceneLoaderHotReloadValidation()`
21+
- Updated final integration test to avoid importing `*.test.mjs` directly:
22+
- removed direct `../tools/*.test.mjs` imports
23+
- runs scoped stage tests via child `node --test` execution
24+
- keeps runtime scene loader stage via helper import
25+
26+
## Validation Commands
27+
- `node --check tests/helpers/runtimeSceneLoaderHotReload.helpers.mjs` -> **PASS**
28+
- `node --check tests/tools/RuntimeSceneLoaderHotReload.test.mjs` -> **PASS**
29+
- `node --check tests/final/ToolchainEngineIntegrationValidation.test.mjs` -> **PASS**
30+
- `node --test tests/final/ToolchainEngineIntegrationValidation.test.mjs` -> **PASS**
31+
- `node --test tests/tools/RuntimeSceneLoaderHotReload.test.mjs` -> **PASS**
32+
33+
## Extra Verification
34+
- `rg -n "from .*\\.test\\.mjs" tests/final/ToolchainEngineIntegrationValidation.test.mjs tests/tools/RuntimeSceneLoaderHotReload.test.mjs tests/helpers/runtimeSceneLoaderHotReload.helpers.mjs` -> **PASS** (no matches)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# BUILD_PR_11_318A
2+
3+
## Implementation
4+
- Added non-test helper module:
5+
- `tests/helpers/runtimeSceneLoaderHotReload.helpers.mjs`
6+
- contains full runtime scene loader hot reload validation sequence
7+
- Updated `tests/tools/RuntimeSceneLoaderHotReload.test.mjs`:
8+
- now imports helper and exports `run()` that executes helper validation
9+
- Updated `tests/final/ToolchainEngineIntegrationValidation.test.mjs`:
10+
- removed import from `../tools/RuntimeSceneLoaderHotReload.test.mjs`
11+
- now imports helper function from `../helpers/runtimeSceneLoaderHotReload.helpers.mjs`
12+
13+
## Result
14+
- No `*.test.mjs` file imports another `*.test.mjs`.
15+
- Existing validation behavior is preserved via shared helper execution.
16+
17+
## Validation
18+
- `node --check tests/helpers/runtimeSceneLoaderHotReload.helpers.mjs`
19+
- `node --check tests/tools/RuntimeSceneLoaderHotReload.test.mjs`
20+
- `node --check tests/final/ToolchainEngineIntegrationValidation.test.mjs`
21+
- `node --test tests/final/ToolchainEngineIntegrationValidation.test.mjs`
22+
- `node --test tests/tools/RuntimeSceneLoaderHotReload.test.mjs`
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# PLAN_PR_11_318A
2+
3+
## Purpose
4+
Remove test-to-test import coupling by moving shared Runtime Scene Loader hot reload validation logic into a non-test helper module.
5+
6+
## Scope
7+
- `tests/helpers/runtimeSceneLoaderHotReload.helpers.mjs`
8+
- `tests/tools/RuntimeSceneLoaderHotReload.test.mjs`
9+
- `tests/final/ToolchainEngineIntegrationValidation.test.mjs`
10+
- `docs/dev/reports/PR_11_318A_report.md`
11+
- `docs/dev/codex_commands.md`
12+
- `docs/dev/commit_comment.txt`
13+
14+
## Steps
15+
1. Extract shared runtime scene loader hot reload validation logic to `tests/helpers/runtimeSceneLoaderHotReload.helpers.mjs`.
16+
2. Update `tests/tools/RuntimeSceneLoaderHotReload.test.mjs` to call helper run function.
17+
3. Update `tests/final/ToolchainEngineIntegrationValidation.test.mjs` to import helper run function instead of importing another `*.test.mjs`.
18+
4. Run targeted syntax + targeted tests only.

test-results/.last-run.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"status": "failed",
3+
"failedTests": []
4+
}

tests/asset-manager.spec.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { test, expect } = require('@playwright/test');
2+
3+
test('Asset Manager add/remove', async ({ page }) => {
4+
await page.goto('http://localhost:PORT/tools/workspace-v2/');
5+
6+
await page.click('text=Full Reset');
7+
8+
await page.selectOption('select', 'asset-manager-v2');
9+
await page.click('text=Load Fixture');
10+
await page.click('text=Create Session + Launch');
11+
12+
await page.fill('input[name="id"]', 'asset-002');
13+
await page.fill('input[name="label"]', 'Enemy Ship');
14+
await page.fill('input[name="kind"]', 'svg');
15+
await page.fill('input[name="path"]', 'assets/vectors/enemy-ship.svg');
16+
17+
await page.click('text=Add Asset');
18+
19+
await expect(page.locator('text=Enemy Ship')).toBeVisible();
20+
21+
await page.click('text=Remove asset-002');
22+
23+
await expect(page.locator('text=Enemy Ship')).toHaveCount(0);
24+
});

tests/final/ToolchainEngineIntegrationValidation.test.mjs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,42 @@ David Quesenberry
55
ToolchainEngineIntegrationValidation.test.mjs
66
*/
77
import assert from "node:assert/strict";
8-
import { run as runToolEntryLaunchContract } from "../tools/ToolEntryLaunchContract.test.mjs";
9-
import { run as runProjectToolDataContracts } from "../tools/ProjectToolDataContracts.test.mjs";
10-
import { run as runRuntimeAssetLoader } from "../tools/RuntimeAssetLoader.test.mjs";
11-
import { run as runRenderPipelineContractAll4Tools } from "../tools/RenderPipelineContractAll4Tools.test.mjs";
12-
import { run as runRuntimeSceneLoaderHotReload } from "../tools/RuntimeSceneLoaderHotReload.test.mjs";
8+
import { runRuntimeSceneLoaderHotReloadValidation } from "../helpers/runtimeSceneLoaderHotReload.helpers.mjs";
9+
import path from "node:path";
10+
import { execFileSync } from "node:child_process";
11+
import { fileURLToPath } from "node:url";
12+
13+
const __filename = fileURLToPath(import.meta.url);
14+
const __dirname = path.dirname(__filename);
15+
const repoRoot = path.resolve(__dirname, "..", "..");
16+
17+
function runNodeTestFile(relativeTestPath) {
18+
execFileSync(process.execPath, ["--test", relativeTestPath], {
19+
cwd: repoRoot,
20+
stdio: ["ignore", "pipe", "pipe"]
21+
});
22+
}
1323

1424
const TRACK_E_TOOLCHAIN_VALIDATION_STAGES = Object.freeze([
1525
Object.freeze({
1626
id: "tool-entry-launch-contract",
17-
run: runToolEntryLaunchContract
27+
run: async () => runNodeTestFile("tests/tools/ToolEntryLaunchContract.test.mjs")
1828
}),
1929
Object.freeze({
2030
id: "project-tool-data-contracts",
21-
run: runProjectToolDataContracts
31+
run: async () => runNodeTestFile("tests/tools/ProjectToolDataContracts.test.mjs")
2232
}),
2333
Object.freeze({
2434
id: "runtime-asset-loader",
25-
run: runRuntimeAssetLoader
35+
run: async () => runNodeTestFile("tests/tools/RuntimeAssetLoader.test.mjs")
2636
}),
2737
Object.freeze({
2838
id: "render-pipeline-contract-all-4-tools",
29-
run: runRenderPipelineContractAll4Tools
39+
run: async () => runNodeTestFile("tests/tools/RenderPipelineContractAll4Tools.test.mjs")
3040
}),
3141
Object.freeze({
3242
id: "runtime-scene-loader-hot-reload",
33-
run: runRuntimeSceneLoaderHotReload
43+
run: runRuntimeSceneLoaderHotReloadValidation
3444
})
3545
]);
3646

0 commit comments

Comments
 (0)