paritytech / paritytech/host-api-test-sdk
Swap the mock engine to `@parity/truapi-host`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 1
- Avg merge
- 3h 46m
- Merged PRs (30d)
- 2
Description
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
createContainerwithcreateTrUApiServer(provider, handlers); regroup ~40 slots into 15 nested services; map legacy errors → tagged unions - Port the
chain.*set (14 handlers) - reuse thetruapi-host-integration/chain-handlers.tsprototype (response/follow-item mapping to finish) - Rewrite the test product on the
@parity/truapiclient (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); implementprotocolVersion - 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-containerremoved.
Sequencing
Must land in lockstep with / after product-sdk#186
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the built provider in src/truapi-engine/host-iframe-provider.ts and the chain prototype in truapi-host-integration/chain-handlers.ts. Trace createContainer and the test product's @novasamatech/host-api-wrapper usage before reviewing the fault layer and wire handshake handling. Done means migrated product E2E tests and existing integration tests pass, with @novasamatech/host-container removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- playwright, typescript
- Domain
- api, testing-qa
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100