Skip to content

[Refactor] Roll out stream helpers to LiteLLM and Z.ai specs - #1095

Merged
edelauna merged 2 commits into
mainfrom
refactor/lite-zai-stream-test-utils-06q4nypl2c73c
Aug 1, 2026
Merged

[Refactor] Roll out stream helpers to LiteLLM and Z.ai specs#1095
edelauna merged 2 commits into
mainfrom
refactor/lite-zai-stream-test-utils-06q4nypl2c73c

Conversation

@zoomote

@zoomote zoomote Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

What changed

  • Migrated lite-llm.spec.ts to the shared stream helpers, replacing all inline async-iterator mock streams with asyncStreamFrom and all pure result/drain loops with collectStream.
  • Migrated zai.spec.ts to the same helpers, replacing custom [Symbol.asyncIterator] next-chain mocks with asyncStreamFrom.
  • Switched describe-scoped LiteLLM mock streams to fresh makeMockStream() factories so each test gets an unconsumed generator.
  • Removed the unused collectStream import from zai.spec.ts.
  • Left existing ESLint suppressions counts unchanged after verification.

Why this change was made

This is the more ambitious continuation of the approved test-utils rollout: two high-count provider specs migrated in one PR while keeping single-chunk .next() assertions inline where they are the point of the test.

Impact

No user-facing behavior change. Eighty-one targeted provider tests passed, src lint/typecheck passed, and the full Zoo-Code test suite passed.

Related PRs

@zoomote

zoomote Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

No code issues found. See task

  • src/api/providers/__tests__/lite-llm.spec.ts:1055 and src/api/providers/__tests__/lite-llm.spec.ts:1188 — The describe-scope const mockStream = asyncStreamFrom([...]) created a single-use AsyncGenerator shared across every test in the describe block. Fixed in 838d3fb: both describes now use a makeMockStream() factory called fresh inside each test's mockCreate.mockReturnValue(...).
  • src/api/providers/__tests__/zai.spec.ts:17collectStream was imported but never used. Fixed in 838d3fb: import reduced to asyncStreamFrom only.

Reviewed 838d3fb

@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@zoomote

zoomote Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both outstanding review findings.

  • LiteLLM describe-scoped mock streams are now fresh makeMockStream() factories called inside each test, so tests no longer share a single-use generator.
  • Removed the unused collectStream import from zai.spec.ts.
  • Commit: 838d3fba585ed84909df39794da2f4f5519b24a8
  • Validation: targeted LiteLLM + Z.ai specs, check-types, and lint passed before push; PR metadata refreshed.
  • Thread state: no inline review threads existed for these findings; the fixes are reflected in the updated PR body.

@edelauna
edelauna marked this pull request as ready for review August 1, 2026 21:00
@edelauna
edelauna enabled auto-merge August 1, 2026 21:01
@edelauna
edelauna added this pull request to the merge queue Aug 1, 2026
Merged via the queue into main with commit 992585f Aug 1, 2026
24 checks passed
@edelauna
edelauna deleted the refactor/lite-zai-stream-test-utils-06q4nypl2c73c branch August 1, 2026 21:20
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.

2 participants