prometeu-runtime/discussion/workflow/plans/PLN-0117-integrate-runtime-submission-with-worker.md
2026-06-15 16:20:46 +01:00

81 lines
2.8 KiB
Markdown

---
id: PLN-0117
ticket: real-render-worker-establishment
title: Integrate Runtime Submission With Worker
status: done
created: 2026-06-15
completed:
ref_decisions: [DEC-0033]
tags: [runtime, renderer, worker, integration]
---
## Briefing
`DEC-0033` requires VM/render production to submit work without blocking on worker consumption. This plan connects runtime frame closure to the worker handoff while preserving local synchronous fallback.
## Decisions de Origem
- `DEC-0033`: Real Render Worker Contract.
## Alvo
Route eligible Game render submissions from `RenderManager` into the real worker handoff and keep Shell/local paths correct.
## Escopo
- Add worker-capable runtime path.
- Submit owned `RenderSubmission` to the handoff.
- Preserve AppMode policy: Game may use worker; Shell remains local unless a future decision changes it.
- Keep local synchronous fallback.
- Prove VM tick returns without waiting for worker backend completion.
## Fora de Escopo
- No desktop host presentation.
- No final stale/repeat behavior beyond integration needed for basic worker use.
- No spec edits.
## Plano de Execucao
### Step 1 - Add worker ownership to runtime state
**What:** Store worker controller/handoff in runtime-owned state.
**How:** Extend `VirtualMachineRuntime` or `RenderManager` integration points without moving policy to host.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/tick.rs`, `render_manager.rs`, worker modules.
### Step 2 - Submit Game frames to worker handoff
**What:** Replace local worker prototype path with real worker submission.
**How:** On eligible Game frame closure, publish owned `RenderSubmission` into the handoff and return to VM tick without waiting for consumption.
**File(s):** runtime tick/render manager integration.
### Step 3 - Preserve local fallback
**What:** Keep current local synchronous behavior available.
**How:** Use existing `RenderConsumerPath`/policy or update it to select local fallback when worker is disabled/unavailable.
**File(s):** `render_manager.rs`, `tick.rs`.
### Step 4 - Add non-blocking tests
**What:** Prove VM producer does not block.
**How:** Use harness to hold backend render, run tick/publish additional frames, assert return and replacement telemetry.
**File(s):** runtime worker tests.
## Criterios de Aceite
- [ ] Game render submissions can be sent to the real worker handoff.
- [ ] VM tick does not wait for worker rasterization.
- [ ] Shell/local policy remains unchanged.
- [ ] Local synchronous fallback still passes existing tests.
- [ ] Replacement telemetry increments when producer outruns worker.
## Tests / Validacao
- `cargo test -p prometeu-system`
- `cargo test -p prometeu-firmware`
## Riscos
- Accidentally making frame closure wait for worker consumption would violate DEC-0033.
- Mixing Shell lifecycle rendering into the worker path too early would broaden scope.