Skip to content

Commit 17069eb

Browse files
author
DavidQ
committed
BUILD_PR: normalize sample presentation, runtime-derived previews, tags, and engine-class reporting
- create preview SVG assets for all samples from the running sample canvas appearance - remove preview image blocks from sample pages - keep H1, description, and tags at the top - keep Back to Samples and Prev / Next navigation - move Related Samples below canvas and before Engine Classes Used - normalize Engine Classes Used references - normalize tags to classes used excluding engine/theme/system-noise labels - sync samples/index.html names for 1316/1317/1318 with sample page titles No gameplay or engine-core scope included
1 parent 3fac22c commit 17069eb

208 files changed

Lines changed: 906 additions & 2669 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: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,45 @@ EXECUTION ENVIRONMENT (MANDATORY):
1515
- DO NOT create or populate `node_modules/`
1616
- DO NOT use PowerShell for path construction, rename-heavy work, or ZIP path generation
1717

18-
POWERSHELL PROHIBITION (CRITICAL):
19-
The following patterns are NOT allowed:
20-
- "$var/path"
21-
- "${var}/path"
22-
- "$base\$child"
23-
- "$($var)/path"
24-
25-
If any of these appear:
26-
- STOP
27-
- report the violation
28-
- do not silently retry
29-
3018
PR PURPOSE:
31-
Normalize sample presentation, preview assets, metadata tags, and engine-class reporting consistently across the samples system.
19+
Normalize sample presentation, runtime-derived preview assets, metadata tags, and engine-class reporting consistently across the samples system.
3220

3321
EXPECTED TARGETS:
3422
- `samples/index.html`
3523
- sample metadata source(s) directly used for titles, tags, related items, and engine-classes-used presentation
3624
- minimal sample detail rendering files/templates/helpers directly controlling page layout
37-
- preview SVG asset generation path or preview mapping files directly needed for normalization
25+
- preview SVG generation path or preview mapping files directly needed for producing previews from the running sample canvas appearance
3826
- reporting docs under `docs/`
3927

4028
DO NOT:
4129
- modify gameplay code
4230
- modify engine core
43-
- change canonical sample paths
44-
- broaden scope beyond presentation / preview / metadata display normalization
31+
- change canonical paths
32+
- broaden scope beyond presentation / runtime-preview / metadata display normalization
4533
- modify `docs/dev/start_of_day/chatGPT/`
4634
- modify `docs/dev/start_of_day/codex/`
4735

4836
REQUIRED IMPLEMENTATION SHAPE:
49-
1. Create preview SVG assets for all samples using a consistent convention
50-
2. Remove preview image from sample detail pages
51-
3. Ensure sample page layout is:
37+
1. Create preview SVG assets for all samples based on the sample canvas appearance when running
38+
2. Do not use generic placeholder cards as the final preview source
39+
3. Remove preview image from sample detail pages
40+
4. Ensure sample page layout is:
5241
- H1
5342
- description
5443
- tags
5544
- canvas
5645
- related samples
5746
- engine classes used
5847
- navigation retained
59-
4. Normalize tags to classes used while excluding:
48+
5. Normalize tags to classes used while excluding:
6049
- engine
6150
- theme
6251
- phase labels
6352
- sample numbers
6453
- sample names
65-
5. Normalize Engine Classes Used references consistently to the engine folder/class format
66-
6. Update `samples/index.html` labels for 1316 / 1317 / 1318 to exactly match the sample page titles
67-
7. Keep changed-file count minimal for the approved scope
54+
6. Normalize Engine Classes Used references consistently to the engine folder/class format
55+
7. Update `samples/index.html` labels for 1316 / 1317 / 1318 to exactly match the sample page titles
56+
8. Keep changed-file count minimal for the approved scope
6857

6958
VALIDATION (REQUIRED):
7059
- open representative sample pages and validate top-of-page structure
@@ -74,7 +63,7 @@ VALIDATION (REQUIRED):
7463
- confirm Back to Samples and Prev / Next remain present and functional
7564
- confirm Engine Classes Used formatting is normalized
7665
- confirm tags exclude sample-number / phase / sample-name noise
77-
- confirm preview SVG assets exist and are wired consistently
66+
- confirm preview SVG assets exist and visually match the running canvas appearance for representative samples
7867
- confirm `samples/index.html` names for 1316 / 1317 / 1318 match sample page titles exactly
7968
- confirm Phase 13 samples 1316, 1317, 1318 still load
8069
- confirm console is clean for tested pages
@@ -89,8 +78,7 @@ ZIP OUTPUT REQUIREMENT (HARD RULE):
8978
- Task is NOT complete until the ZIP exists at the exact requested path
9079

9180
FAIL FAST:
92-
- preview SVG generation requires broad asset pipeline redesign
81+
- runtime preview SVG generation requires broad asset pipeline redesign
9382
- engine-class normalization requires engine-core changes
9483
- layout normalization requires unrelated page architecture rewrites
95-
- PowerShell parse issue before execution
9684
- missing ZIP output at exact path

docs/dev/COMMIT_COMMENT.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
BUILD_PR: normalize sample presentation, previews, tags, and engine-class reporting
1+
BUILD_PR: normalize sample presentation, runtime-derived previews, tags, and engine-class reporting
22

3-
- create preview SVG assets for all samples
3+
- create preview SVG assets for all samples from the running sample canvas appearance
44
- remove preview image blocks from sample pages
55
- keep H1, description, and tags at the top
66
- keep Back to Samples and Prev / Next navigation
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
PR TYPE: BUILD
2-
PURPOSE: sample presentation / preview / metadata normalization
2+
PURPOSE: sample presentation / runtime-preview / metadata normalization
33

44
SUMMARY:
5-
- defines a final normalization BUILD for sample page layout, preview assets, tags, and engine-class reporting
5+
- corrects the preview requirement so SVGs reflect the running sample canvas appearance
66
- preserves canonical sample paths and runtime behavior
7-
- removes preview image blocks from sample pages while adding preview SVG assets for all samples
7+
- removes preview image blocks from sample pages while adding runtime-representative preview SVGs for all samples
88
- aligns index labels for 1316 / 1317 / 1318 with sample page titles
99
- keeps scope narrow, dependency-free, and Windows-safe

docs/dev/reports/file_tree_delta.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ MODIFIED:
66
- minimal sample detail rendering files/templates/helpers controlling page layout
77

88
ADDED:
9-
- preview SVG assets for samples or the minimal generator/mapping path directly required to produce them
9+
- runtime-derived preview SVG assets for samples or the minimal generator/mapping path directly required to produce them
1010

1111
REPORT ONLY:
1212
- docs/pr/BUILD_PR_SAMPLES_PRESENTATION_PREVIEW_AND_METADATA_NORMALIZATION.md

docs/dev/reports/validation_checklist.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[ ] preview SVG assets exist for all samples or follow the approved generated convention
1+
[ ] preview SVG assets reflect the running canvas appearance for representative samples
22
[ ] preview image block is removed from sample pages
33
[ ] H1 is at the top of representative sample pages
44
[ ] description is directly below H1 on representative sample pages

docs/pr/BUILD_PR_SAMPLES_PRESENTATION_PREVIEW_AND_METADATA_NORMALIZATION.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# BUILD_PR_SAMPLES_PRESENTATION_PREVIEW_AND_METADATA_NORMALIZATION
22

33
## Objective
4-
Implement a final, testable normalization wave for sample presentation, preview assets, tag semantics, and engine-class reporting across the samples system.
4+
Implement a final, testable normalization wave for sample presentation, runtime-derived preview assets, tag semantics, and engine-class reporting across the samples system.
55

66
This BUILD must apply the following user-approved adjustments:
77

8-
1. create preview SVG for all samples
8+
1. create preview SVG for all samples based on what the sample canvas looks like when the sample is running
99
2. remove tags that are the sample number, phase, or sample name
10-
3. correct all "Engine classes used" entries so they reference `engine/<class>` consistently
10+
3. correct all "Engine Classes Used" entries so they reference `engine/<class>` consistently
1111
4. set tags to classes used, excluding `engine` and `theme`
1212
5. remove preview image from the sample page
1313
6. keep tags at the top
@@ -21,11 +21,12 @@ Canonical path contract remains:
2121

2222
## PR Purpose
2323
One purpose only:
24-
- normalize sample presentation and sample metadata display consistency
24+
- normalize sample presentation and sample metadata display consistency using runtime-representative previews
2525

2626
## In Scope
27-
- generate or define preview SVG assets for all samples using a consistent convention
28-
- ensure sample detail pages no longer show a preview image block above or within the page body where it conflicts with the desired layout
27+
- create or generate preview SVG assets for all samples using the actual running canvas output as the visual source
28+
- ensure preview assets visually represent the rendered sample scene rather than generic placeholders
29+
- ensure sample detail pages no longer show a preview image block in the page body
2930
- normalize sample page structure so:
3031
- H1 is at the top
3132
- description is directly below the H1
@@ -50,16 +51,21 @@ One purpose only:
5051
- no unrelated performance work
5152
- no favorites/pinning changes unless directly required to preserve current behavior
5253

53-
## Required Behavior
54-
1. Every sample has a preview SVG asset or a clearly generated preview placeholder under the agreed samples preview convention.
55-
2. Sample detail pages do not show the preview image block in the final page layout.
56-
3. H1 and description are the first visible content at the top of the sample page.
57-
4. Tags remain at the top section of the sample page.
58-
5. Back to Samples and Prev / Next navigation remain intact.
59-
6. Related Samples appears below the canvas and before Engine Classes Used.
60-
7. Engine Classes Used entries are normalized to the `engine/<ClassName>` style or the exact repo-appropriate engine folder/class reference format used consistently across all samples.
61-
8. Tags reflect classes used and exclude engine/theme/system-noise labels.
62-
9. `samples/index.html` labels for 1316 / 1317 / 1318 exactly match their sample page titles.
54+
## Required Preview Behavior
55+
1. Every sample has a preview SVG asset or a clearly generated preview SVG based on the sample's actual running canvas appearance.
56+
2. The preview generation path must use the live or representative rendered scene as the source of truth.
57+
3. The preview SVG should capture the look of the sample canvas, not a generic text-only or placeholder card.
58+
4. If exact runtime capture cannot be fully automated for a subset of samples, fail fast and report which samples block automation rather than silently substituting generic placeholders.
59+
60+
## Required Page Behavior
61+
1. Sample detail pages do not show the preview image block in the final page layout.
62+
2. H1 and description are the first visible content at the top of the sample page.
63+
3. Tags remain at the top section of the sample page.
64+
4. Back to Samples and Prev / Next navigation remain intact.
65+
5. Related Samples appears below the canvas and before Engine Classes Used.
66+
6. Engine Classes Used entries are normalized to the `engine/<ClassName>` style or the exact repo-appropriate engine folder/class reference format used consistently across all samples.
67+
7. Tags reflect classes used and exclude engine/theme/system-noise labels.
68+
8. `samples/index.html` labels for 1316 / 1317 / 1318 exactly match their sample page titles.
6369

6470
## Expected Targets
6571
Codex should keep reads narrow and stop if the actual required target list expands materially.
@@ -68,7 +74,7 @@ Expected implementation targets:
6874
- `samples/index.html`
6975
- sample metadata source(s) directly used for titles, tags, related items, and engine-classes-used presentation
7076
- minimal sample detail rendering files/templates/helpers directly controlling sample page layout
71-
- preview SVG asset generation path or preview asset mapping files directly needed for this normalization
77+
- preview SVG generation path or preview asset mapping files directly needed to produce runtime-representative previews
7278
- report files under `docs/` only for output packaging
7379

7480
## Windows / Execution Constraints
@@ -94,13 +100,14 @@ Minimum required validation:
94100
- verify Engine Classes Used formatting is normalized on representative samples
95101
- verify tags exclude sample-number / phase / sample-name noise
96102
- verify tags reflect classes used while excluding `engine` and `theme`
97-
- verify preview SVG assets exist for representative samples and are wired consistently
103+
- verify preview SVG assets exist for representative samples and visually match the running canvas appearance
98104
- verify `samples/index.html` names for 1316 / 1317 / 1318 match their sample pages exactly
99105
- verify Phase 13 samples 1316, 1317, 1318 still load correctly
100106
- verify console stays clean for tested pages
101107

102108
## Acceptance Criteria
103109
- all 10 approved adjustments are implemented
110+
- preview SVGs are derived from what the sample canvas looks like when running
104111
- no gameplay changes
105112
- no engine-core changes
106113
- canonical sample paths remain unchanged
@@ -109,7 +116,7 @@ Minimum required validation:
109116

110117
## Fail Fast
111118
Stop and report if:
112-
- preview SVG generation would require a broad asset pipeline redesign
119+
- runtime-representative preview SVG generation would require a broad asset pipeline redesign
113120
- engine-class normalization would require engine-core changes
114121
- layout normalization requires unrelated page architecture rewrites
115122
- implementation expands beyond sample presentation and metadata display normalization
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Runtime Preview Capture</title>
6+
<style>
7+
html, body {
8+
margin: 0;
9+
width: 100%;
10+
height: 100%;
11+
overflow: hidden;
12+
background: #000;
13+
}
14+
#frame {
15+
position: fixed;
16+
width: 1px;
17+
height: 1px;
18+
left: -10000px;
19+
top: -10000px;
20+
border: 0;
21+
visibility: hidden;
22+
}
23+
#surface {
24+
display: block;
25+
width: 100vw;
26+
height: 100vh;
27+
background: #000;
28+
}
29+
</style>
30+
</head>
31+
<body>
32+
<iframe id="frame" title="sample frame" sandbox="allow-scripts allow-same-origin"></iframe>
33+
<canvas id="surface"></canvas>
34+
<script>
35+
(function () {
36+
const params = new URLSearchParams(window.location.search);
37+
const samplePath = params.get('sample') || '';
38+
const width = Number(params.get('w') || 640);
39+
const height = Number(params.get('h') || 360);
40+
const settleMs = Number(params.get('settle') || 1800);
41+
const timeoutMs = Number(params.get('timeout') || 12000);
42+
const outputCanvas = document.getElementById('surface');
43+
const frame = document.getElementById('frame');
44+
45+
outputCanvas.width = width;
46+
outputCanvas.height = height;
47+
const ctx = outputCanvas.getContext('2d');
48+
49+
function writeLabel(text, color) {
50+
ctx.fillStyle = '#0b1020';
51+
ctx.fillRect(0, 0, width, height);
52+
ctx.strokeStyle = '#334e7a';
53+
ctx.lineWidth = 2;
54+
ctx.strokeRect(10, 10, width - 20, height - 20);
55+
ctx.fillStyle = color;
56+
ctx.font = '600 18px monospace';
57+
ctx.fillText(text, 20, 40);
58+
}
59+
60+
function drawSourceCanvas(sourceCanvas) {
61+
const sw = sourceCanvas.width || sourceCanvas.clientWidth || width;
62+
const sh = sourceCanvas.height || sourceCanvas.clientHeight || height;
63+
if (!sw || !sh) {
64+
throw new Error('Canvas has invalid size.');
65+
}
66+
67+
const scale = Math.max(width / sw, height / sh);
68+
const dw = sw * scale;
69+
const dh = sh * scale;
70+
const dx = (width - dw) * 0.5;
71+
const dy = (height - dh) * 0.5;
72+
73+
ctx.fillStyle = '#000';
74+
ctx.fillRect(0, 0, width, height);
75+
ctx.drawImage(sourceCanvas, dx, dy, dw, dh);
76+
}
77+
78+
function setStatus(status) {
79+
document.body.setAttribute('data-capture-status', status);
80+
document.title = 'capture:' + status;
81+
}
82+
83+
function fail(message) {
84+
writeLabel(message, '#ff9ca8');
85+
setStatus('error');
86+
}
87+
88+
if (!samplePath) {
89+
fail('Missing sample parameter');
90+
return;
91+
}
92+
93+
writeLabel('Loading sample...', '#a5c0e6');
94+
setStatus('loading');
95+
96+
const startTime = Date.now();
97+
let settled = false;
98+
99+
frame.src = samplePath;
100+
101+
function attemptCapture() {
102+
try {
103+
const frameDoc = frame.contentDocument;
104+
if (!frameDoc) {
105+
throw new Error('Frame document unavailable.');
106+
}
107+
108+
const sourceCanvas = frameDoc.querySelector('canvas');
109+
if (!sourceCanvas) {
110+
if (Date.now() - startTime > timeoutMs) {
111+
fail('Canvas not found');
112+
return;
113+
}
114+
requestAnimationFrame(attemptCapture);
115+
return;
116+
}
117+
118+
if (!settled) {
119+
settled = true;
120+
setTimeout(attemptCapture, settleMs);
121+
return;
122+
}
123+
124+
drawSourceCanvas(sourceCanvas);
125+
setStatus('ready');
126+
} catch (error) {
127+
if (Date.now() - startTime > timeoutMs) {
128+
fail('Capture timeout');
129+
return;
130+
}
131+
requestAnimationFrame(attemptCapture);
132+
}
133+
}
134+
135+
frame.addEventListener('load', function () {
136+
requestAnimationFrame(attemptCapture);
137+
});
138+
139+
setTimeout(function () {
140+
if (document.body.getAttribute('data-capture-status') !== 'ready') {
141+
fail('Capture timeout');
142+
}
143+
}, timeoutMs + settleMs + 800);
144+
})();
145+
</script>
146+
</body>
147+
</html>

samples/_shared/sampleDetailPageEnhancement.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,10 @@ function ensureStyles() {
177177
' color: #e7edf8;',
178178
' font: 600 12px/1.2 monospace;',
179179
'}',
180+
'.sample-detail-row a { color: #ffffff; }',
180181
'.sample-detail-nav { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; }',
181-
'.sample-detail-nav a { color: #9bd1ff; }',
182-
'.sample-detail-muted { color: #c7d5ea; margin: 6px 0 0; }'
182+
'.sample-detail-nav a { color: #ffffff; }',
183+
'.sample-detail-muted { color: #ffffff; margin: 6px 0 0; }'
183184
].join('\n');
184185
document.head.appendChild(style);
185186
}

samples/metadata/samples.index.metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5007,7 +5007,7 @@
50075007
"engine/theme/index/ThemeTokens",
50085008
"engine/utils/math/clamp"
50095009
],
5010-
"indexLabel": "Sample 1318 - Divergence / Trace Validation"
5010+
"indexLabel": "Network Sample C - Divergence / Trace Validation"
50115011
},
50125012
{
50135013
"id": "1401",

0 commit comments

Comments
 (0)