Skip to content

Refactor API client session handling - #63

Draft
Stephen Belanger (Qard) wants to merge 1 commit into
mainfrom
api-client
Draft

Stephen Belanger (Qard) wants to merge 1 commit into
mainfrom
api-client

Conversation

@Qard

Copy link
Copy Markdown
Contributor

Summary

Refactor the SDK API layer so login/session state, config defaults, HTTP client construction, request execution, and authenticated endpoint serialization live under src/api.

What changed

  • Added ApiClient construction from LoginState and moved login/session management into the API module.
  • Moved config/env handling and HTTP transport helpers into src/api, removing the old top-level config/transport exposure.
  • Updated LogQueue to accept LoginState, lazily wait for login, and create its ApiClient only when processing begins so events can be queued before login completes.
  • Kept logs3 batching/retry/overflow orchestration in the uploader/queue layers while the API layer performs raw request and response serialization.
  • Migrated callers and tests to the new API contracts.

Why

The HTTP layer should be isolated behind simple API contracts. Higher-level SDK components should not need to know about reqwest, raw credentials, login notification plumbing, or endpoint base URL routing.

Impact

This preserves queue-before-login behavior while reducing credential and HTTP client plumbing across logger, queue, logs3, dataset, span, and experiment flows.

Validation

  • cargo fmt --check
  • cargo check --all-targets
  • cargo test --all-targets
  • RUSTDOCFLAGS='-D warnings' cargo doc --no-deps

@Qard
Stephen Belanger (Qard) force-pushed the api-client branch 2 times, most recently from 00d48f5 to 7b8553b Compare June 4, 2026 17:50
@Qard Stephen Belanger (Qard) changed the title [codex] Refactor API client session handling Refactor API client session handling Jun 5, 2026
@Qard
Stephen Belanger (Qard) force-pushed the api-client branch 8 times, most recently from c609bb4 to f447823 Compare June 11, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant