Small explorer tweaks and fixes#24
Conversation
`dir/dir/file` syntax
when opening Redox with no arguments
in multiple directories and write them all at once
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 26 minutes and 56 seconds. ⌛ 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. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (32)
📝 WalkthroughWalkthroughExplorer state now manages per-directory drafts that persist across navigation, with each draft tracking original entries and edited text. Deletion confirmation and write operations were rewritten to handle multiple directories simultaneously, building aggregated change results. Entry parsing now supports nested relative paths with improved validation, and filesystem operations were extended accordingly. Cursor handling for the explorer popup was refactored to return cursor specifications rather than requesting them directly. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant EditorState as EditorState
participant ExplorerState as ExplorerState<br/>(Drafts)
participant FileSystem as FileSystem
participant BufferSync as BufferSync
User->>EditorState: Navigate to directory
EditorState->>ExplorerState: Save current directory draft
EditorState->>ExplorerState: Load target directory draft
User->>EditorState: Edit explorer entries
EditorState->>ExplorerState: Update draft text
User->>EditorState: Press 'w' to write
EditorState->>ExplorerState: Iterate all directory drafts
loop For each directory draft
ExplorerState->>ExplorerState: Parse draft text to entries
ExplorerState->>ExplorerState: Compute deletes/renames/creates
ExplorerState->>FileSystem: Apply filesystem changes
FileSystem->>ExplorerState: Return operation results
ExplorerState->>ExplorerState: Aggregate into AppliedExplorerChanges
end
ExplorerState->>BufferSync: Sync renamed/deleted/created file buffers
ExplorerState->>EditorState: Update status with aggregated changes
EditorState->>User: Display detailed change summary
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 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 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: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/redox-tui/src/app/state/explorer.rs (1)
777-782:⚠️ Potential issue | 🟠 MajorReject nested path prefix conflicts before applying changes.
The duplicate-name check allows incompatible entries such as
fooandfoo/bar.txt, or deletingfoo/while creatingfoo/bar.txt. The later delete/create loops can partially mutate the tree or produce contradictory summaries. Validate normalized path components up front so file entries cannot be ancestors of other entries, and creations under deleted directories are rejected unless that directory remains.Also applies to: 879-897
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/redox-tui/src/app/state/explorer.rs`:
- Around line 483-506: The current loop applies drafts immediately which can
cause parent renames/deletes to invalidate cached child drafts and leave partial
filesystem changes; instead, implement a two-phase plan: first iterate
explorer.directory_drafts and desired_entries_by_dir to produce a write plan
(collecting per-dir results from apply_explorer_changes for each draft path)
while detecting renamed or deleted ancestors and remapping or dropping any child
drafts under those ancestors, storing results into an
AppliedExplorerChanges-like structure without mutating the FS; then execute the
concrete filesystem mutations and call sync_session_after_explorer_write using
that resolved plan. Use the existing symbols (explorer.directory_drafts,
apply_explorer_changes, AppliedExplorerChanges,
explorer_delete_confirmation_token, sync_session_after_explorer_write) to locate
code, ensure errors during the planning phase still clear
explorer_delete_confirmation_token and report status but do not apply partial
writes, and only perform actual writes once the plan is finalized.
- Around line 970-985: The confirmation list currently flattens per-directory
targets causing ambiguous duplicate names; update
format_explorer_delete_confirmation to include the directory context (prefix
each target with the dir_path or group targets under their dir_path) when
building targets by using explorer_delete_confirmation_targets(dir_path,
deletions) or by mapping its results to format "{dir_path}/{target}" so entries
are unambiguous, keep the noun/count logic unchanged, and apply the same fix to
the other similar confirmation formatter mentioned in the review (the companion
formatter that builds multi-directory prompts) so both delete and the other
multi-dir confirmation outputs include directory prefixes or grouped lists.
🪄 Autofix (Beta)
❌ Autofix failed (check again to retry)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 66ab800c-a00a-4a42-a0b2-74d167320914
📒 Files selected for processing (5)
crates/redox-tui/src/app/state/explorer.rscrates/redox-tui/src/app/state/tests.rscrates/redox-tui/src/lib.rscrates/redox-tui/src/ui/widgets/explorer.rscrates/redox-tui/src/ui/widgets/toast.rs
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found. |
Some small tweaks and fixes to explorer behaviour.
Highlights:
A larger explorer feature is coming soon ;)
Summary by CodeRabbit