prometeu-runtime/discussion/workflow/plans/PLN-0044-host-and-tests-270p-propagation.md

121 lines
4.3 KiB
Markdown

---
id: PLN-0044
ticket: internal-viewport-270p
title: Host and Test Propagation for 270p
status: review
created: 2026-04-27
completed:
tags: [host, tests, viewport, resolution, touch, overlay]
---
## Briefing
This plan executes the second mandatory slice of `DEC-0022`: propagate the accepted `480x270` runtime contract into host presentation, absolute pointer mapping, host-side overlay/test fixtures, and any remaining test surfaces that still assume `320x180`.
This plan depends on `PLN-0043` completing first. It must not redefine the runtime contract; it only propagates the already-accepted 270p baseline into host-owned behavior and validation surfaces.
## Decisions de Origem
- `DEC-0022` - Internal Viewport 270p (480x270) as Canonical Runtime Contract
## Alvo
Make the desktop host and test surface faithfully consume the new canonical runtime resolution and touch domain.
## Escopo
- Update host framebuffer/surface creation to `480x270`.
- Update absolute pointer/touch mapping to the new canonical domain.
- Update host overlay fixtures and tests that still allocate or draw against `320x180`.
- Sweep remaining test hardcodes outside the core runtime step.
## Fora de Escopo
- Core runtime ownership changes already covered by `PLN-0043`.
- Specs and docs publication.
- Post-migration visual redesign or typography/layout tuning beyond strict propagation.
## Plano de Execucao
### Step 1 - Rebaseline host presentation surface
**What:**
Make the desktop host create and present its base `Pixels` surface using the new canonical runtime dimensions.
**How:**
Update host initialization and redraw flow so `PixelsBuilder`, frame copy, and overlay composition all consume `Hardware::W/H` after the runtime constants move to `480x270`.
**File(s):**
- `crates/host/prometeu-host-desktop-winit/src/runner.rs`
- `crates/host/prometeu-host-desktop-winit/src/utilities.rs`
### Step 2 - Rebaseline absolute input mapping
**What:**
Align pointer/touch translation with the new canonical framebuffer domain.
**How:**
Update `window_to_fb()` and any clamping logic to map window coordinates into `[0, 479] x [0, 269]` through the canonical `Hardware::W/H` path.
**File(s):**
- `crates/host/prometeu-host-desktop-winit/src/input.rs`
### Step 3 - Update host overlay fixtures and tests
**What:**
Remove host overlay hardcodes that still allocate or draw a `320x180` RGBA buffer.
**How:**
Update overlay tests and any host-owned fixtures so they use `480x270` or derive from the canonical hardware constants where appropriate. Preserve overlay semantics; do not redesign the overlay in this plan.
**File(s):**
- `crates/host/prometeu-host-desktop-winit/src/overlay.rs`
### Step 4 - Sweep remaining non-doc resolution assertions
**What:**
Capture and update any remaining code or tests outside specs/docs that still depend on the old baseline.
**How:**
Search for `320x180`, `320, 180`, and equivalent fixed-size assumptions under host/runtime test surfaces and migrate them to the accepted 270p contract or to canonical constants.
**File(s):**
- `crates/host/prometeu-host-desktop-winit/src/*`
- any remaining test modules under `crates/console/*`
## Criterios de Aceite
- The desktop host creates its base surface from the `480x270` canonical runtime dimensions.
- Absolute pointer/touch mapping uses the new framebuffer domain.
- Host overlay tests no longer hardcode `320x180`.
- No host-owned code path reintroduces the old baseline as an implicit contract.
## Tests / Validacao
### Unit Tests
- `cargo test` for:
`prometeu-host-desktop-winit`
any directly impacted console crates
### Integration Tests
- Verify runtime frame copy still lands correctly in the host RGBA surface.
- Verify pointer mapping clamps to the new canonical framebuffer bounds.
### Manual Verification
- Launch the desktop host and confirm the window presents a `480x270` logical framebuffer.
- Confirm overlay still renders and aligns within the new frame domain.
- Confirm pointer/touch interaction reaches the expected screen edges.
## Riscos
- Host visual regressions may appear only at runtime even when tests pass.
- Overlay layout may become visually awkward at 270p even if functionally correct; cosmetic tuning is intentionally deferred.
- Partial migration risks mismatch between runtime dimensions and host test fixtures if `PLN-0043` is not completed first.
## Dependencies
- `PLN-0043` MUST complete first.