fix:Add update function registration for createStream for node sdk#1405
fix:Add update function registration for createStream for node sdk#1405fanlia wants to merge 1 commit intoiii-hq:mainfrom
Conversation
add missing update binding
|
@fanlia is attempting to deploy a commit to the motia Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
sdk/packages/node/iii/src/iii.ts (2)
573-575:⚠️ Potential issue | 🟡 Minor
createStreamJSDoc is now stale and contradicts runtime behavior.Line 598 registers
stream::update(...), but this doc block still saysupdateis not registered. Please update the method description to avoid misleading implementers.Suggested doc fix
- * Registers 5 of the 6 `IStream` methods (`get`, `set`, `delete`, `list`, - * `listGroups`). The `update` method is not registered -- atomic updates are - * handled by the engine's built-in stream update logic. + * Registers all `IStream` methods (`get`, `set`, `delete`, `list`, + * `listGroups`, `update`) for the provided stream name.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@sdk/packages/node/iii/src/iii.ts` around lines 573 - 575, Update the stale JSDoc for createStream to reflect the actual runtime behavior: note that all 6 IStream methods including stream::update are registered (instead of claiming update is not registered); locate the createStream JSDoc block near the createStream function and replace the sentence that says "The `update` method is not registered -- atomic updates are handled by the engine's built-in stream update logic." with a statement that `update` is registered (e.g., "Registers all 6 IStream methods (`get`, `set`, `delete`, `list`, `listGroups`, and `update`)") and optionally add a brief note about how stream::update is handled at runtime if needed for clarity.
592-599:⚠️ Potential issue | 🟠 MajorAdd the same
stream::updateregistration iniii-browserto preserve SDK parity.This Node SDK update is correct, but
sdk/packages/node/iii-browser/src/iii.tsstill registers only get/set/delete/list/list_groups. That creates a cross-SDK capability mismatch forIStream.update.As per coding guidelines: "Ensure the sdks are ergonomic and idiomatic within each language sdk while balancing being symmetric and consistent between language sdks." and "Check for related inconsistencies with the other language sdks in sdk/".Suggested parity patch (iii-browser)
createStream = <TData>(streamName: string, stream: IStream<TData>): void => { this.registerFunction(`stream::get(${streamName})`, stream.get.bind(stream)) this.registerFunction(`stream::set(${streamName})`, stream.set.bind(stream)) this.registerFunction(`stream::delete(${streamName})`, stream.delete.bind(stream)) this.registerFunction(`stream::list(${streamName})`, stream.list.bind(stream)) this.registerFunction(`stream::list_groups(${streamName})`, stream.listGroups.bind(stream)) + this.registerFunction(`stream::update(${streamName})`, stream.update.bind(stream)) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@sdk/packages/node/iii/src/iii.ts` around lines 592 - 599, The browser SDK's createStream implementation is missing the registration for the update operation, causing a capability mismatch for IStream.update; add the same registration as in the Node SDK by calling this.registerFunction(`stream::update(${streamName})`, stream.update.bind(stream)) inside the createStream<TData>(streamName: string, stream: IStream<TData>) function so get/set/delete/list/list_groups/update are all registered and the APIs remain symmetric.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@sdk/packages/node/iii/src/iii.ts`:
- Around line 573-575: Update the stale JSDoc for createStream to reflect the
actual runtime behavior: note that all 6 IStream methods including
stream::update are registered (instead of claiming update is not registered);
locate the createStream JSDoc block near the createStream function and replace
the sentence that says "The `update` method is not registered -- atomic updates
are handled by the engine's built-in stream update logic." with a statement that
`update` is registered (e.g., "Registers all 6 IStream methods (`get`, `set`,
`delete`, `list`, `listGroups`, and `update`)") and optionally add a brief note
about how stream::update is handled at runtime if needed for clarity.
- Around line 592-599: The browser SDK's createStream implementation is missing
the registration for the update operation, causing a capability mismatch for
IStream.update; add the same registration as in the Node SDK by calling
this.registerFunction(`stream::update(${streamName})`,
stream.update.bind(stream)) inside the createStream<TData>(streamName: string,
stream: IStream<TData>) function so get/set/delete/list/list_groups/update are
all registered and the APIs remain symmetric.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2dc4c07b-bccf-4cde-b667-cd50afde0fe3
📒 Files selected for processing (1)
sdk/packages/node/iii/src/iii.ts
add missing update binding
Summary by CodeRabbit