Skip to content

Commit ff5fe8d

Browse files
author
DavidQ
committed
Fix unexpected shared extraction guard violations by normalizing shared imports and consolidating duplicated numeric helpers across affected samples and tools while preserving current test behavior.
& Fix test drift in AsteroidsValidation and VectorNativeTemplate - export run from AsteroidsValidation test - ensure #game canvas exists before bootAsteroidsNew - update VectorNativeTemplate expected path to tools/templates & Fix node test-runner drift in AsteroidsValidation and VectorNativeTemplate - restore named run export contract for AsteroidsValidation - replace invalid browser-only DOM setup with a minimal node-safe test shim - update VectorNativeTemplate path expectation to current tools/templates location
1 parent 960b4c8 commit ff5fe8d

113 files changed

Lines changed: 1260 additions & 162 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/dev/CODEX_COMMANDS.md

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,41 @@
1-
MODEL: GPT-5.3-codex
2-
REASONING: low
1+
MODEL: GPT-5.4-codex
2+
REASONING: high
33

44
COMMAND:
5-
Execute BUILD_PR_ENGINE_IMPORT_ENFORCE_MINIMAL.
5+
Create BUILD_PR_TEST_RUNNER_DRIFT_FIX as a docs-following, test-only patch.
66

7-
Rules:
8-
- Fix max 2 files
9-
- Replace engine/ → src/engine/
10-
- Do NOT touch anything else
7+
Inspect these files first:
8+
- tests/run-tests.mjs
9+
- tests/games/AsteroidsValidation.test.mjs
10+
- games/Asteroids/index.js
11+
- tests/tools/VectorNativeTemplate.test.mjs
1112

12-
Create report + checklist
13-
Package output zip
13+
Then apply the minimum safe changes needed to restore `npm test --ignore-scripts`:
14+
15+
1. Re-align `tests/games/AsteroidsValidation.test.mjs` with the runner contract:
16+
- export a named `run`
17+
- remove any self-executing `run().catch(...)` block if present
18+
- preserve existing assertions and structure
19+
20+
2. Fix the Asteroids validation environment using a Node-safe local shim:
21+
- do NOT use `document.body.innerHTML`
22+
- inspect the boot path and mock only the minimal globals actually touched
23+
- likely candidates: `globalThis.document`, `document.getElementById('game')`, a minimal fake canvas/context, and possibly `globalThis.window`
24+
- restore original globals after the test
25+
26+
3. Update `tests/tools/VectorNativeTemplate.test.mjs` so the expected template path matches the current repo output:
27+
- `tools/templates/vector-native-arcade/`
28+
29+
Constraints:
30+
- no broad rewrites
31+
- no stub file replacement
32+
- no runtime behavior changes in game code unless absolutely required by an already-existing contract mismatch
33+
- no new heavy dependencies
34+
35+
Validate with:
36+
- npm test --ignore-scripts
37+
38+
If there is another failing test afterward, report it separately instead of rolling unrelated fixes into this PR.
39+
40+
NEXT COMMAND:
41+
npm test --ignore-scripts

docs/dev/COMMIT_COMMENT.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
Enforce minimal /src/engine import consistency (surgical fixes only)
1+
Fix node test-runner drift in AsteroidsValidation and VectorNativeTemplate
2+
3+
- restore named run export contract for AsteroidsValidation
4+
- replace invalid browser-only DOM setup with a minimal node-safe test shim
5+
- update VectorNativeTemplate path expectation to current tools/templates location
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
- low-token engine import baseline lane
2-
- no import rewrites
3-
- no structural moves
4-
- records current /src/engine usage as contract candidate
1+
PR intent:
2+
- repair current `npm test --ignore-scripts` failures without changing runtime behavior
3+
- keep scope limited to test harness drift and assertion drift
4+
5+
Primary targets:
6+
- tests/games/AsteroidsValidation.test.mjs
7+
- tests/tools/VectorNativeTemplate.test.mjs
8+
9+
Known symptoms from user run:
10+
- missing named `run` export in AsteroidsValidation after a bad overwrite attempt
11+
- `document is not defined` when trying a browser-style patch in a plain Node test runner
12+
- template path expectation still points at `templates/...` while actual output is `tools/templates/...`

docs/dev/reports/file_tree.txt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
.
2-
./docs
3-
./docs/dev
4-
./docs/dev/codex_commands.md
5-
./docs/dev/commit_comment.txt
6-
./docs/dev/next_command.txt
7-
./docs/dev/reports
8-
./docs/dev/reports/change_summary.txt
9-
./docs/dev/reports/file_tree.txt
10-
./docs/dev/reports/validation_checklist.txt
11-
./docs/pr
12-
./docs/pr/BUILD_PR_SAMPLES_INDEX_FIXES_AND_TARGETED_PREVIEW_RETRY.md
1+
docs/
2+
pr/
3+
PLAN_PR_TEST_RUNNER_DRIFT_FIX.md
4+
BUILD_PR_TEST_RUNNER_DRIFT_FIX.md
5+
dev/
6+
codex_commands.md
7+
commit_comment.txt
8+
reports/
9+
change_summary.txt
10+
validation_checklist.txt
11+
file_tree.txt

docs/dev/reports/launch_smoke_report.md

Lines changed: 229 additions & 13 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
BUILD_PR_ENGINE_IMPORT_ENFORCE_MINIMAL
2-
Validation Checklist
3-
Generated: 2026-04-12
4-
5-
[PASS] enforcement limited to max 2 files
6-
Evidence:
7-
- `scripts/normalize-samples-presentation.mjs`
8-
- `samples/phase11/1104/DistributionPackagingScene.js`
9-
10-
[PASS] replacement rule applied (`engine/` -> `src/engine/`) in changed files
11-
Evidence:
12-
- path literals updated in both files
13-
14-
[PASS] no additional runtime/source files changed by enforcement step
15-
Evidence:
16-
- `git status --short -- scripts/normalize-samples-presentation.mjs samples/phase11/1104/DistributionPackagingScene.js`
17-
18-
[PASS] report generated
19-
Evidence:
20-
- `docs/dev/reports/BUILD_PR_ENGINE_IMPORT_ENFORCE_MINIMAL_report.md`
1+
[ ] Inspect current source before editing; do not patch from memory
2+
[ ] `tests/games/AsteroidsValidation.test.mjs` exports named `run`
3+
[ ] No standalone `run().catch(...)` remains in that file
4+
[ ] AsteroidsValidation uses a node-safe local DOM/canvas shim rather than `document.body.innerHTML`
5+
[ ] Original globals are restored after the test
6+
[ ] `tests/tools/VectorNativeTemplate.test.mjs` expects `tools/templates/vector-native-arcade/`
7+
[ ] `npm test --ignore-scripts` rerun after edits
8+
[ ] Any remaining failures documented separately
1.28 MB
Loading
863 KB
Loading
1.25 MB
Loading
1.72 MB
Loading

0 commit comments

Comments
 (0)