86 lines
2.8 KiB
Markdown
86 lines
2.8 KiB
Markdown
---
|
|
id: PLN-0118
|
|
ticket: real-render-worker-establishment
|
|
title: Add Stale Epoch and Repeat Frame Behavior
|
|
status: done
|
|
created: 2026-06-15
|
|
completed:
|
|
ref_decisions: [DEC-0033]
|
|
tags: [runtime, renderer, worker, ownership, telemetry]
|
|
---
|
|
|
|
## Briefing
|
|
|
|
`DEC-0033` requires the worker to discard stale in-flight frames before publication and repeat the last published `OwnedRgba8888Frame` rather than recomposing.
|
|
|
|
## Decisions de Origem
|
|
|
|
- `DEC-0033`: Real Render Worker Contract.
|
|
|
|
## Alvo
|
|
|
|
Complete ownership/epoch checks and repeat-last-published-frame behavior for the worker path.
|
|
|
|
## Escopo
|
|
|
|
- Add shared active ownership/epoch observation for worker publication checks.
|
|
- Discard stale in-flight frames before publication.
|
|
- Store and expose the latest published `OwnedRgba8888Frame`.
|
|
- Implement repeat-last-frame behavior and telemetry.
|
|
|
|
## Fora de Escopo
|
|
|
|
- No desktop upload/present.
|
|
- No new AppMode policy.
|
|
- No native window invalidation changes.
|
|
|
|
## Plano de Execucao
|
|
|
|
### Step 1 - Expose ownership/epoch to worker
|
|
|
|
**What:** Let worker validate in-flight submissions before publishing.
|
|
**How:** Add a thread-safe snapshot or handle that the worker can read without mutating runtime state.
|
|
**File(s):** `render_manager.rs`, worker modules.
|
|
|
|
### Step 2 - Implement stale discard
|
|
|
|
**What:** Prevent stale pixels from publication.
|
|
**How:** Before publishing frame output, compare submission ownership/epoch with active ownership/epoch; discard on mismatch and increment telemetry.
|
|
**File(s):** worker controller module.
|
|
|
|
### Step 3 - Store latest published frame
|
|
|
|
**What:** Make the latest valid frame available to host/fallback tests.
|
|
**How:** Add a published-frame slot distinct from pending submission and in-flight work.
|
|
**File(s):** worker controller or published frame module.
|
|
|
|
### Step 4 - Implement repeat behavior
|
|
|
|
**What:** Repeat last valid frame without recomposition.
|
|
**How:** Add API to fetch/reuse the latest published `OwnedRgba8888Frame`; increment repeat telemetry when cadence requests reuse.
|
|
**File(s):** worker modules, tests.
|
|
|
|
### Step 5 - Add tests
|
|
|
|
**What:** Prove stale discard and repeat.
|
|
**How:** Use harness to hold in-flight work, change owner/epoch, release backend, and assert no publication; separately assert repeat returns last frame.
|
|
**File(s):** worker tests.
|
|
|
|
## Criterios de Aceite
|
|
|
|
- [ ] Worker checks active owner/epoch before publishing.
|
|
- [ ] Stale in-flight frames are discarded and counted.
|
|
- [ ] Latest published frame is an `OwnedRgba8888Frame`.
|
|
- [ ] Repeat uses the last published frame and does not recompose.
|
|
- [ ] Tests cover stale discard and repeat deterministically.
|
|
|
|
## Tests / Validacao
|
|
|
|
- `cargo test -p prometeu-system render_worker`
|
|
- `cargo test -p prometeu-system`
|
|
|
|
## Riscos
|
|
|
|
- Reading active ownership from the wrong layer may reintroduce mutable runtime coupling.
|
|
- Repeat behavior must not hide render failures unless telemetry records them.
|