prometeu-runtime/discussion/workflow/plans/PLN-0042-scene-glyph-tooling-and-fixture-migration.md

117 lines
4.5 KiB
Markdown

---
id: PLN-0042
ticket: scene-bank-glyph-runtime-binding-leak
title: Scene glyph tooling, fixtures, and test payload migration
status: review
created: 2026-04-24
completed:
tags: [gfx, runtime, asset, scene, glyph, tooling, tests]
---
## Briefing
Complete the implementation surface of `DEC-0021` by migrating all scene payload producers, fixtures, stress tools, and test data away from serialized runtime glyph slots and onto per-layer glyph dependency `AssetId (i32)`.
## Decisions de Origem
- `DEC-0021` — Scene Bank glyph dependencies MUST bind by `asset_id`, not runtime slot.
## Alvo
- Runtime tests and helpers under `crates/console/prometeu-drivers/`
- Runtime tests under `crates/console/prometeu-system/`
- Tooling and stress generators under `crates/tools/`
## Escopo
- Rewrite scene payload writers in tests and tools.
- Rewrite test fixtures and expectations that still name or assert `glyph_bank_id`.
- Ensure stress and fixture content uses valid `AssetId` dependencies and exercises runtime resolution order independence.
## Fora de Escopo
- Core runtime implementation of reverse index and fatal semantics.
- Public API exposure of reverse lookup.
- Backward-compatible scene payload generation.
## Plano de Execucao
### Step 1 - Rewrite local scene payload builders in driver tests
**What:**
Update every driver-side scene helper and binary payload builder that still writes per-layer runtime slot ids.
**How:**
Search all `SceneLayer` builders and `SCENE` payload encoders in driver tests. Replace slot-oriented setup with per-layer dependency `AssetId`, then adjust assertions accordingly.
**File(s):**
- `crates/console/prometeu-drivers/src/asset.rs`
- `crates/console/prometeu-drivers/src/frame_composer.rs`
- `crates/console/prometeu-drivers/src/gfx.rs`
- `crates/console/prometeu-drivers/src/hardware.rs`
### Step 2 - Rewrite system/runtime integration fixtures
**What:**
Migrate integration fixtures so scene setup reflects asset-id dependencies and runtime slot resolution.
**How:**
Update helper functions and tests under `prometeu-system` that construct scenes or assume direct slot semantics. Ensure tests explicitly preload/commit glyph assets under varying slot orders and verify correct resolution behavior.
**File(s):**
- `crates/console/prometeu-system/src/virtual_machine_runtime/tests.rs`
- other runtime test modules that build scene fixtures.
### Step 3 - Rewrite tooling and stress generators
**What:**
Update scene-producing tools so published binary payloads match the accepted scene dependency contract.
**How:**
Rewrite stress/payload builders to write `AssetId (i32)` per layer and to generate coherent asset tables/preload data that prove runtime resolution by dependency identity rather than baked slot topology.
**File(s):**
- `crates/tools/pbxgen-stress/src/lib.rs`
- any other local scene payload generators discovered during implementation.
### Step 4 - Add regression coverage for former slot leakage
**What:**
Add focused regression cases that fail if scene payloads again leak runtime glyph slot ids.
**How:**
Introduce tests that deliberately load glyph dependencies into different slots from their prior fixture order and verify scene bind/draw behavior depends on `AssetId` resolution only.
**File(s):**
- affected test modules under `prometeu-drivers`, `prometeu-system`, and tool tests if present.
## Criterios de Aceite
- [ ] No test or tooling payload writer serializes per-layer runtime glyph slot id for `SCENE`.
- [ ] Scene fixtures express glyph dependencies by `AssetId`.
- [ ] At least one regression test proves glyph slot order does not matter for scene activation.
- [ ] At least one regression test would fail if old slot-leak behavior returned.
## Tests / Validacao
### Unit Tests
- Update existing scene codec/fixture tests to assert `AssetId`-based dependency behavior.
### Integration Tests
- Run runtime integration coverage where scene dependencies resolve correctly despite different glyph slot placement.
- Run regression coverage for fatal behavior when dependencies are absent.
### Manual Verification
- Inspect representative generated payload bytes to confirm widened dependency field writing.
- Verify stress/tool outputs remain consumable by the updated runtime.
## Riscos
- Test helper churn may be broad because many fixtures were written around the leaked slot model.
- Tool outputs may silently drift if any scene payload writer is missed.
- Regression tests can become brittle if they depend on incidental slot ordering instead of declared dependency identity.