feat: harvest the v1 vault browser read path over the snapshot adapter - #971
Conversation
|
Warning Review limit reached
Next review available in: 37 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (40)
WalkthroughThe PR restores the authenticated vault browser read path. It adds snapshot folder names, route-driven navigation, file listings, breadcrumbs, application shell components, responsive styling, and authentication route handling. ChangesVault browser read path
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant FilesPage
participant useFolderNavigation
participant SnapshotStore
participant FileBrowser
User->>FilesPage: open /files
FilesPage->>useFolderNavigation: load route state
useFolderNavigation->>SnapshotStore: set folder focus
SnapshotStore-->>useFolderNavigation: return snapshot
useFolderNavigation->>FileBrowser: provide rows and breadcrumbs
FileBrowser-->>User: render vault contents
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
Actionable comments posted: 4
🤖 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 `@apps/web/src/components/file-browser/FileBrowser.tsx`:
- Around line 26-34: Update the EmptyState rendering condition in FileBrowser so
it only renders when the current folder is root and rows.length is zero.
Preserve the existing FileList behavior for empty non-root folders, including
the parent navigation row.
In `@apps/web/src/components/file-browser/FileListItem.tsx`:
- Around line 24-28: Update the onKeyDown handler in FileListItem to invoke
open() for both Enter and Space keys, while preserving preventDefault and
ignoring other keys, matching ParentDirRow’s keyboard activation behavior.
In `@apps/web/src/components/layout/UserMenu.tsx`:
- Around line 11-38: Move the Escape key handling from the user-menu-trigger
button to the outer user-menu container so Escape closes the menu when focus is
on LogoutButton or another descendant. Add outside-interaction handling while
isOpen, such as a document-level click or focusout listener, to close the menu
for interactions outside the container, including touch input; preserve the
existing hover and toggle behavior.
In `@apps/web/src/vault/listing.ts`:
- Around line 56-58: Update projected to avoid converting bigint descriptor
values with Number; use bigint-aware formatting for size and mtime, and guard
mtime against the safe Date range before formatting. Preserve UNRESOLVED for
null values and ensure oversized timestamps render safely rather than losing
precision or producing an invalid date.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7dfb3b6d-d15a-4160-905a-5d2b621bbabe
📒 Files selected for processing (39)
apps/web/src/App.test.tsxapps/web/src/components/file-browser/Breadcrumbs.tsxapps/web/src/components/file-browser/EmptyState.tsxapps/web/src/components/file-browser/FileBrowser.tsxapps/web/src/components/file-browser/FileList.tsxapps/web/src/components/file-browser/FileListItem.tsxapps/web/src/components/file-browser/ParentDirRow.tsxapps/web/src/components/layout/AppFooter.tsxapps/web/src/components/layout/AppHeader.tsxapps/web/src/components/layout/AppShell.tsxapps/web/src/components/layout/AppSidebar.tsxapps/web/src/components/layout/NavItem.tsxapps/web/src/components/layout/StatusIndicator.tsxapps/web/src/components/layout/UserMenu.tsxapps/web/src/engine/snapshotStore.tsapps/web/src/engine/testFakes.tsapps/web/src/lib/nodeId.test.tsapps/web/src/lib/nodeId.tsapps/web/src/main.tsxapps/web/src/routes/FilesPage.tsxapps/web/src/styles/breadcrumbs.cssapps/web/src/styles/file-browser.cssapps/web/src/styles/layout.cssapps/web/src/styles/responsive.cssapps/web/src/utils/format.tsapps/web/src/vault/listing.test.tsapps/web/src/vault/listing.tsapps/web/src/vault/useFolderNavigation.test.tsxapps/web/src/vault/useFolderNavigation.tscrates/engine/src/facade.rscrates/wasm/src/lib.rscrates/wasm/tests/boundary.rspackages/client/src/broadcastTransport.test.tspackages/client/src/index.tspackages/client/src/testkit.tspackages/client/src/worker/commandCodec.test.tspackages/client/src/worker/commandCodec.tspackages/client/src/worker/engineWasm.tspackages/client/src/worker/protocol.ts
…dapter Brings back the v1 vault browser — app shell, breadcrumbs, folder listing, navigation — sourced entirely from the engine's snapshot adapter. `useFolderNavigation` reads the snapshot store, keys on the routed node id, and moves the engine's focus window on every navigation. A view is only listed once its `folder` matches the route, so a pull for the folder just left cannot paint under the new one. Listings hydrate progressively: name and kind render from the child ref, size and mtime fill in when the projection lands. Breadcrumbs walk the ancestor trail the snapshot carries. That trail starts at the folder's parent, so `SnapshotView` now also carries the listed folder's own name — a host cannot recover it from `ancestors` and must not cache a name across a navigation. The sidebar keeps /files live and renders /shared, /bin and /settings inert with a coming-soon affordance for #643. Closes #805
e770ba2 to
32d521a
Compare
The engine's mtime is a u64, but JS `Date` tops out at 8.64e15 ms. Past that `Intl.DateTimeFormat` throws `RangeError: Invalid time value`, so a single child ref authored elsewhere blanked the whole listing. Render those as `-`. Also activate a file row on Space, matching the `[..]` row beside it, and move the user menu's Escape handler onto the container so it still closes once focus moves into the dropdown.
Brings back the v1 vault browser — app shell, breadcrumbs, folder listing, navigation — sourced entirely from the engine's snapshot adapter.
Closes #805
What lands
useFolderNavigationreads the snapshot store, keys on the routed node id, and callssetFocuson every navigation. A view is only listed once itsfoldermatches the route, so a pull for the folder just left cannot paint under the new one.SnapshotView. No materialised tree anywhere — folder reads stay direct-children-only per feat(engine): wire the facade cold-start pipeline and live resolve-tick driver #789.AppSidebarkeeps/fileslive and renders/shared,/bin,/settingsinert with a coming-soon affordance for web: ship sharing, bin, settings, and invite views over the facade #643.pendinganddeadLetterflags render as compact row markers, and the staleness rung renders in the footer.Harvested from
v1, rewrittenStructure and CSS come from
v1; the data path is new.components/layout/{AppShell,AppHeader,AppFooter,AppSidebar,NavItem,UserMenu,StatusIndicator}.tsx— markup and class names kept, all v1 hooks (search palette, MFA prompts, device approval, storage quota) dropped.components/file-browser/{FileBrowser,FileList,FileListItem,Breadcrumbs,ParentDirRow,EmptyState}.tsx— read-only: no selection, no drag-drop, no context menu, no upload dropzone.styles/{layout,file-browser,breadcrumbs,responsive}.css— pruned to the class set this slice renders, on the v2 tokens inindex.css.utils/format.ts—formatBytesandformatDateonly.Deliberate scope note
SnapshotViewgained one field,folderName. The ancestor trail starts at the folder's parent, so the listed folder's own name is not recoverable from the snapshot, and a host must not cache a name across a navigation or a bookmarked deep link. Without it the last breadcrumb is nameless and the browser cannot say where you are. The change is one field acrosscrates/engine,crates/wasm, and the client protocol, with the wasm boundary test extended to assert it crosses asfolderName.Verification
Gates run locally, all green:
pnpm -r typecheck,pnpm -r test(380 tests),eslint .,cargo fmt --all --check,cargo check --workspace --all-targets,cargo test -p cipherbox-engine -p cipherbox-wasm.Puppeteer against the dev server confirms the shell grid, the sidebar's live/inert split, and the harvested CSS at desktop and mobile widths. A signed-in list render needs a live vault, which #809's login-and-CRUD e2e smoke covers.
Summary by CodeRabbit
New Features
Bug Fixes