---
title: "Keep search results within the active workspace"
description: "Verify that a shared search term returns only records belonging to the current workspace and updates correctly after a workspace switch."
canonical_url: "https://vostride.com/agent-library/search-filtering/tenant-scoped-search.md"
md_url: "https://vostride.com/agent-library/search-filtering/tenant-scoped-search.md"
content_kind: "recipe"
topic: "search-filtering"
---

# Keep search results within the active workspace

Verify that a shared search term returns only records belonging to the current workspace and updates correctly after a workspace switch.

## Risk

Global search caches can be reused across tenants when the query stays unchanged. The fixture uses the same title in two authorized test workspaces so workspace identity is essential to the assertion.

## Fixtures

- The QA account belongs to isolated workspaces Cedar QA and Maple QA, each containing a task called Deployment rehearsal.
- The Cedar task key ends CED-41 and the Maple task key ends MAP-82; the seed inventory records their ownership.
- Each workspace also has a uniquely named control task to prove the active tenant before search.

## Steps

1. Open Cedar QA and verify its workspace label and unique control task before searching.
2. Search Deployment rehearsal and verify the result key is CED-41 with no Maple result.
3. Switch to Maple QA using the workspace selector and verify the workspace label changes.
4. Run the same search and verify MAP-82 appears while CED-41 is absent.
5. Open the result and verify the detail workspace and key both identify Maple QA, then return to Cedar and verify CED-41 again.

## Expected results

- Each search result set agrees with the active workspace recorded by the independent seed manifest.
- The identical visible title resolves to different immutable records after a workspace switch.
- Returning to the original workspace restores its own result without displaying cached rows from the other workspace.

## False-pass traps

- A matching task title cannot establish workspace isolation when both tenants intentionally use that title.
- Access to both workspaces does not permit the current workspace search to mix their records.

## Cleanup

- Delete both test workspaces or their fixtures according to the project cleanup policy.
- Restore the QA account to its default workspace.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa first test](/docs/agent-qa/guides/first-test.md)
- [agent-qa web testing](/docs/agent-qa/guides/web-testing.md)

- [Search and filtering QA recipes](/agent-library/search-filtering.md)
- [Software factory QA library](/agent-library.md)
