• feat(#20): worldtree-sdk adapter foundation — ratatoskr.wt (slice-1)

    vh released this 2026-07-18 23:59:33 -07:00 | 69 commits to main since this release

    Slice-1 of the SDK cutover (docs/contracts/worldtree_sdk_cutover.contract.md):
    the adapter chokepoint onto worldtree-sdk 1.0.0, unit-tested but not yet wired
    to any surface (that is slice-2).

    • build_client(base_url, *, api_key, admin_key=None, transport) constructs the
      single WorldtreeClient over a ratatoskr-owned injected httpx.AsyncClient.
      INV-CUT-1: the SDK is given the transport (_owns_client=False) and never closes
      it — proven by a test asserting aclose() leaves ratatoskr's transport open.
    • translate_error implements the § Error map DEFAULT: SDK ApiError → the adapter's
      SessionApiFailed (carrying the SDK's parsed status/error_code/body); every
      discriminated WorldtreeError subclass passes through by identity. Route-specific
      rows land at their call-sites in later slices (the route is the discriminator).
    • SessionApiFailed gains error_code vs the retiring sessions.py copy (extends it
      per the contract error-map row); the two coexist transiently and reconcile in
      slice-2 (DEC-4 incremental cutover — nothing wires the adapter this slice, so
      they never meet at runtime).

    Deletes no hand-rolled path, so DEC-4's live-smoke bar does not apply yet.
    Suite 541 green (534 + 7 new); mypy + ruff clean. Patch (internal foundation;
    the cutover's minor bump is DEC-6 at slice-7 ship).

    Downloads