docs/wml-engine/implementation-tickets.md
Implementation Tickets (Step-by-Step)
Status: historical draft. Use ticket-plan.md as the active implementation backlog.
This backlog is ordered for shipping value early while preserving future expansion.
Phase 0: Stabilize Current MVP
T0-1 Contract hardening
- Goal: freeze input/output types used by host.
- Tasks:
- Keep
loadDeckContextas primary ingestion API. - Document compatibility with
loadDeck. - Add contract tests in TS host sample.
- Acceptance:
- Host can load decks through both APIs.
baseUrl()andcontentType()return expected values.
T0-2 Parser robustness for current tags
- Goal: prevent crashes on malformed but common decks.
- Tasks:
- Improve tag scanning for nested inline links in paragraphs.
- Preserve text order around inline anchors.
- Treat unknown tags as ignorable nodes.
- Acceptance:
- No panic on unknown tags.
- Snapshot tests stable across malformed inputs.
T0-3 Render/focus determinism
- Goal: deterministic focus and draw output.
- Tasks:
- Ensure each logical link maps to one focus index even when wrapped.
- Lock y-coordinate and wrap behavior in tests.
- Acceptance:
- Golden tests pass for multiple viewport widths.
Phase 1: Spec-Driven Card Metadata
T1-1 Card metadata parsing
- Goal: parse card attributes needed for semantics.
- Tasks:
- Add title/newcontext/ordered parsing.
- Add access metadata parsing (
domain,path). - Expose metadata through debug getters.
- Acceptance:
- Parsed card metadata is visible and unit-tested.
T1-2 Navigation history policy
- Goal: align history transitions with WML context intent.
- Tasks:
- Introduce runtime transition mode (push/replace/new context).
- Persist card+url state in history entries.
- Acceptance:
- Back navigation behaves per transition mode tests.
Phase 2: Task Model (do + go/prev/noop/refresh)
T2-1 Parse and store do blocks
- Goal: establish task bindings.
- Tasks:
- Parse
doposition/name/type/label metadata. - Parse task child (
go|prev|noop|refresh).
- Acceptance:
- Task map available per card.
T2-2 Host-visible softkey model
- Goal: surface usable softkeys to renderer host.
- Tasks:
- Add softkey labels to render state.
- Add key mapping for softkey activation.
- Acceptance:
- Host can display and invoke task bindings.
T2-3 Implement task execution
- Goal: execute task semantics.
- Tasks:
go: URL resolution + method + postfield payload event.prev: history pop.noop: no-op state update.refresh: rerender with current state.
- Acceptance:
- Integration tests cover each task path.
Phase 3: Variables + Substitution
T3-1 VariableStore core
- Goal: runtime variable persistence.
- Tasks:
- Add variable store to runtime state.
- Parse/update from setvar locations as supported.
- Acceptance:
- Variables survive card transitions in same deck context.
T3-2 Substitution engine
- Goal: replace variable references in text/attributes.
- Tasks:
- Add substitution for text nodes.
- Add substitution for href and task labels/targets.
- Guard against recursive expansion loops.
- Acceptance:
- Deterministic substitution tests pass.
Phase 4: Forms and Request Payloads
T4-1 Form controls model
- Goal: parse and render input/select/option structures.
- Tasks:
- Add form node types.
- Add focus/edit behavior.
- Acceptance:
- Form controls render and can be edited.
T4-2 Submit pipeline
- Goal: build request payloads for host transport.
- Tasks:
- Serialize GET query and POST fields.
- Emit structured navigation request event.
- Acceptance:
- Host receives expected payload structure.
Phase 5: Events and Timers (Controlled Scope)
T5-1 onevent dispatch
- Goal: support deterministic event handlers.
- Tasks:
- Parse onevent bindings.
- Dispatch supported event types through task executor.
- Acceptance:
- Event-trigger tests pass for supported types.
T5-2 timer baseline
- Goal: safe timer support.
- Tasks:
- Parse timer metadata/value.
- Add host tick hook or monotonic timer callback.
- Acceptance:
- Timer action triggers at expected intervals in tests.
Cross-Cutting Tickets
TX-1 Error taxonomy
- Define stable error codes for parse/nav/task/runtime failures.
TX-2 Observability
- Add debug snapshot dump (
active card,focus index,links,metadata).
TX-3 Compatibility fixtures
- Build fixture corpus from spec-like decks and real-world samples.
TX-4 Performance guardrails
- Add benchmark test for large decks and deep history.