fix(web): register folder in SDK folderTree before file edit and version writes#496
Conversation
…ion writes PR #494 re-routed the owner file-edit save and the version restore/delete paths through new CipherBoxClient methods (replaceFile, restoreFileVersion, deleteFileVersion). Each gates on folderTree.get(parentIpnsName) and throws 'Folder not loaded' when the folder is absent. The web app populates the SDK folderTree only via ensureFolderRegistered, which was called from upload/mutation hooks but NOT from these three call sites. Folder navigation and read populate only the Zustand store, so after a client re-creation (e.g. page reload) with no intervening mutation, the folder is missing from folderTree and the save/version op throws synchronously. The rejection leaves the text-editor modal open, surfacing as the writable-shares 4.3 web-e2e timeout. Add ensureFolderRegistered(parentFolder) before each client call, mirroring useFolderMutations and useDropUpload. No-op when the folder is already tracked. Web E2E does not run on PRs, so this regression first appeared on the push to main after #494 merged. Entire-Checkpoint: cc18c18d2c58
…IPNS key Entire-Checkpoint: 0c73b7403ca0
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
Walkthrough
ChangesFolderTree Pre-registration in Web Hooks
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Release Preview
|
Summary
Fixes a regression from #494 (phase 47 SDK folder-state/publish consolidation) that broke the Web E2E suite on
main.#494 re-routed the owner file-edit save and the file-version restore/delete paths through new stateful
CipherBoxClientmethods (replaceFile,restoreFileVersion,deleteFileVersion). Each gates on the in-memoryfolderTree:The web app seeds
folderTreeonly viaensureFolderRegistered(called from the upload/mutation hooks). #494 added the new client calls touseFileOperations/useFileVersionsbut dropped theensureFolderRegisteredseeding there. Navigation/read populate only the Zustand store, neverfolderTree— so after a client re-creation (e.g. page reload) with no intervening mutation, the folder is absent and the save/version op throws synchronously. In the editor the rejected save leaves the modal open, which surfaced as the 30s timeout atwritable-shares.spec.ts:330(4.3 Alice edits Bob's file).Because Web E2E does not run on PRs (only on push to
main), the regression wasn't caught until #494 merged.Changes
Add
ensureFolderRegistered(parentFolder)before the client call at the three missed sites, mirroringuseFolderMutations/useDropUpload. No-op when the folder is already tracked.Key files:
apps/web/src/hooks/useFileOperations.ts— owner edit-save path (the one the E2E hit)apps/web/src/hooks/useFileVersions.ts—restoreVersion+deleteVersionpaths (same latent throw)Verification
writable-shares 4.3+ full suite passed; previously the only failure onmain).tsc --noEmit(apps/web) andeslinton both changed files pass.Confirmed deterministic, not a flake: parent commit
0c2422c8cpassed Web E2E twice; #494's commitd17d42e5ffailed it; the only diff between them is #494.Key Decisions
ensureFolderRegisteredcalls — rather than a broader refactor.permanentDelete/emptyBin);shareFolder/revokeSharehave no web callers.Follow-up
The audit surfaced one pre-existing gap (since #296, not this regression): recycle-bin restore (
useBin.ts) hits the same'Folder not loaded'throw after a reload. Its root cause is architectural — the SDK client config lacks the root IPNS private key, so it can't self-bootstrap or lazy-loadfolderTree, which is why theensureFolderRegisteredworkaround exists at all. Captured as a todo for a proper fix (rootIpnsKeypairin config + internalensureFolderLoadedlazy walk).🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Chores