test(home): regression test for folder browser backend-switch (closes #200)#713
Open
CryptoJones wants to merge 1 commit into
Open
Conversation
PR OpenHands#306 fixed issue OpenHands#200 by keying useHomeDirectory / useSearchSubdirs on the active backend id+orgId and adding a reset effect that clears currentPath when the active backend changes, but the existing workspace-selection-form tests don't drive a backend switch and so wouldn't catch a regression of either piece. Add a focused FolderBrowserModal test that mounts the modal with one backend, switches active backend mid-test, and asserts the breadcrumb re-seeds to the new backend's home directory (and that the previous backend's path is gone). The test was verified to fail when the reset effect is removed from folder-browser-modal.tsx. Closes OpenHands#200 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@CryptoJones is attempting to deploy a commit to the openhands Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Issue #200 reported that switching from a Local backend to a custom remote backend left the Add-Workspace folder browser displaying the previous backend's home directory (e.g. `/Users/joepelletier` instead of `/Users/homeadmin`) and 404'ing on the next navigation.
PR #306 fixed this by (a) including the active backend's `id` + `orgId` in the React Query keys for `useHomeDirectory` / `useSearchSubdirs` and (b) adding a reset effect in `FolderBrowserModal` that nulls `currentPath` whenever `active.backend.id` changes. Both pieces are still in place on `main`.
The existing `tests/components/features/home/workspace-selection-form.test.tsx` covers opening the modal once but never drives a backend switch, so neither piece of the fix has regression coverage today. This PR adds that coverage and closes the still-open #200.
Summary
Issue Number
Closes #200
How to Test
```bash
npm install
npm run make-i18n
npx vitest run tests/components/features/home/folder-browser-modal-backend-switch.test.tsx
```
To confirm it catches the regression, temporarily delete the `useEffect(() => { setCurrentPath(null); }, [active.backend.id, active.orgId]);` block in `src/components/features/home/workspace-dropdown/folder-browser-modal.tsx` and re-run — the test fails. (Verified locally.)
Type
Notes
Sister cleanup: issue #205 (Export Conversation server-side zip failure) is also being closed as already-fixed in `software-agent-sdk#3170`, which is included in our currently pinned `agent-server` v1.23.0 (`config/defaults.json`). No code change there.