Skip to content

Commit 1344594

Browse files
author
DavidQ
committed
Repair preview path contract after sample structure change.
BUILD_PR_PREVIEW_PATH_CONTRACT_REALIGNMENT - update tools/preview path resolution to current sample contract - validate and remove/update any stale samples/shared preview dependency - keep scope limited to preview-path repair
1 parent 3d47e97 commit 1344594

48 files changed

Lines changed: 631 additions & 1869 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: 27 additions & 6 deletions

docs/dev/COMMIT_COMMENT.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
Engine usage enforcement completion (Level 18 Track A)
1+
Repair preview path contract after sample structure change.
22

3-
BUILD_PR_LEVEL_18_1_ENGINE_USAGE_ENFORCEMENT_COMPLETION
3+
BUILD_PR_PREVIEW_PATH_CONTRACT_REALIGNMENT
4+
- update tools/preview path resolution to current sample contract
5+
- validate and remove/update any stale samples/shared preview dependency
6+
- keep scope limited to preview-path repair
Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
Docs-only enforcement PR
1+
BUILD_PR_PREVIEW_PATH_CONTRACT_REALIGNMENT
2+
Date: 2026-04-17
3+
Scope: Preview path contract repair only (tools/preview + preview generation script).
4+
5+
Summary of changes
6+
1) Preview sample-path contract stays aligned to canonical sample paths:
7+
- samples/phase-XX/XXXX/index.html
8+
9+
2) Updated preview HTML executors to default preview output folder to images path:
10+
- tools/preview/generate-list-previews_updated.html
11+
- tools/preview/preview_svg_executor_1600x900.html
12+
- tools/preview/preview_svg_executor_games_enter.html
13+
14+
Exact output-folder changes applied in each:
15+
- input default: "assets" -> "assets/images"
16+
- fallback display path: "assets" -> "assets/images"
17+
- displayed sample write target now resolves as:
18+
samples\\phase-XX\\XXXX\\assets\\images
19+
20+
3) Updated runtime sample preview writer path:
21+
- scripts/generate-runtime-sample-previews.mjs
22+
- output path changed:
23+
path.join(sample.sampleDir, 'assets', 'preview.svg')
24+
-> path.join(sample.sampleDir, 'assets', 'images', 'preview.svg')
25+
26+
4) Preview capture dependency remains aligned to preview tooling location:
27+
- /tools/preview/runtimePreviewCapture.html
28+
- local capture page: tools/preview/runtimePreviewCapture.html
29+
30+
Notes
31+
- No engine/runtime feature behavior changed beyond preview output path contract.
32+
- No roadmap edits.
33+
- No start_of_day edits.
34+
- No unrelated cleanup.
35+

docs/dev/reports/file_tree.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
generated
1+
BUILD_PR_PREVIEW_PATH_CONTRACT_REALIGNMENT file tree
2+
3+
scripts/
4+
generate-runtime-sample-previews.mjs (modified)
5+
6+
tools/
7+
preview/
8+
generate-list-previews_updated.html (modified)
9+
preview_svg_executor_1600x900.html (modified)
10+
preview_svg_executor_games_enter.html (modified)
11+
runtimePreviewCapture.html (added)
12+
13+
docs/
14+
dev/
15+
reports/
16+
change_summary.txt (updated)
17+
validation_checklist.txt (updated)
18+
file_tree.txt (updated)
19+
Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1-
[ ] games use engine
2-
[ ] no local logic
3-
[ ] validation pass
1+
BUILD_PR_PREVIEW_PATH_CONTRACT_REALIGNMENT - Validation Checklist
2+
Date: 2026-04-17
3+
4+
[PASS] Syntax validation
5+
Command:
6+
- node --check scripts/generate-runtime-sample-previews.mjs
7+
Result:
8+
- Exit 0
9+
10+
[PASS] Output-path contract verification (targeted file assertions)
11+
Command:
12+
- python inline assertion across:
13+
- tools/preview/generate-list-previews_updated.html
14+
- tools/preview/preview_svg_executor_1600x900.html
15+
- tools/preview/preview_svg_executor_games_enter.html
16+
- scripts/generate-runtime-sample-previews.mjs
17+
Result:
18+
- html default value="assets/images": expected 3, actual 3
19+
- html fallback || "assets/images": expected 3, actual 3
20+
- html stale default value="assets": expected 0, actual 0
21+
- html stale fallback || "assets": expected 0, actual 0
22+
- script path includes 'assets', 'images', 'preview.svg': expected 1, actual 1
23+
- script stale path 'assets', 'preview.svg': expected 0, actual 0
24+
- OVERALL PASS
25+
26+
[PASS] Canonical phase-hyphen sample directory contract check
27+
Command:
28+
- Python scan over samples/ for phase directories matching ^phase-\d{2}$ and per-sample index.html presence
29+
Result:
30+
- PHASE_DIR_COUNT=19
31+
- MISSING_INDEX_COUNT=0
32+
33+
Validation conclusion
34+
- Preview tooling now targets image output under assets/images/preview.svg.
35+
- Preview sample path resolution remains aligned to phase-hyphen contract.
36+
Lines changed: 53 additions & 0 deletions

samples/index.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ <h2>Phase 19 - Next Phase Bootstrap</h2>
595595
const parsed = parseSampleLink(href);
596596
const phase = parsed.phase;
597597
const sampleId = parsed.sampleId;
598+
const defaultPreviewPath = buildDefaultSamplePreviewPath(phase, sampleId);
598599
const tags = parseTagTokens({ link });
599600
const titleText = labelText.toLowerCase();
600601
const descriptionText = String(link.getAttribute('title') || '').trim().toLowerCase();
@@ -609,8 +610,8 @@ <h2>Phase 19 - Next Phase Bootstrap</h2>
609610
href,
610611
section: link.closest('section'),
611612
searchText,
612-
thumbnail: '',
613-
preview: '',
613+
thumbnail: defaultPreviewPath,
614+
preview: defaultPreviewPath,
614615
itemNode: link,
615616
isVisible: true,
616617
favoriteButton: null,
@@ -696,6 +697,13 @@ <h2>Phase 19 - Next Phase Bootstrap</h2>
696697
};
697698
}
698699

700+
function buildDefaultSamplePreviewPath(phase, sampleId) {
701+
if (!/^\d{2}$/.test(String(phase || '')) || !/^\d{4}$/.test(String(sampleId || ''))) {
702+
return '';
703+
}
704+
return '/samples/phase-' + phase + '/' + sampleId + '/assets/images/preview.svg';
705+
}
706+
699707
function parseTagTokens(model) {
700708
const tags = String(model.link.getAttribute('data-tags') || '')
701709
.split(',')

samples/phase-16/1601/assets/images/preview.svg

Lines changed: 3 additions & 0 deletions

samples/phase-16/1602/assets/images/preview.svg

Lines changed: 3 additions & 0 deletions

samples/phase-16/1603/assets/images/preview.svg

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)