You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No actionable comments were generated in the recent review.
Walkthrough
The change adds reset-state-with, which emits a typed state-reset operation. It adds read-draft for draft decoding in two functions and updates stream chunk handling when a chunk has no text property.
Changes
Typed reset operation
Layer / File(s)
Summary
Typed reset operation calcit.cirru, README.md
GenCodeActions and its implementation add reset-state-with. The method emits a :states operation for the plugin cursor and initial state. Tests check the emitted operation, and the README documents the method and emitter.
Draft state decoding
Layer / File(s)
Summary
Shared draft decoder calcit.cirru
read-draft converts struct inputs to maps and decodes the result as GenCodeState. use-gen-code-with-dispatch and clear-interrupted-loading now use this helper.
Stream chunk handling
Layer / File(s)
Summary
Chunks without text calcit.cirru, tests/stream-contract.mjs
read-genai-chunk checks for a text property and uses an object with text: undefined when it is absent. The stream fixture now yields an empty object before its offline response.
This change unifies draft decoding, adds a typed reset operation while keeping the old one, and tolerates stream chunks with no text. No actionable merge-blocking risk is evident.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "统一 Gen Code 草稿的类型化解码" (Unify typed decoding of Gen Code drafts) matches the main change. The PR adds read-draft, which unifies the draft decoding used when opening drafts and when restoring…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check
Explanation
The title "统一 Gen Code 草稿的类型化解码" (Unify typed decoding of Gen Code drafts) matches the main change. The PR adds read-draft, which unifies the draft decoding used when opening drafts and when restoring interrupted requests, and returns GenCodeState. The title does not mention the secondary reset-state-with addition, which is acceptable because the title need not cover every detail.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 98678572-b8f7-4409-9ae9-ea327f92d022
Commits
Reviewing files that changed from the base of the PR and between 4275bf4 and 8e871db.
Files selected for processing: 2
calcit.cirru
tests/stream-contract.mjs
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
用户影响
插件打开草稿和启动时恢复中断请求,都沿用原先接受的 Map 与 Struct 格式。缺少草稿时仍使用初始状态。
改动与验证
将两个入口重复的草稿校验合为
read-draft,返回GenCodeState。原始值在解码入口收敛,渲染和恢复逻辑共用同一个类型合同。Calcit 0.42.1 的 248 个定义、完整 strict、7 项原生测试、离线流式回归和 Node 24 构建均通过。
Summary by CodeRabbit
类型化重置
类型化宿主可用
(.reset-state-with plugin emit!)接收具名 GenCodeOp,旧宿主继续用原有重置方法。Calcit 0.42.1 全定义 248/248、8 项原生测试和完整 strict 已通过。流式响应
没有文本字段的流片段仍会跳过,后续文本继续累积。文本读取现在使用受检的 JS 宿主转换,并在现有离线用例覆盖缺失字段场景。全定义检查、完整 strict、8 项原生测试以及离线流式回归通过。