fix: unpin orphaned IPFS CIDs on failed folder registration#59
Conversation
…load When upload() succeeds but addFiles() fails, the pinned CIDs were never cleaned up, leaking storage quota. Now the catch block detects this case by hoisting uploadedFiles before the try block, and fires off unpin calls for each CID (fire-and-forget, consistent with existing delete pattern). Quota is refreshed after cleanup. Both UploadZone and EmptyState catch blocks updated identically. - Hoist uploadedFiles declaration for catch-block access - Fire-and-forget unpinFromIpfs for each orphaned CID - Refresh quota via useQuotaStore.getState().fetchQuota() - Move completed todo files to done/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughUpload components now track uploaded files and perform cleanup (unpin from IPFS and refresh quota) when an upload fails after files were pinned; a new test suite covers error-recovery and orphaned-pin cleanup behaviors. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
- Store transitions from registering to error when addFiles fails - Orphaned CIDs are unpinned when registration fails after upload - Quota is refreshed after cleanup - No cleanup on user cancellation - No cleanup when upload itself fails (only when registration fails) - Unpin failures are swallowed (fire-and-forget pattern) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2e1d237 to
1ad9f95
Compare
Summary
upload()succeeds butaddFiles()fails (e.g., duplicate filename, network error), the already-pinned CIDs are now cleaned up via fire-and-forget unpin callsUploadZoneandEmptyStatecomponentsdone/Test plan
addFilesfailure (e.g., disconnect network after upload completes) — verify CIDs are unpinned🤖 Generated with Claude Code
Summary by CodeRabbit