Description
A new backend endpoint was created to fetch a single deployment by ID without requiring the deployment type in the path. The frontend currently makes 3 separate calls when rendering the Run Summary page (2 listing calls to guess deployment type as a fallback, plus 1 full deployments list call to resolve catalog fields for building the external link). This should be migrated to use the single new endpoint instead.
Key points:
- Remove the two-list type-guessing fallback in resolveDeploymentType (resolve-deployment-type.ts) and useDeploymentType (use-deployment-type.ts)
- Remove the full deployments list call in useUtilityDeployments (use-utility-deployments.ts), used only to resolve catalog fields (model/application/reference/displayName) for DeploymentExternalLink
- Both should be replaced by a single call to the new backend endpoint (GET by id, resolves type across all deployment types)
- End result: rendering Run Summary should issue 1 network call instead of 3 for this feature
Acceptance criteria
Additional occurrences of the same anti-pattern
The same "fetch the full deployments list client-side, then .find() a single deployment by id" pattern also shows up in three other places. Two of them don't even need the new endpoint — the type is already known and unused:
1. TestSuites/Properties/Properties.tsx (Test Suite view — "open application" link)
useUtilityDeployments() (line 36) fetches the full catalog list.
useEffect (lines 65-77) calls getDeployments(token, type, ...) with no type filter, listing every deployment just to find the one matching deploymentRef.id and read its $type.
testSuite.deploymentRef.type is already present on the loaded suite and is never read here.
- Fix: read
deploymentRef.type directly; replace the unfiltered getDeployments() call with the existing single-deployment lookup TestSuitesApi.getDeployment(id, type, token) (test-suites-api.ts:172-174, GET /deployments/{type}/{id}). The useUtilityDeployments() catalog call still migrates to the new endpoint together with the Run Summary fix.
2. TestSuites/View/MethodTabContent.tsx (Test Suite "Change method" modal)
- Fetches
getDeployments() with no type filter (line 85), then .find()s by deploymentId (line 82) to build selectedApplication for ChangeMethodModal.
testSuite.deploymentRef.type is already known and unused here too.
- Fix: replace with the point lookup
getDeployment(id, type) instead of the full list.
3. Assets/Conversations/View/Properties.tsx (Conversation properties panel — "open agent" link)
Related issues
No response
Confidential information
Description
A new backend endpoint was created to fetch a single deployment by ID without requiring the deployment type in the path. The frontend currently makes 3 separate calls when rendering the Run Summary page (2 listing calls to guess deployment type as a fallback, plus 1 full deployments list call to resolve catalog fields for building the external link). This should be migrated to use the single new endpoint instead.
Key points:
Acceptance criteria
Additional occurrences of the same anti-pattern
The same "fetch the full deployments list client-side, then
.find()a single deployment by id" pattern also shows up in three other places. Two of them don't even need the new endpoint — the type is already known and unused:1.
TestSuites/Properties/Properties.tsx(Test Suite view — "open application" link)useUtilityDeployments()(line 36) fetches the full catalog list.useEffect(lines 65-77) callsgetDeployments(token, type, ...)with no type filter, listing every deployment just to find the one matchingdeploymentRef.idand read its$type.testSuite.deploymentRef.typeis already present on the loaded suite and is never read here.deploymentRef.typedirectly; replace the unfilteredgetDeployments()call with the existing single-deployment lookupTestSuitesApi.getDeployment(id, type, token)(test-suites-api.ts:172-174,GET /deployments/{type}/{id}). TheuseUtilityDeployments()catalog call still migrates to the new endpoint together with the Run Summary fix.2.
TestSuites/View/MethodTabContent.tsx(Test Suite "Change method" modal)getDeployments()with no type filter (line 85), then.find()s bydeploymentId(line 82) to buildselectedApplicationforChangeMethodModal.testSuite.deploymentRef.typeis already known and unused here too.getDeployment(id, type)instead of the full list.3.
Assets/Conversations/View/Properties.tsx(Conversation properties panel — "open agent" link)Fetches
getAllDeployments()(full catalog, lines 32-39), then.find()s byreference === model.id(line 27) to resolve the deployment behind a conversation, used to build the external link.Here the type is genuinely unknown (a conversation only carries
model.id, no type) — same shape as the Run Summary case, so this should migrate to the new by-id backend endpoint rather than a direct point lookup.Migrate
TestSuites/Properties/Properties.tsxto readdeploymentRef.typedirectly and usegetDeployment(id, type)instead of the unfiltered listMigrate
TestSuites/View/MethodTabContent.tsxto usegetDeployment(id, type)instead of the unfiltered listMigrate
Assets/Conversations/View/Properties.tsxto the new by-id backend endpoint instead ofgetAllDeployments()+.find()Related issues
No response
Confidential information