Skip to content

fix(workspace): notify about collections that fail to open in Workspace Home - #8710

Closed
ravindra-bruno wants to merge 1 commit into
usebruno:release/v4.1.0from
ravindra-bruno:fix/bru-2508
Closed

ravindra-bruno wants to merge 1 commit into
usebruno:release/v4.1.0from
ravindra-bruno:fix/bru-2508

Conversation

@ravindra-bruno

@ravindra-bruno ravindra-bruno commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

[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:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

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

    • Added enhanced collection status badges for cases where collections are missing or fail to open, including “Missing” vs “Failed to open”.
    • Added more specific error toasts explaining why a collection could not be opened.
    • Enabled removing collections that fail to open directly from the workspace.
  • Bug Fixes

    • Improved workspace switching/opening logic to treat failed-to-open collections as unopened and surface appropriate error feedback instead of silently skipping or only warning.
    • Updated workspace collection resolution to correctly classify missing vs invalid collection paths and preserve them for recovery.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3bd49061-dc1d-4463-839e-e88c9a5b4f4f

📥 Commits

Reviewing files that changed from the base of the PR and between f30bffd and e58b2e2.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js
  • packages/bruno-electron/src/utils/workspace-config.js
  • packages/bruno-electron/tests/utils/workspace-config.spec.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/bruno-electron/tests/utils/workspace-config.spec.js
  • packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js
  • packages/bruno-electron/src/utils/workspace-config.js

Walkthrough

Failed 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.

Changes

Failed Collection Handling

Layer / File(s) Summary
Classify and retain failed collections
packages/bruno-electron/src/utils/workspace-config.js, packages/bruno-electron/tests/utils/workspace-config.spec.js
Collection paths are classified as not-found or invalid; failed entries remain in workspace results with metadata, covered by updated tests.
Report unopened collections during switching
packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js
Workspace switching skips failed collections, collects failed or invalid paths, and shows singular or plural error toasts.
Surface and remove failed collections
packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js
Failed collections receive status badges, reason-specific open errors, and workspace-level removal handling with success or error toasts.

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
Loading

Possibly related PRs

  • usebruno/bruno#6264: Introduces workspace-management and collection action wiring used by this failed-collection handling.
  • usebruno/bruno#6587: Overlaps with the workspace collection removal flow.
  • usebruno/bruno#7879: Extends the Git-remote collection pipeline that this change marks with failure metadata.

Suggested reviewers: helloanoop, lohit-bruno, bijin-bruno, sid-bruno, naman-bruno

Poem

Missing paths knock at the door,
Failed collections open no more.
Badges glow with danger bright,
Toasts explain the absent plight.
Remove the ghosts, and workspace sings.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main theme of surfacing collections that fail to open in Workspace Home.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
packages/bruno-electron/tests/utils/workspace-config.spec.js (1)

182-201: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover 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 win

Add regression coverage for switch-time failure reporting.

Please update the adjacent workspace actions tests to verify that failed entries are excluded from openMultipleCollections, openResult.failed and openResult.invalid are 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

📥 Commits

Reviewing files that changed from the base of the PR and between bf40778 and f30bffd.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js
  • packages/bruno-electron/src/utils/workspace-config.js
  • packages/bruno-electron/tests/utils/workspace-config.spec.js

Comment on lines +80 to +81
failedToOpen: !!wc.failedToOpen,
failureReason: wc.failureReason,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
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.

@ravindra-bruno
ravindra-bruno changed the base branch from main to release/v4.1.0 July 22, 2026 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants