docs/waves/engine_host_frame_work_items.md
Engine-Host Frame Migration Work Items
Purpose: execution board for migrating Waves runtime/host integration to EngineFrame + EngineInputEvent.
Status keys:
todoin-progressblockeddone
Archive:
docs/waves/ENGINE_HOST_FRAME_WORK_ITEMS_ARCHIVE.md
Program Guardrails
- Keep changes layered:
- engine runtime logic in
engine-wasm/ - host rendering/input wiring in
browser/andengine-wasm/host-sample/ - no WBXML parsing in host TypeScript
- Contract-first policy:
- update contract surfaces before implementation cutover
- keep native and wasm behavior aligned
- Determinism policy:
- preserve deterministic navigation, focus, and frame output ordering
- no host-timing dependent layout logic
- Scope policy:
- no broad refactor bundles; deliver phased, testable slices
Ticket Template
IDStatusDepends OnFilesBuildTestsAcceptNotes(optional)
Phase F0: Contract and API Introduction
F0-01 Define canonical frame/input contract types
Status:todoDepends On: noneFiles:
engine-wasm/engine/src/render/*engine-wasm/contracts/wml-engine.tsbrowser/src-tauri/src/contract_types.rsbrowser/src-tauri/src/bin/generate_contracts.rs
Build:
- Add additive types for:
EngineFrameDrawCommand(new contract alias or replacement forDrawCmd)EngineInputEventEngineCommand(if command queue is adopted)
- Keep legacy
RenderListcontract available.
Tests:
- contract generation succeeds
- TypeScript compile in
browser/frontend
Accept:
- New frame/input types are exported in Rust and TS contracts without breaking current hosts.
F0-02 Add additive engine APIs with compatibility wrappers
Status:todoDepends On:F0-01Files:
engine-wasm/engine/src/lib.rsengine-wasm/contracts/wml-engine.tsbrowser/src-tauri/src/lib.rsbrowser/contracts/generated/engine-host.ts
Build:
- Add:
renderFrame()handleInput(event)
- Keep:
render()handleKey()
- Implement wrapper behavior so outputs stay equivalent for key-only flow.
Tests:
cd engine-wasm/engine && cargo testcd browser/src-tauri && cargo test
Accept:
- Old and new APIs return equivalent behavior for existing fixtures and key sequences.
F0-03 Contract drift guardrails for frame/input interfaces
Status:todoDepends On:F0-01Files:
scripts/(new contract drift check).github/workflows/*docs/waves/CONTRACT_REQUIREMENTS_MAPPING.md
Build:
- Add CI check that generated TS contracts are in sync with Rust contract types.
Tests:
- intentional drift causes CI/check failure
Accept:
- contract changes cannot merge with stale generated outputs.
Phase F1: Host Rendering Migration
F1-01 WASM host sample frame renderer adoption
Status:todoDepends On:F0-02Files:
engine-wasm/host-sample/renderer.tsengine-wasm/host-sample/main.tsengine-wasm/README.md
Build:
- Consume
renderFrame()and draw from frame contract. - Keep behavior and appearance stable.
Tests:
- host sample manual fixture checks
Accept:
- sample no longer depends on legacy
RenderListcall path.
F1-02 Tauri frontend viewport migration to Canvas2D
Status:todoDepends On:F0-02Files:
browser/frontend/src/app/browser-shell-template.tsbrowser/frontend/src/app/browser-presenter.tsbrowser/frontend/src/styles.cssbrowser/frontend/src/app/browser-presenter.test.ts
Build:
- replace HTML line injection viewport path with canvas renderer adapter.
- preserve skeleton, status, and timeline UX.
Tests:
pnpm --dir browser/frontend testpnpm --dir browser/frontend build
Accept:
- viewport rendering no longer uses
innerHTMLfor deck content. - draw output parity remains stable for local fixtures.
F1-03 Navigation-state integration with frame rendering
Status:todoDepends On:F1-02Files:
browser/frontend/src/app/navigation-state.tsbrowser/frontend/src/app/browser-controller.tsbrowser/frontend/src/app/navigation-state.test.ts
Build:
- keep render/snapshot sequencing deterministic with
engineRenderFrame.
Tests:
- navigation-state tests cover render-after-load and render-after-input ordering.
Accept:
- no regressions in load/fetch/back/external-intent flows.
Phase F2: Input Event Expansion
F2-01 Add click event path with deterministic hit resolution
Status:todoDepends On:F0-02Files:
engine-wasm/engine/src/lib.rsengine-wasm/engine/src/layout/*browser/frontend/src/app/browser-controller.tsengine-wasm/host-sample/main.ts
Build:
- add host click ->
EngineInputEvent::Clickrouting. - engine resolves click through frame/hit regions, not host-side link lookup.
Tests:
- engine fixture tests for click-target determinism
- host integration tests for click navigation
Accept:
- click activation behavior matches keyboard activation targets.
F2-02 Add scroll event path and viewport offset semantics
Status:todoDepends On:F2-01Files:
engine-wasm/engine/src/lib.rsengine-wasm/contracts/wml-engine.tsbrowser/frontend/src/app/browser-controller.ts
Build:
- support
EngineInputEvent::Scroll. - define deterministic scroll clamping and frame offset behavior.
Tests:
- scroll boundary and repeatability tests in engine.
Accept:
- identical event traces produce identical visible frame windows.
F2-03 Softkey/input abstraction alignment
Status:todoDepends On:F2-01Files:
browser/frontend/src/app/keyboard.tsbrowser/frontend/src/app/browser-controller.tsengine-wasm/contracts/wml-engine.ts
Build:
- map host keyboard/buttons into unified
EngineInputEventpath. - keep legacy key APIs as compatibility layer until cutover.
Tests:
- keyboard and control-button regression tests.
Accept:
- single input abstraction path is used in host application code.
Phase F3: Engine Internal Boundary Split
F3-01 Separate layout and paint phases
Status:todoDepends On:F0-02Files:
engine-wasm/engine/src/layout/*engine-wasm/engine/src/render/*engine-wasm/engine/src/lib.rs
Build:
- move draw-command emission into paint pass over layout output.
- preserve current command ordering and focus semantics.
Tests:
- existing render snapshot tests
- new tests for layout-output determinism independent from paint
Accept:
- layout and paint responsibilities are explicit and test-covered.
F3-02 Frame snapshot parity harness (native + wasm)
Status:todoDepends On:F3-01Files:
engine-wasm/engine/src/lib.rsengine-wasm/engine/tests/*(new if needed)docs/waves/SPEC_TEST_COVERAGE.md
Build:
- add parity-critical snapshots for
renderFrameand input traces.
Tests:
cd engine-wasm/engine && cargo test
Accept:
- frame and navigation parity is verified across targets for critical flows.
Phase F4: Cutover and Legacy Removal
F4-01 Remove legacy render/input API from host paths
Status:todoDepends On:F1-03,F2-03,F3-02Files:
browser/frontend/src/*engine-wasm/host-sample/*browser/contracts/generated/*engine-wasm/contracts/wml-engine.ts
Build:
- stop calling legacy
render()/handleKey()in host code. - retain compatibility only where needed for transition windows.
Tests:
- browser frontend tests/build
- host-sample smoke checks
Accept:
- all active hosts run on frame/input API path.
F4-02 Legacy contract and wrapper removal (final)
Status:todoDepends On:F4-01Files:
engine-wasm/engine/src/lib.rsengine-wasm/contracts/wml-engine.tsbrowser/src-tauri/src/contract_types.rsbrowser/src-tauri/src/bin/generate_contracts.rs- docs references to legacy API
Build:
- remove legacy
RenderList/DrawCmdwrappers and key-only APIs when no longer used.
Tests:
- engine, browser frontend, and tauri host tests/builds
Accept:
- contract surface is single-path (
EngineFrame+EngineInputEvent) and documented.
Program Tracking
Cross-reference docs:
- migration architecture:
docs/waves/ENGINE_HOST_FRAME_MIGRATION_PLAN.md - waves integration board:
docs/waves/WORK_ITEMS.md - maintenance board:
docs/waves/MAINTENANCE_WORK_ITEMS.md
Completion gate:
- all
F0-F4tickets markeddone - parity gates in
docs/waves/SPEC_TEST_COVERAGE.mdupdated and passing - contract mapping updated in
docs/waves/CONTRACT_REQUIREMENTS_MAPPING.md