prometeu-runtime/discussion/workflow/plans/PLN-0089-introduce-render-handoff-abstraction.md
2026-06-05 09:36:55 +01:00

63 lines
2.2 KiB
Markdown

---
id: PLN-0089
ticket: vm-render-parallel-execution-boundary
title: Introduce Render Handoff Abstraction
status: done
created: 2026-06-05
ref_decisions: [DEC-0031]
tags: [runtime, renderer, handoff, latest-wins]
---
## Briefing
`DEC-0031` requires a single-slot latest-wins handoff where the producer never blocks on render ACK and replacement before consumption is observable.
## Objective
Introduce a render handoff abstraction that can be used synchronously today and by a worker later.
## Dependencies
- Source decision: `DEC-0031`.
- `PLN-0093` should define telemetry counters before final instrumentation is wired.
## Scope
- Add a small handoff type or trait around one pending owned `RenderSubmission`.
- Support publish, take latest, replace pending, and drain/discard operations.
- Report replacement/drop events to telemetry hooks.
- Integrate the abstraction into `RenderManager` without starting a worker.
## Non-Goals
- Do not spawn a thread.
- Do not implement frame pacing.
- Do not change Shell UI default rendering policy.
## Execution Method
1. Locate `RenderManager::latest_complete_submission` ownership and publication flow.
2. Introduce a handoff module with single pending slot semantics.
3. Move `RenderSubmission` into the slot on publication.
4. Make `take_latest` transfer ownership to the consumer.
5. Count replacement when a pending submission is overwritten before consumption.
6. Keep current synchronous publication working by immediately taking and rendering through the same abstraction.
## Acceptance Criteria
- `RenderManager` no longer relies on an unconstrained raw `Option<RenderSubmission>` for the future worker boundary.
- Publishing a newer pending submission replaces the old one without blocking.
- The consumer receives owned submissions.
- Replacement before consume is observable.
## Tests
- Unit tests for empty take, publish/take, publish/replace/take, and drain/discard.
- Integration smoke test that existing synchronous render still presents frames.
## Affected Artifacts
- `crates/console/prometeu-system/src/services/vm_runtime/render_manager.rs`
- New or existing render handoff module under `crates/console/prometeu-system`.
- Render manager tests.