Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client)!: remove default event iterator retry behavior #267

Merged
merged 2 commits into from
Mar 19, 2025

Conversation

unnoq
Copy link
Owner

@unnoq unnoq commented Mar 19, 2025

Summary by CodeRabbit

  • Documentation

    • Updated event streaming documentation: the section has been renamed to "SSE Like Behavior" with streamlined guidance.
    • The documentation now points users to the Client Retry Plugin for automatic reconnection options.
    • Removed the "Connection Status" section and simplified the "Error Handling" explanation.
  • Refactor

    • Simplified event streaming by removing built-in automatic retry functionality.
    • This change streamlines the event processing flow for a more straightforward user experience.
  • Tests

    • Removed tests related to the event iterator functionality, reducing coverage in this area.

Copy link

vercel bot commented Mar 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
orpc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 19, 2025 9:49am

Copy link

coderabbitai bot commented Mar 19, 2025

Walkthrough

This pull request reorganizes the event iterator documentation and removes built-in auto-retry functionality from the client. The "Event Iterator Configuration" section is now renamed "SSE Like Behavior" with a simplified explanation that directs users to the separate Client Retry Plugin for automatic retries. In parallel, the StandardLink class and related functions in the event iterator modules have been streamlined by eliminating retry options and associated tests. Additionally, public exports and shared module exports have been updated to reflect these removals.

Changes

File(s) Change Summary
apps/content/docs/.../rpc-link.md Renamed "Event Iterator Configuration" to "SSE Like Behavior" and removed detailed retry customization options.
packages/client/src/adapters/standard/link.ts Removed eventIteratorMaxRetries, eventIteratorRetryDelay, and eventIteratorShouldRetry properties and corresponding fields, simplifying the retry mechanism in the StandardLink.
packages/client/src/event-iterator*.ts, packages/client/src/event-iterator-state*.ts, packages/client/src/event-iterator-state.test.ts, packages/client/src/event-iterator.test.ts Eliminated the auto-retry function (createAutoRetryEventIterator), associated state management, and related tests for event iterators.
packages/client/src/index.ts Removed the export of the event iterator state module, reducing the public API surface.
packages/shared/src/index.ts Updated the Radash export to remove the retry function from the shared module.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant SL as StandardLink
    participant EP as Event Processor

    C->>SL: Initiate RPC call for event stream
    SL->>EP: Fetch event stream (without auto-retry)
    Note over SL: Auto-retry logic removed<br/>Use ClientRetryPlugin if needed
    EP-->>SL: Return stream data
    SL-->>C: Provide event stream response
Loading

Possibly related PRs

  • feat!: update event-iterator options #199: The changes in the main PR are related to those in the retrieved PR as both involve the removal of retry-related options and the renaming of parameters associated with event iteration, specifically focusing on the same functionality within the RPCLink context.
  • feat!: update standard server #179: The changes in the main PR are related to the removal of retry logic for event iterators, which aligns with the modifications in the retrieved PR that also involve changes to event iterator handling, specifically the type-checking logic in the event-iterator.ts file.
  • docs: improve Event Iterator configs #255: The changes in the main PR involve the removal of retry-related properties and logic from the StandardLinkOptions interface and StandardLink class, while the retrieved PR focuses on enhancing documentation for those same properties, indicating a direct relationship at the code level.

Poem

I'm a rabbit hopping with glee,
Leaving old retry logic free.
No more tangled loops to mend,
A clearer path is now our friend.
Hop along and celebrate the change!
(✿◠‿◠)

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1024019 and 041ad5a.

📒 Files selected for processing (6)
  • apps/content/docs/client/event-iterator.md (1 hunks)
  • apps/content/docs/client/rpc-link.md (1 hunks)
  • apps/content/examples/openai-streaming.md (1 hunks)
  • packages/client/src/adapters/standard/link.test.ts (1 hunks)
  • packages/client/src/adapters/standard/link.ts (2 hunks)
  • packages/client/src/plugins/retry.test.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/client/src/plugins/retry.test.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/client/src/adapters/standard/link.test.ts
🧰 Additional context used
🧬 Code Definitions (1)
packages/client/src/adapters/standard/link.ts (3)
packages/standard-server/src/types.ts (2) (2)
  • StandardRequest (13-24)
  • StandardLazyResponse (48-59)
packages/client/src/plugins/base.ts (1) (1)
  • ClientPlugin (4-6)
packages/client/src/adapters/standard/types.ts (2) (2)
  • StandardLinkCodec (4-7)
  • StandardLinkClient (9-11)
🔇 Additional comments (7)
apps/content/docs/client/rpc-link.md (1)

93-95: Clearer SSE-Like Behavior Explanation

The updated documentation clarifies that the Event Iterator no longer retries automatically and now directs users to the external Client Retry Plugin. This accurately reflects the removal of default retry behavior.

apps/content/docs/client/event-iterator.md (1)

50-50: Explicit Non-Retry Behavior

Explicitly stating that the Event Iterator does not retry on error helps manage user expectations. The reference to the Client Retry Plugin is a clear path forward for those needing automatic retries.

apps/content/examples/openai-streaming.md (1)

36-42: Context-Based Retries Removed

Removing the ClientContext usage for disabling retries aligns with the overall removal of auto-retry behavior. The streamlined client instantiation is simpler and more maintainable.

packages/client/src/adapters/standard/link.ts (4)

1-1: Type Import Update

No issues with adjusting the import statement to reference the correct types. The change appears consistent with the new approach.


5-5: Shared Intercept Import

Importing intercept from @orpc/shared is valid and maintains consistency with the rest of the code.


23-23: Constructor Options Clean-up

Removing retry configuration fields from StandardLinkOptions streamlines the constructor. This matches the removal of built-in retry logic for event iterators.


37-37: Simplified Return Flow

The final return statement no longer performs retry checks, reflecting the removal of the auto-retry mechanism. No issues found.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

pkg-pr-new bot commented Mar 19, 2025

Open in Stackblitz

More templates

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@267

@orpc/client

npm i https://pkg.pr.new/@orpc/client@267

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@267

@orpc/openapi-client

npm i https://pkg.pr.new/@orpc/openapi-client@267

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@267

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@267

@orpc/server

npm i https://pkg.pr.new/@orpc/server@267

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@267

@orpc/solid-query

npm i https://pkg.pr.new/@orpc/solid-query@267

@orpc/standard-server

npm i https://pkg.pr.new/@orpc/standard-server@267

@orpc/standard-server-fetch

npm i https://pkg.pr.new/@orpc/standard-server-fetch@267

@orpc/standard-server-node

npm i https://pkg.pr.new/@orpc/standard-server-node@267

@orpc/svelte-query

npm i https://pkg.pr.new/@orpc/svelte-query@267

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@267

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@267

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@267

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@267

commit: 041ad5a

Copy link

codecov bot commented Mar 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@unnoq unnoq merged commit 28aa60a into main Mar 19, 2025
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.

1 participant