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
Draft decoding now accepts both nominal state values and legacy map-shaped state data, while continuing to reject malformed inputs.
Drafts represented as nominal structs are now validated before decoding. This improves compatibility across supported draft formats and helps prevent invalid state data from being accepted.
No actionable comments were generated in the recent review.
Walkthrough
Draft decoding now handles nominal GenCodeState values and legacy map-shaped values. initialize-chat! uses js-cast to convert the Gemini client to its host type.
Changes
Draft decoding
Layer / File(s)
Summary
Draft state decoding calcit.cirru
:states operation decoding and read-draft assert nominal GenCodeState values and continue to decode other inputs as maps. Tests cover nominal values, legacy maps, and an invalid numeric :query payload.
Gemini client cast
Layer / File(s)
Summary
Client initialization cast calcit.cirru
initialize-chat! uses js-cast instead of unsafe-coerce to convert the Gemini client to its host type.
This change lets validated Gen Code drafts keep their named type while older map-shaped drafts still decode as before. No concrete merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "直接保留已验证的 Gen Code 草稿类型" (keep verified Gen Code draft types directly) matches the main change. The PR keeps nominal GenCodeState values for :states operations and returns them directly when…
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.
Full details: Title check
Explanation
The title "直接保留已验证的 Gen Code 草稿类型" (keep verified Gen Code draft types directly) matches the main change. The PR keeps nominal GenCodeState values for :states operations and returns them directly when the nominal record identity matches. The raw summary also covers the decode-gen-code-op and read-draft changes that support this. The title does not mention the js-cast change for the Gemini client, but the PR objectives list that as a secondary commit note, so the title is still a fair summary of the primary change.
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: f21a9cdd-3c69-4526-8457-05b44301cc64
Commits
Reviewing files that changed from the base of the PR and between e5900e9 and 44c242f.
Files selected for processing: 1
calcit.cirru
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 和现有存档继续按原格式读取。已经是本库 GenCodeState 的草稿可以直接用于渲染和恢复。
改动与风险
草稿读取先核对具名记录的身份,匹配时直接返回。旧 Map 和其他 Struct 沿用字段解码,保留原校验。原 8 项测试、全定义检查、strict、离线 stream 回归和构建已通过。
:states事件也会直接保留已验证的具名草稿。新增回归确认兼容的 Map 仍保持原载荷,错误字段仍被拒绝。最新版本通过 9 项测试、全定义检查、strict 和离线流式回归。SDK 实例在 JavaScript 宿主边界使用
js-cast绑定已有 trait,质量检查中的unsafe-coerce计数降至 0。离线回归覆盖流式响应和派发,实际 SDK 请求未纳入本次验证。Summary by CodeRabbit