Add agent service tests#748
Open
devdattatalele wants to merge 1 commit into
Open
Conversation
Author
|
@herber are their any CLA Document to be signed before submitting pr? |
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.
Adds vitest coverage for the agent module services.
agent.test.ts(14 tests) —listAgents(scoping, voyager search, filter passthrough),getAgentById,createAgent,updateAgent(tenant check, identity-actor flow),upsertAgent(hash hit, slug generation, P2002 race retry, error propagation),archiveAgent.agentClient.test.ts(10 tests) —listAgentClients(scoping, whitespace search, voyager),getAgentClientById,upsertAgentClient(OAuth registration vs system_client, new-vs-existing index queue),createAgentClient.agentInstance.test.ts(7 tests) —listAgentInstances(tenant check, filter passthrough),getAgentInstanceById,upsertAgentInstance(registration/client mismatch, tool_call constraint, hash + upsert).Mocking pattern mirrors
tenant/environment.test.tsandmonitor/alert.test.ts(vi.mock@metorial-subspace/db,@lowerdeck/service,@lowerdeck/pagination). Source unchanged.31 tests, prettier-clean.
Note
Low Risk
Test-only additions with no runtime or API behavior changes.
Overview
Adds Vitest unit tests for the agent module’s three service layers (
agent,agentClient,agentInstance) with no production code changes.agentService(~14 tests): list scoping and Voyager search/filter passthrough; get-by-id not-found handling; create/update/archive flows through identity actors andcheckTenant; upsert hash short-circuit, slug generation, PrismaP2002race retry, and error propagation.agentClientService(~10 tests): list scoping and search (including whitespace-only search skipped); OAuth registration onmcp_client_oauthvs none forsystem_client; post-transaction search indexing only on new upserts;createAgentClientdelegating to upsert.agentInstanceService(~7 tests): tenant checks and filters on list/get; upsert validation (registration/client mismatch,tool_callagent type constraint); hash-basedagentOid_hashupsert.Mocks follow the same pattern as other subspace service tests (
@metorial-subspace/db,@lowerdeck/service,@lowerdeck/pagination, plus module-specific deps).Reviewed by Cursor Bugbot for commit adbd732. Bugbot is set up for automated code reviews on this repo. Configure here.