Skip to content

Separate streaming parsing, incremental accumulation and instrumentation - #154

Open
Stephen Belanger (Qard) wants to merge 2 commits into
refactor/release-msrv-resolutionfrom
refactor/stream-components
Open

Stephen Belanger (Qard) wants to merge 2 commits into
refactor/release-msrv-resolutionfrom
refactor/stream-components

Conversation

@Qard

@Qard Stephen Belanger (Qard) commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Streaming previously retained every raw chunk and reparsed the entire history for each partial update. Separate the OpenAI-compatible parser, normalized updates, incremental accumulator, public output types and span instrumentation. Retain the current provider scope and public stream entry points.

Snapshots now include newly pushed chunks, sparse tool-call indices survive assembly, and overflowing token totals do not panic. Span polling uses a safe state machine without shared async mutexes or atomic counters. Role-only and usage-only chunks do not consume time-to-first-token. Exhaustion observes final delivery; early drop submits partial output and ends the span immediately. Provider errors pass through unchanged and mark the recorded span as failed.

Validation: 445 unit/integration tests and 19 doctests passed (four existing ignored), including fragmented/sparse tool calls, malformed/unknown chunks, usage aliases, snapshot invalidation, EOF, errors and early drop. Strict Clippy, rustdoc, formatting and diff checks passed. Rust 1.86 passed focused streaming/lifecycle tests and package verification with a fresh offline dependency resolution.

Stacked on #152. This implements stage 10 of the pre-release refactor; consumer migration remains separate.

@Qard
Stephen Belanger (Qard) changed the base branch from refactor/release-package-docs to refactor/release-msrv-resolution October 28, 2026 12:05
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