Real Render Worker Establishment

This commit is contained in:
2026-06-06 17:52:25 +01:00
parent 26e038e195
commit 80a36a3e7a
17 changed files with 1533 additions and 174 deletions
@@ -0,0 +1,81 @@
---
id: PLN-0098
ticket: real-render-worker-establishment
title: Define Platform Facade Contracts
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [runtime, platform, hal, facades]
---
## Objective
Define the first `prometeu-hal` platform facade contracts that will replace the monolithic `HardwareBridge` model.
## Background
`DEC-0032` requires Prometeu to move from one runtime-facing `HardwareBridge` to explicit platform services/facades. This first plan creates the stable contract surface without migrating callers yet.
## Scope
### Included
- Add facade modules/types in `crates/console/prometeu-hal`.
- Define names and module ownership for `RuntimePlatform`, `RenderSubmissionSink`, `RenderBackend`, `Game2DFrameComposer`, and `TestPlatform` integration points.
- Add minimal documentation explaining that `HardwareBridge` is legacy migration scaffold.
### Excluded
- Do not remove `HardwareBridge`.
- Do not migrate syscalls, firmware, Hub, host, or tests yet.
- Do not implement the real render worker.
## Execution Steps
### Step 1 - Add platform facade module
**What:** Create a `platform` module in `prometeu-hal`.
**How:** Add facade trait declarations and re-exports without changing existing call sites.
**File(s):** `crates/console/prometeu-hal/src/platform.rs`, `crates/console/prometeu-hal/src/lib.rs`.
### Step 2 - Declare domain facade boundaries
**What:** Define initial placeholder traits for render submission, render backend, Game2D composer, audio, input/touch, assets/storage, clock/pacing, and telemetry.
**How:** Keep non-render traits minimal or marker-like when detailed APIs are not yet migrated.
**File(s):** `crates/console/prometeu-hal/src/platform.rs`.
### Step 3 - Document migration status
**What:** Mark `HardwareBridge` as legacy scaffold.
**How:** Add module-level comments stating it must be removed by later plans.
**File(s):** `crates/console/prometeu-hal/src/hardware_bridge.rs`.
## Test Requirements
### Unit Tests
- Compile-only tests or trait object assertions where useful.
### Integration Tests
- Existing HAL/system/driver tests must continue to pass.
### Manual Verification
- Confirm `HardwareBridge` has no new dependencies on the platform facades.
## Acceptance Criteria
- [ ] Platform facade module exists in `prometeu-hal`.
- [ ] `HardwareBridge` is explicitly documented as migration scaffold.
- [ ] No runtime behavior changes.
- [ ] Existing tests pass.
## Dependencies
- `DEC-0032`.
## Risks
- Introducing too much API too early can freeze poor names. Keep this plan narrow.
@@ -0,0 +1,82 @@
---
id: PLN-0099
ticket: real-render-worker-establishment
title: Introduce Owned RenderSubmissionSink
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [runtime, renderer, hal, errors]
---
## Objective
Introduce an owned `RenderSubmissionSink` facade with minimal typed submission errors.
## Background
`DEC-0032` requires render publication to move away from `HardwareBridge` and to accept owned `RenderSubmission` values so the contract is compatible with async handoff.
## Scope
### Included
- Define `RenderSubmissionSink`.
- Define minimal `RenderSubmitError`.
- Implement the facade for the current local driver path.
### Excluded
- Do not migrate all publication call sites yet.
- Do not spawn a render worker.
- Do not remove `HardwareBridge::publish_render_submission`.
## Execution Steps
### Step 1 - Define sink and error
**What:** Add `RenderSubmissionSink` and `RenderSubmitError`.
**How:** `submit_render_submission(&mut self, submission: RenderSubmission) -> Result<(), RenderSubmitError>`.
**File(s):** `crates/console/prometeu-hal/src/platform.rs` or a render-specific HAL module.
### Step 2 - Implement local sink
**What:** Implement the sink for the current local driver implementation.
**How:** Adapt owned submission to the existing local `Hardware` publication path.
**File(s):** `crates/console/prometeu-drivers/src/hardware.rs`.
### Step 3 - Add tests
**What:** Prove owned submission is consumed by the local sink.
**How:** Add driver test using `RenderSubmission::game2d` and `RenderSubmission::shell_ui`.
**File(s):** `crates/console/prometeu-drivers/src/hardware.rs` or platform test module.
## Test Requirements
### Unit Tests
- Local sink accepts owned Game2D and ShellUi submissions.
- Error type is constructible and debuggable.
### Integration Tests
- `cargo test -p prometeu-hal -p prometeu-drivers`.
### Manual Verification
- Confirm the sink does not take `&RenderSubmission`.
## Acceptance Criteria
- [ ] `RenderSubmissionSink` takes owned `RenderSubmission`.
- [ ] Minimal typed error exists.
- [ ] Local driver implements the sink.
- [ ] Existing publication behavior remains intact.
## Dependencies
- `PLN-0098`.
## Risks
- Local paths may still need temporary borrow adaptation. Keep it internal to the implementation.
@@ -0,0 +1,80 @@
---
id: PLN-0100
ticket: real-render-worker-establishment
title: Migrate Local Render Publication to RenderSubmissionSink
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [runtime, renderer, platform]
---
## Objective
Move local render publication call sites from `HardwareBridge::publish_render_submission` to `RenderSubmissionSink`.
## Background
The sink must become the publication boundary before a real worker can replace the local path. Runtime, firmware, and Hub currently publish through the monolithic bridge.
## Scope
### Included
- Runtime local render surface uses `RenderSubmissionSink`.
- Firmware splash/crash publication uses the sink.
- Hub Shell UI publication uses the sink or a temporary adapter.
### Excluded
- Do not remove `HardwareBridge`.
- Do not migrate non-render domains.
- Do not change command buffering semantics yet.
## Execution Steps
### Step 1 - Adapt runtime tick publication
**What:** Replace `HardwareRenderSurface` dependency on `HardwareBridge::publish_render_submission`.
**How:** Route submission through `RenderSubmissionSink`.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/tick.rs`.
### Step 2 - Adapt firmware and Hub publication
**What:** Stop direct calls to `hw.publish_render_submission`.
**How:** Use the sink through explicit platform/render facade access or temporary adapter.
**File(s):** `crates/console/prometeu-firmware/src/firmware_step_splash_screen.rs`, `crates/console/prometeu-firmware/src/firmware_step_crash_screen.rs`, `crates/console/prometeu-system/src/programs/prometeu_hub/prometeu_hub.rs`.
### Step 3 - Update tests
**What:** Adjust tests that call `HardwareBridge::publish_render_submission`.
**How:** Use `RenderSubmissionSink` where render publication is the target.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/tests.rs`, driver tests.
## Test Requirements
### Unit Tests
- Existing render manager tests pass.
### Integration Tests
- `cargo test -p prometeu-system -p prometeu-firmware -p prometeu-drivers`.
### Manual Verification
- `rg "publish_render_submission" crates/console` shows only legacy implementation or intentionally unmigrated scaffold.
## Acceptance Criteria
- [ ] Runtime publication uses `RenderSubmissionSink`.
- [ ] Firmware/Hub publication no longer depend directly on the monolithic bridge.
- [ ] Tests pass.
## Dependencies
- `PLN-0099`.
## Risks
- Firmware code may need a small context shape change. Keep compatibility adapters temporary and explicit.
@@ -0,0 +1,82 @@
---
id: PLN-0101
ticket: real-render-worker-establishment
title: Remove Immediate Gfx2D and GfxUI Syscall Rendering
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [runtime, gfx, syscalls, renderer]
---
## Objective
Make `gfx2d.*` and `gfxui.*` syscalls buffer commands only, without mutating the framebuffer immediately.
## Background
`DEC-0032` requires framebuffer mutation to occur through render submission consumption/publication, not inside VM syscall dispatch. This is required before render can run independently.
## Scope
### Included
- Remove `hw.gfx_mut().*` immediate draw calls from VM dispatch for `gfx2d` and `gfxui`.
- Add regression tests for `gfx2d.clear` and `gfx2d.draw_text`.
- Update tests that assumed immediate pixel mutation.
### Excluded
- Do not remove `GfxBridge`.
- Do not migrate composer in this plan.
- Do not implement worker.
## Execution Steps
### Step 1 - Remove immediate Game gfx writes
**What:** Delete direct `hw.gfx_mut()` rendering in `Gfx*` syscall handlers.
**How:** Keep command buffering into `gfx2d_commands`.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/dispatch.rs`.
### Step 2 - Remove immediate Shell UI writes
**What:** Delete direct `hw.gfx_mut()` rendering in `GfxUi*` syscall handlers.
**How:** Keep command buffering into `gfxui_commands`.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/dispatch.rs`.
### Step 3 - Add regression tests
**What:** Prove syscalls do not affect pixels until publication.
**How:** Tests for `gfx2d.clear` and `gfx2d.draw_text` should inspect command buffers and frame publication.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/tests.rs`.
## Test Requirements
### Unit Tests
- `gfx2d.clear` buffers only.
- `gfx2d.draw_text` buffers only.
- Shell UI commands buffer only.
### Integration Tests
- Stress cartridge still renders after frame publication.
### Manual Verification
- `rg "gfx_mut\\(\\).*draw|gfx_mut\\(\\).*clear|gfx_mut\\(\\).*fill" dispatch.rs` returns no immediate render calls.
## Acceptance Criteria
- [ ] Gfx syscalls no longer mutate framebuffer immediately.
- [ ] Pixels change only after render submission publication.
- [ ] Tests updated to the new contract.
## Dependencies
- `PLN-0100`.
## Risks
- Debug workflows may have relied on immediate drawing. Tests must make the new frame boundary explicit.
@@ -0,0 +1,82 @@
---
id: PLN-0102
ticket: real-render-worker-establishment
title: Introduce Game2DFrameComposer Logical Service
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [runtime, composer, game2d, platform]
---
## Objective
Introduce `Game2DFrameComposer` as the logical-side service/facade for Game2D frame preparation.
## Background
`DEC-0032` states that `bind_scene`, `set_camera`, `emit_sprite`, and `close_game2d_packet` are logical frame preparation, not physical backend behavior.
## Scope
### Included
- Define a `Game2DFrameComposer` facade.
- Move or wrap existing `FrameComposer` behavior under logical-side naming.
- Migrate composer syscalls to use the facade rather than generic hardware.
### Excluded
- Do not rewrite scene cache internals.
- Do not move viewport cache across threads.
- Do not implement worker.
## Execution Steps
### Step 1 - Define composer facade
**What:** Add `Game2DFrameComposer` trait or service contract.
**How:** Include `begin_frame`, `bind_scene`, `unbind_scene`, `set_camera`, `emit_sprite`, `close_game2d_packet`, and required read checks.
**File(s):** `crates/console/prometeu-hal/src/platform.rs` or composer-specific HAL module.
### Step 2 - Implement using current composer
**What:** Make current local driver composer satisfy the new logical service.
**How:** Reuse `FrameComposer` implementation under adapter/implementation.
**File(s):** `crates/console/prometeu-drivers/src/frame_composer.rs`, `crates/console/prometeu-drivers/src/hardware.rs`.
### Step 3 - Migrate composer syscalls
**What:** Dispatch composer syscalls through `Game2DFrameComposer`.
**How:** Remove dependency on `HardwareBridge` methods for composer.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/dispatch.rs`.
## Test Requirements
### Unit Tests
- Composer facade closes packets equivalent to previous `FrameComposer`.
- Invalid scene/bank behavior remains unchanged.
### Integration Tests
- Existing scene/composer runtime tests pass.
### Manual Verification
- Composer syscalls no longer require `&mut dyn HardwareBridge`.
## Acceptance Criteria
- [ ] `Game2DFrameComposer` exists as logical service/facade.
- [ ] Composer syscalls route through it.
- [ ] Existing Game2D scene rendering remains correct.
## Dependencies
- `PLN-0098`.
- `PLN-0101`.
## Risks
- Scene cache ownership can be accidentally moved too early. Keep cache behavior local while changing the boundary.
@@ -0,0 +1,82 @@
---
id: PLN-0103
ticket: real-render-worker-establishment
title: Introduce RuntimePlatform and TestPlatform
status: open
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.
@@ -0,0 +1,79 @@
---
id: PLN-0104
ticket: real-render-worker-establishment
title: Migrate VM Runtime HostContext to Platform Services
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [runtime, vm, platform, hostcontext]
---
## Objective
Change VM runtime execution from receiving `&mut dyn HardwareBridge` to receiving explicit platform services.
## Background
`HostContext` currently carries `Option<&mut dyn HardwareBridge>`. That shape lets every syscall see the entire bridge. `DEC-0032` requires explicit services instead.
## Scope
### Included
- Introduce a platform-aware `HostContext` shape.
- Migrate VM runtime tick/dispatch to use platform services.
- Preserve VM tests and fault behavior.
### Excluded
- Do not migrate firmware/Hub in this plan.
- Do not remove `HardwareBridge` yet.
## Execution Steps
### Step 1 - Add platform host context
**What:** Extend or replace `HostContext` with platform-service access.
**How:** Add methods for required VM syscall domains instead of `require_hw()`.
**File(s):** `crates/console/prometeu-hal/src/host_context.rs`.
### Step 2 - Migrate runtime tick
**What:** Tick uses platform services for begin-frame, composer frame closure, render sink, audio clear, and telemetry reads.
**How:** Replace direct bridge access with explicit facade calls.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/tick.rs`.
### Step 3 - Migrate dispatch
**What:** VM syscall dispatch uses explicit facade methods.
**How:** Remove `ctx.require_hw()` as the central dispatch dependency.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/dispatch.rs`.
## Test Requirements
### Unit Tests
- VM dispatch tests pass with platform context.
### Integration Tests
- `cargo test -p prometeu-system`.
### Manual Verification
- `rg "require_hw|HardwareBridge" vm_runtime` shows no production VM runtime dependency except temporary compatibility adapters explicitly marked.
## Acceptance Criteria
- [ ] VM runtime dispatch no longer depends on the monolithic bridge.
- [ ] Tick uses explicit platform services.
- [ ] Existing VM fault behavior remains unchanged.
## Dependencies
- `PLN-0103`.
## Risks
- `HostContext` is used in VM unit tests. Migration must keep no-hardware test contexts ergonomic.
@@ -0,0 +1,81 @@
---
id: PLN-0105
ticket: real-render-worker-establishment
title: Migrate Firmware and Hub to Platform Services
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [firmware, hub, platform, render]
---
## Objective
Move firmware screens and Hub UI away from `HardwareBridge` and onto explicit platform services.
## Background
Firmware splash/crash and Hub currently receive `&mut dyn HardwareBridge` and publish Shell UI directly through it. `DEC-0032` requires migration to platform facades.
## Scope
### Included
- Firmware context uses platform services.
- Splash/crash screens publish via render sink.
- Hub input/render uses input/render facades.
### Excluded
- Do not implement worker.
- Do not change Hub UX or firmware state machine semantics.
## Execution Steps
### Step 1 - Update firmware context
**What:** Replace `PrometeuContext` hardware bridge field with platform services.
**How:** Expose only the services firmware needs: input, assets, render sink.
**File(s):** `crates/console/prometeu-firmware/src/firmware/prometeu_context.rs`, `firmware.rs`.
### Step 2 - Migrate firmware screens
**What:** Splash and crash screens publish through `RenderSubmissionSink`.
**How:** Build Shell UI packet and submit owned submission.
**File(s):** `crates/console/prometeu-firmware/src/firmware_step_splash_screen.rs`, `firmware_step_crash_screen.rs`.
### Step 3 - Migrate Hub
**What:** Hub uses platform input/render services instead of `HardwareBridge`.
**How:** Replace activation input and render publication dependencies.
**File(s):** `crates/console/prometeu-system/src/programs/prometeu_hub/prometeu_hub.rs`.
## Test Requirements
### Unit Tests
- Firmware state tests pass.
- Hub UI tests pass.
### Integration Tests
- `cargo test -p prometeu-firmware -p prometeu-system`.
### Manual Verification
- Firmware/Hub no longer call `publish_render_submission` on `HardwareBridge`.
## Acceptance Criteria
- [ ] Firmware context no longer exposes the monolithic bridge.
- [ ] Splash/crash/Hub render via render sink.
- [ ] Hub input uses platform/input facade.
## Dependencies
- `PLN-0103`.
- `PLN-0104`.
## Risks
- Firmware code is lifecycle-sensitive. Keep behavior changes out of scope.
@@ -0,0 +1,79 @@
---
id: PLN-0106
ticket: real-render-worker-establishment
title: Migrate Desktop Host to Platform Services
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [host, desktop, platform]
---
## Objective
Move the desktop host from directly exposing `prometeu_drivers::Hardware` as the runtime bridge to owning a platform implementation.
## Background
The host currently creates `Hardware::new()` and passes it into firmware/runtime paths. `DEC-0032` requires hosts to implement platform services, not to expose a monolithic bridge.
## Scope
### Included
- Introduce desktop/local platform ownership in the host.
- Replace host usage of `Hardware::W/H` with platform display constants or framebuffer descriptor.
- Keep the same visual/audio/input behavior.
### Excluded
- Do not implement render worker thread.
- Do not change windowing library or presentation policy.
## Execution Steps
### Step 1 - Add host platform field
**What:** Host runner owns a platform implementation rather than raw `Hardware`.
**How:** Wrap current local driver implementation behind platform facades.
**File(s):** `crates/host/prometeu-host-desktop-winit/src/runner.rs`.
### Step 2 - Replace direct hardware constants
**What:** Stop reading `Hardware::W/H` directly in host rendering/input.
**How:** Use a framebuffer/display descriptor exposed by platform/render service.
**File(s):** `crates/host/prometeu-host-desktop-winit/src/runner.rs`, `input.rs`.
### Step 3 - Update debugger host setup
**What:** Debugger paths instantiate platform fixture/implementation.
**How:** Replace `Hardware::new()` in debugger setup.
**File(s):** `crates/host/prometeu-host-desktop-winit/src/debugger.rs`.
## Test Requirements
### Unit Tests
- Host crate tests compile.
### Integration Tests
- `cargo test -p prometeu-host-desktop-winit`.
### Manual Verification
- Desktop host still runs stress cartridge.
## Acceptance Criteria
- [ ] Desktop host owns platform services.
- [ ] Host no longer treats `Hardware` as runtime bridge.
- [ ] Display dimensions come from platform/render descriptor.
## Dependencies
- `PLN-0105`.
## Risks
- Desktop host mixes runtime and window concerns. Keep worker threading out of this plan.
@@ -0,0 +1,89 @@
---
id: PLN-0107
ticket: real-render-worker-establishment
title: Migrate Remaining Platform Domains
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [platform, audio, input, assets, clock, telemetry]
---
## Objective
Migrate non-render domains out of `HardwareBridge` into explicit platform services.
## Background
`DEC-0032` permits render to migrate first but requires the full migration to cover audio, input/touch, assets/storage, clock/pacing, and telemetry where applicable.
## Scope
### Included
- Audio service/facade migration.
- Input/touch service/facade migration.
- Assets/storage service/facade migration.
- Clock/pacing and telemetry surface migration where currently coupled.
### Excluded
- Do not change domain semantics.
- Do not implement async IO unless already supported by existing services.
## Execution Steps
### Step 1 - Migrate audio
**What:** Replace `hw.audio()`/`hw.audio_mut()` production dependencies.
**How:** Route through explicit audio platform service.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/dispatch.rs`, firmware/host integration files.
### Step 2 - Migrate input and touch
**What:** Replace `hw.pad()`/`hw.touch()` dependencies.
**How:** Expose input snapshots through platform input service.
**File(s):** `crates/console/prometeu-system`, `crates/console/prometeu-firmware`, host input modules.
### Step 3 - Migrate assets/storage
**What:** Replace `hw.assets()`/`hw.assets_mut()` dependencies.
**How:** Route through asset/storage services while preserving commit and bank visibility semantics.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime`, `crates/console/prometeu-firmware`.
### Step 4 - Migrate clock/pacing/telemetry coupling
**What:** Move any platform-facing clock or telemetry coupling out of `HardwareBridge`.
**How:** Use explicit runtime/platform services.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime`, HAL telemetry modules.
## Test Requirements
### Unit Tests
- Audio/input/asset syscall tests pass.
### Integration Tests
- `cargo test -p prometeu-system -p prometeu-firmware -p prometeu-drivers`.
### Manual Verification
- `rg "audio_mut|pad_mut|touch_mut|assets_mut" crates/console` does not show production bridge dependencies.
## Acceptance Criteria
- [ ] Audio migrated to platform service.
- [ ] Input/touch migrated to platform service.
- [ ] Assets/storage migrated to platform service.
- [ ] Clock/pacing/telemetry bridge coupling removed where applicable.
## Dependencies
- `PLN-0104`.
- `PLN-0105`.
- `PLN-0106`.
## Risks
- Asset visibility semantics are high risk. Keep behavior-preserving tests broad.
@@ -0,0 +1,81 @@
---
id: PLN-0108
ticket: real-render-worker-establishment
title: Migrate Tests to TestPlatform
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [tests, platform, fixtures]
---
## Objective
Replace remaining test dependence on `Hardware::new()` and `HardwareBridge` with `TestPlatform` or narrower facade fixtures.
## Background
`DEC-0032` requires tests that need a full local platform fixture to use `TestPlatform`, not hidden `HardwareBridge` compatibility.
## Scope
### Included
- VM runtime tests.
- Firmware tests.
- Driver integration tests that still use monolithic hardware only as fixture.
- Host debugger tests where applicable.
### Excluded
- Do not remove production bridge until tests are migrated.
- Do not change behavior under test.
## Execution Steps
### Step 1 - Inventory test dependencies
**What:** Find all direct `Hardware::new()` and `HardwareBridge` test uses.
**How:** Use `rg` and classify by domain.
**File(s):** test modules across `crates/console` and `crates/host`.
### Step 2 - Migrate full-platform tests
**What:** Replace `Hardware::new()` with `TestPlatform`.
**How:** Use explicit facade accessors in assertions.
**File(s):** `crates/console/prometeu-system/src/services/vm_runtime/tests*.rs`, firmware tests.
### Step 3 - Migrate narrow tests
**What:** Replace full platform with narrower fixtures where only one domain is under test.
**How:** Use render/composer/audio/input/asset fixtures directly.
**File(s):** driver and runtime test modules.
## Test Requirements
### Unit Tests
- All migrated tests pass.
### Integration Tests
- `cargo test --workspace` or relevant workspace subset if full workspace is too broad.
### Manual Verification
- `rg "Hardware::new\\(|HardwareBridge" crates --glob '*test*'` shows no test dependency except tests explicitly covering legacy removal.
## Acceptance Criteria
- [ ] `TestPlatform` is the default full platform fixture.
- [ ] Tests no longer preserve `HardwareBridge` by habit.
- [ ] Narrow tests use narrower fixtures.
## Dependencies
- `PLN-0103`.
- `PLN-0107`.
## Risks
- Large mechanical changes can hide behavior regressions. Keep commits grouped by test domain.
@@ -0,0 +1,91 @@
---
id: PLN-0109
ticket: real-render-worker-establishment
title: Remove HardwareBridge and Update Specs
status: open
created: 2026-06-06
completed:
ref_decisions: [DEC-0032]
tags: [platform, cleanup, specs, hal]
---
## Objective
Remove `HardwareBridge` from the codebase and publish the new platform layer contract in specs.
## Background
`DEC-0032` explicitly forbids preserving `HardwareBridge` as final compatibility. After all domains and tests migrate, the bridge must be deleted.
## Scope
### Included
- Delete `HardwareBridge`.
- Remove exports/imports and adapters that only preserve bridge compatibility.
- Update canonical specs in English.
- Run validation and broad tests.
### Excluded
- Do not implement the real render worker.
- Do not change platform service semantics beyond cleanup.
## Execution Steps
### Step 1 - Delete bridge
**What:** Remove `HardwareBridge` trait and module.
**How:** Delete source file and remove exports/imports.
**File(s):** `crates/console/prometeu-hal/src/hardware_bridge.rs`, `crates/console/prometeu-hal/src/lib.rs`, all remaining imports.
### Step 2 - Remove compatibility adapters
**What:** Delete migration-only adapters.
**How:** Replace final references with direct platform services or remove dead code.
**File(s):** HAL, drivers, system, firmware, host modules touched by previous plans.
### Step 3 - Update specs
**What:** Document platform layer and removal of monolithic hardware bridge.
**How:** Update runtime/host/render specs in English.
**File(s):** `docs/specs/runtime/*.md` and related canonical specs.
### Step 4 - Validate and test
**What:** Run discussion validation and broad test suite.
**How:** Use `discussion validate` and cargo tests for affected crates.
**File(s):** repository root.
## Test Requirements
### Unit Tests
- HAL, drivers, firmware, system tests pass.
### Integration Tests
- Host desktop crate compiles/tests.
- Stress cartridge still runs through local platform path.
### Manual Verification
- `rg "HardwareBridge"` returns no production references.
- `rg "Hardware::new\\("` returns no runtime-facing dependency; any remaining use is local implementation detail or removed.
## Acceptance Criteria
- [ ] `HardwareBridge` is deleted.
- [ ] No production/runtime dependencies remain.
- [ ] Specs describe platform services/facades.
- [ ] Tests pass.
- [ ] `AGD-0043` can proceed without needing `&mut Hardware`, `&mut Gfx`, live `FrameComposer`, or mutable VM state in the worker.
## Dependencies
- `PLN-0107`.
- `PLN-0108`.
## Risks
- Removing the bridge too early will cause broad breakage. Only execute after dependency searches show all call sites have migrated.