Skip to content

Swap the mock engine to @parity/truapi-host #40

Description

@decrypto21

Summary

Replace the mock's wire engine - hand-written @novasamatech/host-container - with the generated @parity/truapi-host dispatcher. Keep all value-add (dev-key derivation, real sr25519 signing, signing log, productAccounts pinning, RPC proxy, Playwright fixture, fault injection). Only the protocol layer changes.

Why now

product-sdk#186 goes direct to @parity/truapi, deleting @novasamatech/host-api(-wrapper). On merge, a migrated product emits the generated truapi envelope the current mock can't decode - so every migrating product loses its E2E harness unless the mock moves in lockstep.

Design

Swap flat container.handleXxx(...) registration to nested, versioned, tagged-union handlers via createTrUApiServer(provider, handlers). ~40 slots regroup under 15 services; legacy error classes map to generated tagged unions. The host-side iframe Provider (already built, src/truapi-engine/host-iframe-provider.ts) plugs straight in. The fault layer wraps the raw provider below the engine, so it's retained - and protocolVersion skew becomes implementable here.

Tasks

  • Drop in the host-side iframe Provider (built)
  • Replace createContainer with createTrUApiServer(provider, handlers); regroup ~40 slots into 15 nested services; map legacy errors → tagged unions
  • Port the chain.* set (14 handlers) - reuse the truapi-host-integration/chain-handlers.ts prototype (response/follow-item mapping to finish)
  • Rewrite the test product on the @parity/truapi client (the chunkiest part - it currently uses @novasamatech/host-api-wrapper)
  • Re-target the fault layer to truapi's wire (handshake = wire id 1 via decodeWireMessage); implement protocolVersion
  • Drop @novasamatech/host-container; bump major; update CHANGELOG/forum-post/README

Acceptance criteria

  • A product on migrated @parity/product-sdk-* E2E-tests green against the new-engine mock; existing integration tests pass; @novasamatech/host-container removed.

Sequencing

Must land in lockstep with / after product-sdk#186

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions