TinyChain-Inc / TinyChain-Inc/client

JS client parity with Python: Node + browser + WASM integration plan

Open
#74 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
0
Forks
0
Avg merge
3d 8h
Merged PRs (30d)
32

Description

Summary

Upgrade the JavaScript client so it reaches functional parity with the Python client for the supported TinyChain surface, with one consistent integration path across:

  • Node.js runtime (server/SSR/proxy use cases)
  • browser runtime (ESM + web app hydration)
  • WASM-backed library workflows (including loading/installing a Library artifact and route invocation semantics)

This issue defines:

  1. what is already complete on the backend vs still planned,
  2. where JS differs from Python today,
  3. how JS must integrate with the web client in Node and browser contexts,
  4. concrete milestones and acceptance criteria.

Backend Status: Complete vs Planned

Complete (available now; client can target immediately)
  • Canonical runtime URI namespaces and contracts are defined and stable (/state, /class, /lib, /service, /host, /healthz).
  • tc-server currently serves /lib, /service, and /host with HTTP/PyO3/WASM adapter feature gates.
  • WASM library install model and manifest expectations are documented and enforced:
    • Python Library.__json__ layout is canonical.
    • WASM method entries must include route/export mapping (wasm_export semantics).
  • Python client already supports canonical library install paths and WASM install via tc.install(..., wasm=...).
  • Web scaffold is wired to consume @tinychain/js and validates minimal request path (GET /healthz) across SSR + browser hydration.
Planned / In progress (must be reflected in JS parity planning)
  • Full v1-equivalent transaction guarantees in tc-server remain roadmap work.
  • Tensor route ownership is migrating to tc-collection as canonical owner (transitional compatibility in tc-state).
  • Transactional tensor orchestration over fensor and integration with backend tensor storage/index work are roadmap items.
  • Browser/WS transport expansion is planned; JS must maintain deterministic HTTP fallback semantics.

Current Gap: Python vs JavaScript

Python currently provides (baseline target)
  • High-level Library authoring model and route decorators.
  • Canonical install helpers for remote and WASM library flows.
  • Host abstractions, URI builders, backend context switching, deferred planning.
  • Rich symbolic tensor method surface and experimental autodiff package flow.
  • Broader end-to-end examples and integration tests (including WASM-related flows).
JavaScript currently provides
  • Minimal HTTP client wrapper (createTinyChainClient) with request and get.
  • Local package consumed by web scaffold.
Missing in JavaScript (parity gaps)
  • No JS Library authoring/install/runtime helper surface equivalent to Python.
  • No parity tensor API and no autodiff-facing contract.
  • No parity route/manifest helper layer.
  • No parity fixture matrix proving behavioral equivalence with Python.
  • No documented end-to-end Node + browser + WASM flow equivalent to Python examples.

Integration Requirements (Node + Browser + Web)

Node.js requirements
  • Support canonical TinyChain client operations with server credentials held server-side only.
  • Support install/runtime flows equivalent to Python where credentials and policy allow.
  • Provide stable integration for SSR/proxy handlers used by client/web.
Browser requirements
  • Browser-safe configuration only (no privileged token leakage).
  • Same high-level request semantics for supported operations as Node.
  • Deterministic fallback behavior when optional transports are unavailable.
Web client contract
  • Keep client/js as the protocol/runtime implementation layer.
  • Keep client/web as integration scaffold (SSR shell + hydration + initial state contract).
  • Add parity integration tests that verify equivalent behavior between server and browser adapters for supported flows.

WASM + Library + Tensor/ha-ndarray Alignment

Define one canonical JS story for loading/using WASM-backed TinyChain libraries:

  • Build/import a WASM binary plus canonical Library manifest metadata.
  • Install/invoke through TinyChain runtime APIs without introducing non-canonical payload formats.
  • Ensure route/export mapping semantics match backend expectations.
  • Ensure tensor-oriented workflows remain aligned with backend ownership boundaries (collection-owned tensor semantics, transactional storage roadmap).
  • Explicitly document what is supported now vs blocked on backend milestones.

Milestones

  1. Parity matrix import (JS vs Python)

    • Import Python capability matrix and tag each row: implemented, planned, blocked-on-backend, out-of-scope.
  2. Core API parity

    • Implement JS parity for canonical request/response/error semantics and manifest/URI helper behavior.
  3. Install/runtime parity

    • Add JS equivalents for Library-centric install/runtime flows where supported.
  4. Web integration parity

    • Prove Node SSR and browser hydration paths both run through the same JS client contract.
  5. WASM flow parity

    • Add canonical JS WASM-backed library install/invoke path and tests.
  6. Advanced parity gates

    • Add parity fixture suite against Python for supported tensor/runtime flows.
    • Mark blocked rows with explicit backend dependency references.

Acceptance Criteria

  • A published JS parity matrix exists and is linked from client/js/ROADMAP.md.
  • Every parity row has one owner and one status (implemented, planned, blocked-on-backend, out-of-scope).
  • JS and Python pass cross-language fixtures for all rows marked implemented.
  • client/web integration tests pass for Node and browser paths using the same JS client contract.
  • WASM-backed library flow is documented and tested for currently supported operations.
  • Blocked items are explicitly tied to backend roadmap dependencies (transactional guarantees, tensor ownership/storage milestones, transport maturity).

Non-goals

  • Introducing non-TinyChain transport stacks or bespoke protocol shapes.
  • Moving shard/transaction ownership semantics into browser-only logic.
  • Shipping UI kits in client/js (belongs in client/web or downstream app kits).

Suggested Follow-up Tasks

  • Create sub-issues for each milestone with fixture/test ownership.
  • Add one status dashboard section in client/js/ROADMAP.md linking sub-issues.
  • Add a parity CI lane that runs JS/Python cross-language fixture comparisons for implemented rows.

Security parity dependency

JavaScript parity includes the complete TinyChain authorization model; request/response API parity alone is insufficient.

Track the implementation through:

  • Cross-runtime security umbrella: TinyChain-Inc/tcv2#48
  • Canonical hierarchical permission/capability contract: TinyChain-Inc/tcv2#49
  • Rust authoritative enforcement: TinyChain-Inc/tcv2#50
  • Node.js server credential and delegation boundaries: TinyChain-Inc/tcv2#51
  • Browser/WASM host capability boundaries: TinyChain-Inc/tcv2#52
  • JavaScript authorization and manifest parity: TinyChain-Inc/tcv2#53
  • Cross-runtime conformance suite: TinyChain-Inc/tcv2#54
Additional JavaScript acceptance criteria
  • JS can declare immutable dependency whitelists and requested capabilities
  • JS can author canonical owner/group/other hierarchical policies
  • JS and Python serialize equivalent manifests and policies canonically
  • Node preserves attenuated user authority instead of substituting ambient service authority
  • Browser bundles and hydration state contain no privileged Node credentials
  • Browser/WASM modules receive only manifest-authorized host imports
  • Actual-browser conformance and adversarial tests pass, not only Node emulation
  • The Rust server remains authoritative for every protected operation

Tembo-sized implementation issues

  • #85 — parity matrix and runtime-neutral request/URI/error core
  • #86 — Library/Service/Class authoring and lifecycle helpers
  • #87 — separated Node/browser adapters with SSR/hydration validation
  • #88 — actual-browser WASM Library flow and cross-runtime parity

Dependency order: #85 → (#86 and #87 in parallel) → #88. UI toolkit code remains in client/web and consumes this client contract; it does not belong in client/js.

automation:
  eligible: false
  executor_profile: tembo
  readiness: rollup
  primary_repository: TinyChain-Inc/client
  base_branch: main
  writable_scope: []
  prerequisites: ["#85", "#86", "#87", "#88"]
  concurrency_group: js-parity-rollup
  required_commands: []
  external_actions: none
  draft_pr_only: true
  completion_authority: human

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with client/js/ROADMAP.md and the parity work identified in sub-issue #85, then review the dependency order through #86–#88. Map the Python capability matrix to implemented, planned, blocked-on-backend, or out-of-scope rows, and use the acceptance criteria to define completion across Node, browser, WASM, security, and cross-language fixtures.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, python, wasm
Domain
api, backend-api-design, security, testing-qa, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.