prometeu-runtime/discussion/workflow/plans/PLN-0103-introduce-runtime-platform-and-testplatform.md

83 lines
2.3 KiB
Markdown

---
id: PLN-0103
ticket: real-render-worker-establishment
title: Introduce RuntimePlatform and TestPlatform
status: done
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [runtime, platform, tests]
---
## Objective
Introduce `RuntimePlatform`/`Platform` as the aggregate of explicit platform services, and `TestPlatform` as the default test fixture.
## Background
`DEC-0032` requires tests and runtime integration to depend on explicit facades rather than `Hardware::new()` and `HardwareBridge`.
## Scope
### Included
- Define aggregate platform access shape.
- Add `TestPlatform` in `prometeu-drivers`.
- Start migrating representative VM runtime tests.
### Excluded
- Do not migrate all tests in this plan.
- Do not remove `HardwareBridge`.
- Do not migrate all host code.
## Execution Steps
### Step 1 - Define platform aggregate
**What:** Add `RuntimePlatform` or `Platform` aggregate facade.
**How:** Expose accessors for render sink, Game2D composer, audio, input/touch, assets/storage, clock/pacing, and telemetry placeholders.
**File(s):** `crates/console/prometeu-hal/src/platform.rs`.
### Step 2 - Add TestPlatform
**What:** Provide ergonomic test fixture implementing the initial platform facades.
**How:** Reuse current local driver components internally without exposing `HardwareBridge`.
**File(s):** `crates/console/prometeu-drivers/src/test_platform.rs`, `crates/console/prometeu-drivers/src/lib.rs`.
### Step 3 - Migrate representative tests
**What:** Move a small set of runtime tests from `Hardware::new()` to `TestPlatform`.
**How:** Choose tests covering render, composer, and asset surfaces.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/tests.rs`, asset/memcard test modules as appropriate.
## Test Requirements
### Unit Tests
- `TestPlatform` initializes all required facades.
### Integration Tests
- Migrated runtime tests pass with `TestPlatform`.
### Manual Verification
- New tests do not import `prometeu_drivers::Hardware` directly.
## Acceptance Criteria
- [ ] `RuntimePlatform`/`Platform` aggregate exists.
- [ ] `TestPlatform` exists and is used by representative tests.
- [ ] Test ergonomics remain acceptable.
## Dependencies
- `PLN-0098`.
- `PLN-0099`.
- `PLN-0102`.
## Risks
- Overly broad aggregate can recreate `HardwareBridge`. Keep domain access explicit and named.