Skip to content

fix(annotation): narrow retry load message fields - #32

Merged
AliceJump merged 1 commit into
mainfrom
fix/annotation-retry-load-narrowing
Oct 5, 2026
Merged

AliceJump merged 1 commit into
mainfrom
fix/annotation-retry-load-narrowing

Conversation

@AliceJump

@AliceJump AliceJump commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fix the post-merge TypeScript compile regression in AnnotationController by explicitly validating retryLoad message fields before passing imagePath to loadImage.

Cause

msg.imagePath is typed as string | undefined. Comparing it with _currentImage did not narrow it to string, so tsc failed on main with TS2345.

Validation

  • Diff is limited to the retryLoad branch in src/annotationPanel.ts.
  • Expected CI check: npm test / TypeScript compile should pass past the previous src/annotationPanel.ts(489,98) failure.

Summary by CodeRabbit

  • 问题修复
    • 修复重试加载时的校验:只有在图像和模式信息均有效且与当前内容匹配时,才会重新加载。

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f7ba83da-ca69-46de-a521-497dbcb65be6
📥 Commits

Reviewing files that changed from the base of the PR and between 8377c6b and 8738afc.

📒 Files selected for processing (1)
  • src/annotationPanel.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

retryLoad 现在会先检查 imagePath 和 mode 是否为真值,再检查它们是否匹配当前图像和模式。条件满足时,代码调用 loadImage。

Changes

重试加载

Layer / File(s) Summary
重试加载条件
src/annotationPanel.ts
retryLoad 分支增加 imagePath 和 mode 的真值检查。通过检查后,仍需匹配当前图像和模式,才会调用 loadImage。

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 8738a

当前上下文未显示这项重试资格收紧会破坏有效加载流程,未发现需要阻止合并的具体风险;可按常规检查合并。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要变更:收紧 annotation 重试加载消息的字段检查。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@AliceJump
AliceJump merged commit 8c648de into main Oct 5, 2026
5 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