Fix/watch folder#41
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
Walkthrough画像配信をトークンキャッシュで解決し、選択画像はトークン付きURLで公開します。フロントエンドはWails v2/v3の ChangesToken-based image serving
🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Pull request overview
このPRは、監視フォルダに画像を追加した際の「自動書き出し(auto export)」が動作しない問題(Issue #40)を修正し、バックグラウンド処理時でも正しい画像をプレビュー/保存できるようにする変更です。複数ファイルが並行処理される状況で currentImagePath 参照が競合しやすい点を、画像ごとのトークンURLで解消する意図が読み取れます。
Changes:
/api/imageにtokenを導入し、画像ごとに確実に同一ファイルを配信できるように変更process_fileイベントの payload 形状差(Wails v2/v3)を吸収するようフロント側の受信処理を更新- 画像トークンのキャッシュ(
imageTokens)を追加
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| handler.go | 画像配信エンドポイントにトークン解決を追加し、並行処理時の取り違えを防止 |
| app.go | 画像オープン時にトークン付きの ImageURL を生成してフロントへ返却 |
| frontend/src/App.tsx | process_file イベントの Wails v2/v3 差異を吸収して自動処理を継続可能に |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Optional: Limit size to prevent memory leaks if many images are opened | ||
| if len(h.imageTokens) >= 100 { | ||
| // Evict one pseudo-random entry to free space. | ||
| // (YAGNI: A full LRU is over-engineering for a simple 100-item desktop app cache) | ||
| for k := range h.imageTokens { | ||
| delete(h.imageTokens, k) | ||
| break | ||
| } | ||
| } |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@handler.go`:
- Around line 146-160: 現在の擬似ランダム削除は直近に登録したトークンを誤って退避し得るため、h.imageTokens を FIFO
で退避するよう変更してください: ハンドラ構造体に挿入順を保持するスライス(例: imageTokenOrder
[]string)を追加し、registerImageToken 内でトークン登録時にそのスライスへ append
し、容量超過時はスライスの先頭要素を取り出して
map(h.imageTokens)から削除してからスライスを前詰め(または先頭ポップ)して古い順に退避するよう実装し、handleImage
が参照するトークンが削られないようにしてください。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: fcc44988-af6c-497f-aeaa-cff8f903f679
📒 Files selected for processing (3)
app.gofrontend/src/App.tsxhandler.go
…agement in image token eviction
… comment in backend
自動書き出しが動作しない問題を修正
resolved #40