Skip to content

ADR: extract shared @autobot/http-core — 3 fetch clients (main ApiClient / slm ApiClient / slmClient) share ~300-380 lines transport #12655

Closed

Description

@mrveiss

Owner/ADR decision surfaced by the Phase-2 migration. Three hand-written fetch clients share a near-identical transport core:

Shared: rawRequest (AbortController timeout + signal-forward + FormData + auth inject + 401 hook + base-URL join), get (retry+backoff, no-retry-4xx), post/put/patch/delete (204+content-type), extractErrorInfo, parseJsonBody, uploadFile (XHR progress — IDENTICAL between the two ApiClients).

Proposal: a createHttpClient(config) factory parameterized on the 5 axes that differ per app: baseUrl resolver, token source, 401 handler, auth-endpoint skip predicate, extra headers (X-Organization-Id main-only). Collapses ~300-380 lines.

Why an ADR (not execute-now): crosses the autobot-frontend ↔ autobot-slm-frontend package boundary (no @autobot/* workspace pkg exists yet — needs a shared-pkg/path-alias decision) and unifies security-sensitive 401/auth-storage behavior that currently differs per app on purpose. Recommend: land the bounded adapter de-dup first; do this after #12644 merges so all 3 clients exist to refactor together. Refs #12420, #12614.

Activity

  1. mrveiss commented on Jul 26, 2026

    @mrveiss
    OwnerAuthor

    Closing as subset of #12653 (this umbrella #12645's frontend cross-app duplication child, which covers the ApiClient/ssot-config/WS copy-adapt including the 3-client transport fork). Evidence + the createHttpClient/@autobot/http-core proposal moved to #12653. Refs #12645, #12653.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions