Skip to content

fix(request): propagate download stream errors#66

Open
HoikanChan wants to merge 1 commit into
openInula:masterfrom
HoikanChan:fix/reuqest-stream
Open

fix(request): propagate download stream errors#66
HoikanChan wants to merge 1 commit into
openInula:masterfrom
HoikanChan:fix/reuqest-stream

Conversation

@HoikanChan

@HoikanChan HoikanChan commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • propagate source download stream read errors to the wrapped progress stream
  • return null bodies unchanged so 204/HEAD responses do not hang when download progress is enabled
  • cancel the source reader when the wrapped progress stream is canceled

Tests

  • pnpm -F inula-request test -- --runInBand

Closes #65

Summary by CodeRabbit

  • New Features

    • Established CI/CD pipeline with automated testing and release workflows.
    • Configured monorepo build system for improved development experience.
  • Bug Fixes

    • Enhanced download progress handling with better error management and cancellation support.
  • Tests

    • Added comprehensive test coverage for download progress scenarios.
  • Chores

    • Version bumped to 0.1.3.
    • Updated package metadata across workspace packages.

Review Change Stack

@changeset-bot

changeset-bot Bot commented May 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b02ce0a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@HoikanChan, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 1 review/hour. Refill in 53 minutes and 8 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: de63f743-89c0-4162-9e3c-c850cbb90b80

📥 Commits

Reviewing files that changed from the base of the PR and between 3e17f33 and b02ce0a.

📒 Files selected for processing (2)
  • packages/inula-request/src/request/processDownloadProgress.ts
  • packages/inula-request/tests/unitTest/request/processDownloadProgress.test.ts
📝 Walkthrough

Walkthrough

This PR establishes release automation via Changesets and GitHub Actions, introduces Turbo for monorepo build orchestration, fixes blob download error handling when network interrupts mid-progress, standardizes repository metadata across packages, bumps the core version to 0.1.3, and temporarily skips two portal-event tests.

Changes

Release automation, build orchestration, and download progress fix

Layer / File(s) Summary
Release and CI automation infrastructure
.changeset/README.md, .changeset/config.json, .changeset/wet-shrimps-move.md, .github/workflows/test.yml, .github/workflows/ci.yml, .github/workflows/release.yml, .gitignore
Changesets configuration and reusable GitHub Actions workflows enable commit linting, unit testing, continuous package publishing on branch pushes, and automated versioning/release via Changesets on master. Build artifacts (.turbo, coverage) are now ignored.
Monorepo build orchestration with Turbo
turbo.json, package.json, pnpm-workspace.yaml
Turbo pipeline defines build, test, and typecheck tasks with dependency chaining (^build, ^test, ^typecheck) and output caching. Root package.json pins pnpm@10.4.1 and adds workspace-level scripts delegating to Turbo. inula-dev-tools is excluded from the workspace.
Download progress handler stream error handling
packages/inula-request/src/request/processDownloadProgress.ts, packages/inula-request/tests/unitTest/request/processDownloadProgress.test.ts
Stream reader is rewritten to guarantee valid reader instance, add early return for null streams, introduce a canceled flag suppressing updates after cancellation, implement stream cancel(reason) handling, and route errors via controller.error() only when not canceled. Tests validate error forwarding, null header handling, progress accumulation, stream abort scenarios, and fetch cancellation flows.
Package metadata standardization and version bump
packages/inula/package.json, packages/inula/src/index.ts, packages/create-inula/package.json, packages/inula-cli/package.json, packages/inula-dev-tools/package.json, packages/inula-intl/package.json, packages/inula-request/package.json, packages/inula-router/package.json, packages/inula/tests/EventTest/MouseEnterEvent.test.js
openinula version bumped to 0.1.3 with updated repository metadata across all packages. InulaReconciler is explicitly exported from main index. React dev dependencies in inula-intl stabilized to 18.2.0. Two portal-event mouse tests skipped pending investigation.

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant GitHub
  participant commitlint
  participant test
  participant release as Changesets Release
  Developer->>GitHub: Push to master
  GitHub->>commitlint: Run commitlint action
  commitlint-->>GitHub: Validate commits
  GitHub->>test: Run test.yml workflow
  test-->>GitHub: Execute unit tests
  GitHub->>release: Run changesets/action
  release->>release: Version packages
  release->>GitHub: Create release PR or publish
Loading
sequenceDiagram
  participant Client
  participant processDownloadProgress
  participant ReadableStream as Source Stream
  participant ProgressStream as Progress Stream
  Client->>processDownloadProgress: onProgress callback
  processDownloadProgress->>ReadableStream: getReader()
  loop Progress Loop
    ReadableStream->>ProgressStream: read chunk
    ProgressStream->>Client: enqueue chunk
    ProgressStream->>processDownloadProgress: call onProgress callback
  end
  alt Stream Cancels
    Client->>ProgressStream: cancel(reason)
    ProgressStream->>ReadableStream: reader.cancel()
    ReadableStream-->>ProgressStream: suppressed further reads
  else Stream Errors
    ReadableStream->>ProgressStream: error event
    ProgressStream->>Client: controller.error(error)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • openInula/inula#23: Modifies .github/workflows/release.yml to use secrets.BOT_GITHUB_TOKEN instead of secrets.GITHUB_TOKEN in the Changesets publish step, directly overlapping with this PR's release workflow setup.
  • openInula/inula#34: Modifies packages/inula/package.json version for the openinula package and adds changelog entries, directly related to this PR's version bump to 0.1.3.
  • openInula/inula#21: Further extends turbo.json by adding workspace-specific build task dependencies after this PR establishes the baseline Turbo pipeline configuration.

Poem

🐰 Releases now flow with Turbo's great might,
Changesets guide versions through the night,
Download streams handle the stormy weather,
Packages dance in repos together!
One hop forward to 0.1.3—hooray! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Some changes appear out-of-scope: Changesets configuration, GitHub Actions workflows, turbo.json, and non-request package.json updates are not required by issue #65 and may represent repository-wide changes unrelated to the download stream error fix. Consider isolating repository-wide changes (Changesets, CI/CD workflows, turbo configuration, workspace updates) into separate PRs to keep the download error fix focused and reviewable.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: fixing error propagation in the download stream, which directly addresses the linked issue about blob downloads not rejecting on network interruption.
Linked Issues check ✅ Passed The PR addresses all coding requirements from issue #65: propagates source stream errors to wrapped progress stream, handles null bodies for 204/HEAD responses, and cancels source reader on progress stream cancellation.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@HoikanChan HoikanChan force-pushed the fix/reuqest-stream branch from b8d36f0 to b02ce0a Compare May 23, 2026 07:27
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.

bug(inula-request): blob 下载开始后断网未进入 catch 导致弹框卡住

1 participant