Skip to content

test: add search API permission sync coverage#1428

Open
The-AarushiSingh wants to merge 1 commit into
sourcebot-dev:mainfrom
The-AarushiSingh:main
Open

test: add search API permission sync coverage#1428
The-AarushiSingh wants to merge 1 commit into
sourcebot-dev:mainfrom
The-AarushiSingh:main

Conversation

@The-AarushiSingh

@The-AarushiSingh The-AarushiSingh commented Jul 8, 2026

Copy link
Copy Markdown

What changed

Added a Vitest test for search API permission sync behavior.

Testing

Ran:

corepack yarn workspace @sourcebot/web vitest run src/features/search/searchApi.test.ts

Verified that disabled permission sync does not restrict repository search scope.

Summary by CodeRabbit

  • Tests
    • Added automated coverage for search behavior when permission syncing is turned off.
    • Verified search requests do not apply repository restrictions in that case and avoid unnecessary repository lookups.

@coderabbitai

coderabbitai Bot commented Jul 8, 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1df405d9-7362-45b0-89e3-e150cd5135db

📥 Commits

Reviewing files that changed from the base of the PR and between 2afc265 and d623a9b.

📒 Files selected for processing (1)
  • packages/web/src/features/search/searchApi.test.ts

Walkthrough

Adds a new Vitest test file for searchApi that mocks authentication, audit, Prisma permission filtering, entitlements, environment, and zoekt search dependencies, and verifies that disabling permission sync results in unrestricted zoekt searches without Prisma repo queries.

Changes

searchApi Test Coverage

Layer / File(s) Summary
Mock setup and permission-sync-disabled test
packages/web/src/features/search/searchApi.test.ts
Sets up hoisted mocks for auth, audit, Prisma repo filtering, entitlements, env, and zoekt search, then tests that when permission sync is disabled, the search request omits repoSearchScope and does not call prisma.repo.findMany.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 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 clearly summarizes the main change: adding search API test coverage for permission sync behavior.
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant