Repository navigation
fix(workspace): notify about collections that fail to open in Workspace Home - #8710
ravindra-bruno wants to merge 1 commit into
Conversation
|
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)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughFailed workspace collections now retain filesystem failure metadata, are excluded from reopening during workspace switches, and display actionable status, error, and removal behavior in the workspace collection list. ChangesFailed Collection Handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant WorkspaceSwitch
participant loadWorkspaceCollectionsForSwitch
participant openMultipleCollections
participant Toast
WorkspaceSwitch->>loadWorkspaceCollectionsForSwitch: switch workspace
loadWorkspaceCollectionsForSwitch->>openMultipleCollections: open eligible collection paths
openMultipleCollections-->>loadWorkspaceCollectionsForSwitch: failed and invalid paths
loadWorkspaceCollectionsForSwitch->>Toast: show unopened collection error
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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
🧹 Nitpick comments (2)
packages/bruno-electron/tests/utils/workspace-config.spec.js (1)
182-201: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover an existing file path as an invalid collection.
The new tests cover a missing path and an empty directory, but not a path that exists as a regular file. Add that case and assert
failureReason === 'invalid'; otherwise the classification regression described above can return “Missing” for an existing path.As per coding guidelines, meaningful changes should include behavior-driven coverage for realistic errors and edge cases.
🤖 Prompt for 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. In `@packages/bruno-electron/tests/utils/workspace-config.spec.js` around lines 182 - 201, Extend the getWorkspaceCollections tests with a case where the configured collection path exists as a regular file, not a directory. Assert the entry remains present and is marked failedToOpen with failureReason set to 'invalid', covering the existing-file classification alongside the missing-path and empty-directory cases.Source: Coding guidelines
packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js (1)
374-409: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd regression coverage for switch-time failure reporting.
Please update the adjacent workspace actions tests to verify that failed entries are excluded from
openMultipleCollections,openResult.failedandopenResult.invalidare counted, and singular/plural error toasts are emitted correctly.As per coding guidelines, meaningful changes should add behavior-driven tests covering successful behavior and realistic degraded-mode cases.
🤖 Prompt for 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. In `@packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js` around lines 374 - 409, Add regression tests in the adjacent workspace actions test suite covering the switch flow: verify collections marked not found or failed to open are excluded from openMultipleCollections, failed and invalid entries returned by the open result are added to the unopened set, and toast.error uses singular messaging for one failure and plural messaging for multiple failures. Include successful opening and realistic degraded-mode cases while reusing the existing workspace action test setup.Source: Coding guidelines
🤖 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
`@packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js`:
- Around line 80-81: Update the loadedCollection return object in
CollectionsList to include both failedToOpen and failureReason from wc, matching
the existing unloaded placeholder mapping so failure metadata is preserved for
already-loaded collections.
In `@packages/bruno-electron/src/utils/workspace-config.js`:
- Around line 566-575: Update getCollectionFailureReason to return not-found
only when the collection path is absent; classify regular files, inaccessible
paths, and other non-absence filesystem errors as invalid. In
packages/bruno-electron/tests/utils/workspace-config.spec.js lines 182-201, add
a regular-file case asserting failureReason === 'invalid'.
---
Nitpick comments:
In `@packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js`:
- Around line 374-409: Add regression tests in the adjacent workspace actions
test suite covering the switch flow: verify collections marked not found or
failed to open are excluded from openMultipleCollections, failed and invalid
entries returned by the open result are added to the unopened set, and
toast.error uses singular messaging for one failure and plural messaging for
multiple failures. Include successful opening and realistic degraded-mode cases
while reusing the existing workspace action test setup.
In `@packages/bruno-electron/tests/utils/workspace-config.spec.js`:
- Around line 182-201: Extend the getWorkspaceCollections tests with a case
where the configured collection path exists as a regular file, not a directory.
Assert the entry remains present and is marked failedToOpen with failureReason
set to 'invalid', covering the existing-file classification alongside the
missing-path and empty-directory cases.
🪄 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
Run ID: 2a511c20-dd15-4d82-b6ed-6b4dd65aefb0
📒 Files selected for processing (4)
packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.jspackages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.jspackages/bruno-electron/src/utils/workspace-config.jspackages/bruno-electron/tests/utils/workspace-config.spec.js
| failedToOpen: !!wc.failedToOpen, | ||
| failureReason: wc.failureReason, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve failure metadata for already-loaded collections.
failedToOpen and failureReason are only copied into the unloaded placeholder branch. During workspace switching, the same pathname can already exist in Redux, so the loadedCollection branch drops these flags; the card can then bypass the failure guard and mount a collection that this workspace marked as failed.
Copy both fields into the loadedCollection return object as well.
Suggested fix
if (loadedCollection) {
return {
...loadedCollection,
isGitBacked: !!wc.remote,
- gitRemoteUrl: wc.remote
+ gitRemoteUrl: wc.remote,
+ failedToOpen: !!wc.failedToOpen,
+ failureReason: wc.failureReason
};
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| failedToOpen: !!wc.failedToOpen, | |
| failureReason: wc.failureReason, | |
| if (loadedCollection) { | |
| return { | |
| ...loadedCollection, | |
| isGitBacked: !!wc.remote, | |
| gitRemoteUrl: wc.remote, | |
| failedToOpen: !!wc.failedToOpen, | |
| failureReason: wc.failureReason | |
| }; | |
| } |
🤖 Prompt for 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.
In
`@packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js`
around lines 80 - 81, Update the loadedCollection return object in
CollectionsList to include both failedToOpen and failureReason from wc, matching
the existing unloaded placeholder mapping so failure metadata is preserved for
already-loaded collections.
f30bffd to
e58b2e2
Compare
[JIRA - BRU-2508]
Cause: When a workspace was opened, any local collection that couldn't be loaded, its folder had been moved or deleted, or the path held no valid collection config was silently discarded during resolution. Because it was dropped entirely, Workspace Home showed nothing, no notification fired, and the user had no way to see why it failed or to remove the stale entry.
Resolution: Instead of discarding the broken entry, it's now kept and flagged with a failure reason (either "not found" or "invalid"). On switching workspaces the user gets an error notification, the collection stays visible with a red "Missing" / "Failed to open" badge, clicking it explains the reason, and it can be removed from the workspace via the row menu. The flags are transient in-memory state, so nothing changes on disk.
Description
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
New Features
Bug Fixes