Skip to content

Expose concrete resource handles behind private I/O ports - #125

Closed
Stephen Belanger (Qard) wants to merge 1 commit into
refactor/credential-scopesfrom
refactor/concrete-resource-handles
Closed

Stephen Belanger (Qard) wants to merge 1 commit into
refactor/credential-scopesfrom
refactor/concrete-resource-handles

Conversation

@Qard

Copy link
Copy Markdown
Contributor

Applications previously had to name types such as SpanHandle<BraintrustClient> and propagate SDK implementation parameters whose trait bounds were private. The stream adapter and evaluation hooks also exposed that coupling. Resources retained a whole client just to reach transport or delivery services.

Expose concrete SpanHandle, Experiment, Dataset, their builders, and DatasetIterator. Keep dependency injection behind private resource API, span submission, and delivery lifecycle ports. The resource HTTP adapter owns only the shared HTTP pool; tracing and lifecycle ports are implemented directly by the queue. Public methods retain their existing operation behavior, credential scopes, and shared registration state.

Experiment span builders now own the captured dependencies and can outlive their experiment. Update stream adapters, evaluation hooks, tests, and documentation to use concrete handles. Remove obsolete experiment API compatibility modules and deny private bounds/interfaces at the crate level.

Stacked on #124. Finished-span behavior and the remaining eager operation/runtime work follow in separate layers. Planning notes remain local.

Validation: 279 unit/integration tests and 9 doctests passed (one existing integration test and four doctests ignored), strict Clippy and rustdoc, formatting, and git diff --check. Consumer coverage stores concrete resource types directly, checks owned Send/Sync handles and builders, uses resources/pagination after client drop, and verifies accepted writes drain after the last resource/client is dropped. A weak-reference regression confirms resource dependencies release the original client state.

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