scena 1.7.2

A Rust-native scene-graph renderer with typed scene state, glTF assets, and explicit prepare/render lifecycles.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
use serde::{Deserialize, Serialize};
use serde_json::json;

mod agent_smoke;
mod fixtures;

pub use agent_smoke::{
    AGENT_SMOKE_TEMPLATE_SCHEMA_V1, AgentSmokeTemplateCommandV1, AgentSmokeTemplateFileV1,
    AgentSmokeTemplateV1,
};
pub use fixtures::nearest_schema_name;

pub const SCHEMA_CATALOG_SCHEMA_V1: &str = "scena.schema_catalog.v1";
pub const SCHEMA_ENTRY_SCHEMA_V1: &str = "scena.schema_entry.v1";

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SchemaCatalogV1 {
    pub schema: String,
    pub entries: Vec<SchemaCatalogEntryV1>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SchemaCatalogEntryV1 {
    pub schema: String,
    pub owner_module: String,
    pub summary: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub feature_flag: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub fixture_path: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SchemaEntryReportV1 {
    pub schema: String,
    pub entry: SchemaCatalogEntryV1,
    pub example: serde_json::Value,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub invalid_example: Option<serde_json::Value>,
}

pub fn schema_catalog_v1() -> SchemaCatalogV1 {
    SchemaCatalogV1 {
        schema: SCHEMA_CATALOG_SCHEMA_V1.to_owned(),
        entries: schema_catalog_entries(),
    }
}

pub fn schema_catalog_entry(schema: &str) -> Option<SchemaCatalogEntryV1> {
    schema_catalog_entries()
        .into_iter()
        .find(|entry| entry.schema == schema)
}

pub fn schema_entry_report_v1(schema: &str) -> Option<SchemaEntryReportV1> {
    let entry = schema_catalog_entry(schema)?;
    let example = fixtures::schema_fixture_json(schema)
        .and_then(|fixture| serde_json::from_str(fixture).ok())
        .unwrap_or(serde_json::Value::Null);
    Some(SchemaEntryReportV1 {
        schema: SCHEMA_ENTRY_SCHEMA_V1.to_owned(),
        entry,
        example,
        invalid_example: invalid_example_for_schema(schema),
    })
}

fn invalid_example_for_schema(schema: &str) -> Option<serde_json::Value> {
    match schema {
        "scena.scene_recipe.v1" => Some(json!({
            "schema": "scena.scene_recipe.v1",
            "importe": [{
                "id": "part",
                "uri": "tests/assets/gltf/mesh_material_vertex_color_scene.gltf"
            }]
        })),
        _ => None,
    }
}

fn schema_catalog_entries() -> Vec<SchemaCatalogEntryV1> {
    schema_entry_rows()
        .iter()
        .map(|row| SchemaCatalogEntryV1 {
            schema: row.schema.to_owned(),
            owner_module: row.owner_module.to_owned(),
            summary: row.summary.to_owned(),
            feature_flag: row.feature_flag.map(str::to_owned),
            fixture_path: row.fixture_path.map(str::to_owned),
        })
        .collect()
}

struct SchemaEntryRow {
    schema: &'static str,
    owner_module: &'static str,
    summary: &'static str,
    feature_flag: Option<&'static str>,
    fixture_path: Option<&'static str>,
}

fn schema_entry_rows() -> &'static [SchemaEntryRow] {
    &[
        SchemaEntryRow {
            schema: SCHEMA_CATALOG_SCHEMA_V1,
            owner_module: "schema_catalog",
            summary: "Catalog of public stable scena JSON contracts.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/schema_catalog.v1.json"),
        },
        SchemaEntryRow {
            schema: SCHEMA_ENTRY_SCHEMA_V1,
            owner_module: "schema_catalog",
            summary: "Single schema catalog entry with a representative example.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/schema_entry.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.capability_report.v1",
            owner_module: "diagnostics",
            summary: "Renderer capability status and diagnostics.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/capability_report.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_inspection.v1",
            owner_module: "scene",
            summary: "Scene graph, draw-list, bounds, material, and revision inspection.",
            feature_flag: Some("inspection"),
            fixture_path: Some("tests/assets/stable-contracts/scene_inspection.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.capture.v1",
            owner_module: "capture",
            summary: "Descriptor-bound RGBA8 capture metadata and payload hash.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/capture.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.capture_baseline.v1",
            owner_module: "capture",
            summary: "Tolerance-bound capture comparison report.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/capture_baseline.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.render_introspection.v1",
            owner_module: "render",
            summary: "Capture-bound frame visibility, luminance, framing, reason, and fix summary.",
            feature_flag: Some("inspection"),
            fixture_path: Some("tests/assets/stable-contracts/render_introspection.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.render_quality.v1",
            owner_module: "render",
            summary: "Profile-scoped native-capture render quality checks with actionable fix hints.",
            feature_flag: Some("inspection"),
            fixture_path: Some("tests/assets/stable-contracts/render_quality.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_composition.v1",
            owner_module: "scene_host",
            summary: "Composition-conformance checks over declared recipe elements and generated overlays.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/scene_composition.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.visibility_diagnosis.v1",
            owner_module: "render",
            summary: "Inspection-backed visibility diagnosis with stable reasons and suggested fixes.",
            feature_flag: Some("inspection"),
            fixture_path: Some("tests/assets/stable-contracts/visibility_diagnosis.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.visual_repair_plan.v1",
            owner_module: "render",
            summary: "Conservative repair plan over introspection and visibility diagnosis reports.",
            feature_flag: Some("inspection"),
            fixture_path: Some("tests/assets/stable-contracts/visual_repair_plan.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.agent_loop_result.v1",
            owner_module: "render",
            summary: "Fail-closed agent repair-loop result for irreducible or non-converging cases.",
            feature_flag: Some("inspection"),
            fixture_path: Some("tests/assets/stable-contracts/agent_loop_result.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.agent_smoke_template.v1",
            owner_module: "bin/scena",
            summary: "Agent smoke-template manifest with generated files, commands, and artifacts.",
            feature_flag: Some("inspection"),
            fixture_path: Some("tests/assets/stable-contracts/agent_smoke_template.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.browser_proof_run.v1",
            owner_module: "bin/scena",
            summary: "One-command browser proof wrapper result with lane, command, and artifact paths.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/browser_proof_run.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.appearance_expectation.v1",
            owner_module: "render",
            summary: "Transient expected appearance targets for first-time material verification.",
            feature_flag: Some("inspection"),
            fixture_path: Some("tests/assets/stable-contracts/appearance_expectation.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.appearance_introspection.v1",
            owner_module: "render",
            summary: "Capture-bound material, variant, fallback, alpha, and swatch verification report.",
            feature_flag: Some("inspection"),
            fixture_path: Some("tests/assets/stable-contracts/appearance_introspection.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.animation_introspection.v1",
            owner_module: "render",
            summary: "Host-ticked animation sampling, channel changes, and rendered-change verification report.",
            feature_flag: Some("inspection"),
            fixture_path: Some("tests/assets/stable-contracts/animation_introspection.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.interaction_expectation.v1",
            owner_module: "scene_host",
            summary: "Transient synthetic interaction steps for host-driven verification.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/interaction_expectation.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.interaction_verification.v1",
            owner_module: "scene_host",
            summary: "Synthetic pick, hover, selection, and host-event verification report.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/interaction_verification.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_host_gizmo_drag.v1",
            owner_module: "scene_host",
            summary: "SceneHost transform gizmo drag request that applies through VisualPatch.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/scene_host_gizmo_drag.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.connector_browser.v1",
            owner_module: "scene_host",
            summary: "Connector listing, metadata compatibility, and snap-preview report.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/connector_browser.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.product_options.v1",
            owner_module: "scene_host",
            summary: "Host-owned visual product option groups that apply VisualPatch entries.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/product_options.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.presentation_timeline.v1",
            owner_module: "scene_host",
            summary: "Host-ticked presentation timeline that emits VisualPatch for seek and advance.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/presentation_timeline.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_host_grounding.v1",
            owner_module: "scene_host",
            summary: "Product-viewer grounding preset report with floor, SSAO, and explicit shadow fallbacks.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/scene_host_grounding.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_recipe.v1",
            owner_module: "scene",
            summary: "Declarative, transient scene snapshot consumed by agent and CLI workflows.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/scene_recipe.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_recipe_validation.v1",
            owner_module: "scene",
            summary: "Fail-closed scene recipe validation diagnostics with deterministic suggestions.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/scene_recipe_validation.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_recipe_build.v1",
            owner_module: "scene_host",
            summary: "Typed recipe build manifest mapping caller ids to stable SceneHost handles.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/scene_recipe_build.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.recipe_render_result.v1",
            owner_module: "bin/scena",
            summary: "One-command recipe build, render, introspection, and verification result.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/recipe_render_result.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.placement_result.v1",
            owner_module: "scene",
            summary: "Semantic placement transform preview for declarative recipe imports.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/placement_result.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.annotation_projection.v1",
            owner_module: "scene",
            summary: "Projected annotation anchors and CSS-pixel screen positions.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/annotation_projection.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.asset_geometry_summary.v1",
            owner_module: "assets",
            summary: "Imported geometry counts, bounds, and topology summary.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/asset_geometry_summary.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.asset_load_report.v1",
            owner_module: "assets",
            summary: "Asset load warnings, external resources, and material fallback provenance.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/asset_load_report.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.asset_doctor.v1",
            owner_module: "assets",
            summary: "Runtime asset doctor findings with severity, code, help, and suggested fixes.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/asset_doctor.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.asset_catalog.v1",
            owner_module: "assets",
            summary: "Host-owned asset catalog manifest consumed by Scena readiness validation.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/asset_catalog.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.asset_readiness_report.v1",
            owner_module: "assets",
            summary: "Asset catalog readiness findings derived from real asset loads and authored features.",
            feature_flag: None,
            fixture_path: Some("tests/assets/stable-contracts/asset_readiness_report.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_host_asset_import.v1",
            owner_module: "scene_host",
            summary: "SceneHost import result with stable host handles and diagnostics.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/scene_host_asset_import.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.subtree.v1",
            owner_module: "scene_host",
            summary: "SceneHost subtree report with stable node handles and tree edges.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/scene_host_subtree.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_host_measurement_overlay.v1",
            owner_module: "scene_host",
            summary: "SceneHost measurement overlay result with stable generated node handles.",
            feature_flag: Some("scene-host"),
            fixture_path: Some(
                "tests/assets/stable-contracts/scene_host_measurement_overlay.v1.json",
            ),
        },
        SchemaEntryRow {
            schema: "scena.scene_host_section_box.v1",
            owner_module: "scene_host",
            summary: "SceneHost section box report with generated clipping planes and helper node.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/scene_host_section_box.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_host_visual_state.v1",
            owner_module: "scene_host",
            summary: "SceneHost named visual state storing a visual patch plus metadata.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/scene_host_visual_state.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.scene_host_visual_states.v1",
            owner_module: "scene_host",
            summary: "SceneHost deterministic list of stored named visual states.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/scene_host_visual_states.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.animation_inventory.v1",
            owner_module: "scene_host",
            summary: "SceneHost animation clip inventory.",
            feature_flag: Some("scene-host"),
            fixture_path: Some(
                "tests/assets/stable-contracts/scene_host_animation_inventory.v1.json",
            ),
        },
        SchemaEntryRow {
            schema: "scena.visual_patch.v1",
            owner_module: "scene_host",
            summary: "Batched host-to-scena visual state patch and result contract.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/visual_patch.v1.json"),
        },
        SchemaEntryRow {
            schema: "scena.host_event.v1",
            owner_module: "scene_host",
            summary: "SceneHost event batch for pick, hover, load, diagnostic, capture, and surface events.",
            feature_flag: Some("scene-host"),
            fixture_path: Some("tests/assets/stable-contracts/host_event.v1.json"),
        },
    ]
}