Skip to content

fix: Uint8Array type error, update tests for flux-fast.schnell v2 - #27

Merged
montyanderson merged 1 commit into
masterfrom
fix/uint8array-type-error
Feb 26, 2026
Merged

montyanderson merged 1 commit into
masterfrom
fix/uint8array-type-error

Conversation

@montyanderson

@montyanderson montyanderson commented Feb 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Fix TS2322 type error when passing Uint8Array to Blob constructor in TypeScript 5.x (cast to BlobPart)
  • Update tests and example from deprecated inference.flux.schnell.txt2img.v1 to inference.flux-fast.schnell.txt2img.v2
  • Remove width/height from test configs (not supported by flux-fast)
  • Update no-type error test to expect ProdiaBadResponseError (API behavior change)

Test plan

  • deno check v2/index.ts passes
  • deno fmt --check passes
  • deno test passes (all 6 tests)
  • node example.mjs passes on Node 18, 20, 22

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Feb 26, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between daee559 and 344c677.

📒 Files selected for processing (4)
  • example.mjs
  • test/v2.errors.test.ts
  • test/v2.examples.test.ts
  • v2/index.ts

Walkthrough

Updates job type strings to "inference.flux-fast.schnell.txt2img.v2", removes explicit width/height from job configs, adjusts tests (error expectations and test scaffolding), disables resource sanitization for some tests, and refactors Blob construction for Uint8Array input without changing public APIs.

Changes

Cohort / File(s) Summary
Example & example tests
example.mjs, test/v2.examples.test.ts
Replaced job type with "inference.flux-fast.schnell.txt2img.v2"; removed explicit width/height fields from job payloads; added sanitizeResources: false to three Deno tests.
Error tests
test/v2.errors.test.ts
Updated job type to v2; refactored test layout to await-based structure; changed expected error assertions from ProdiaCapacityError to ProdiaBadResponseError and adjusted message checks.
Form data / input handling
v2/index.ts
Changed Uint8Array handling to construct Blob directly via new Blob([input as BlobPart], { type: "image/jpeg" }) instead of slicing ArrayBuffer.

Suggested reviewers

  • stefanbenten

Poem

🐰 The Flux hops swift, now v2 and bright,
Prompts stay simple, no sizes in sight,
JPEG blobs snug in a new little mound,
Tests learn new errors and snugly resound,
I nibble the changes — code fresh and light!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main changes: fixing a Uint8Array type error and updating tests for the new flux-fast.schnell v2 API.
Description check ✅ Passed The description clearly explains the changes made, including the TypeScript type fix, API endpoint updates, configuration removals, and error handling adjustments, with a comprehensive test plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/uint8array-type-error

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@montyanderson
montyanderson force-pushed the fix/uint8array-type-error branch from 6f45c4c to daee559 Compare February 26, 2026 11:33
@montyanderson montyanderson changed the title v2: fix Uint8Array type error with TypeScript 5.x fix: Uint8Array type error, update tests for flux-fast.schnell v2 Feb 26, 2026
@montyanderson
montyanderson marked this pull request as ready for review February 26, 2026 11:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/v2.errors.test.ts (1)

1-7: Remove the unused ProdiaCapacityError import.

ProdiaCapacityError is imported on line 5 but is never used in this test file.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/v2.errors.test.ts` around lines 1 - 7, The import list in the test
currently includes an unused symbol ProdiaCapacityError; remove
ProdiaCapacityError from the named imports in the top-level import (the line
importing createProdia, ProdiaBadResponseError, ProdiaCapacityError,
ProdiaUserError) so only used symbols remain (createProdia,
ProdiaBadResponseError, ProdiaUserError), or alternatively reference
ProdiaCapacityError in a test if it should be exercised—update the import to
match actual usage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/v2.errors.test.ts`:
- Around line 1-7: The import list in the test currently includes an unused
symbol ProdiaCapacityError; remove ProdiaCapacityError from the named imports in
the top-level import (the line importing createProdia, ProdiaBadResponseError,
ProdiaCapacityError, ProdiaUserError) so only used symbols remain (createProdia,
ProdiaBadResponseError, ProdiaUserError), or alternatively reference
ProdiaCapacityError in a test if it should be exercised—update the import to
match actual usage.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 715235a and daee559.

📒 Files selected for processing (4)
  • example.mjs
  • test/v2.errors.test.ts
  • test/v2.examples.test.ts
  • v2/index.ts

@montyanderson
montyanderson marked this pull request as draft February 26, 2026 11:38
- Cast Uint8Array to BlobPart to fix TS2322 with TypeScript 5.x
- Update tests and example from deprecated flux.schnell v1 to
  flux-fast.schnell v2
- Remove width/height config (not supported by flux-fast)
- Update no-type error test to expect ProdiaBadResponseError
- Add sanitizeResources: false to example tests to prevent
  flaky Deno resource leak detection on fetch responses

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@montyanderson
montyanderson force-pushed the fix/uint8array-type-error branch from daee559 to 344c677 Compare February 26, 2026 11:38
@montyanderson
montyanderson marked this pull request as ready for review February 26, 2026 11:39
@montyanderson
montyanderson merged commit f9ec3d8 into master Feb 26, 2026
8 checks passed
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