Skip to content

Migrate Run Summary deployment link to single-deployment endpoint #4380

Description

@NastassiaKryshtal

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

  • Add API client method for the new single-deployment-by-id endpoint
  • Replace resolveDeploymentType fallback (resolve-deployment-type.ts) with the new endpoint
  • Replace useUtilityDeployments full-list call (use-utility-deployments.ts) with the new endpoint for DeploymentExternalLink
  • Remove now-unused list-based fallback code and any dead imports
  • Verify Run Summary page issues only 1 deployment-related network call
  • Update/add tests covering the new single-call path

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)

  • Fetches getAllDeployments() (full catalog, lines 32-39), then .find()s by reference === 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.tsx to read deploymentRef.type directly and use getDeployment(id, type) instead of the unfiltered list

  • Migrate TestSuites/View/MethodTabContent.tsx to use getDeployment(id, type) instead of the unfiltered list

  • Migrate Assets/Conversations/View/Properties.tsx to the new by-id backend endpoint instead of getAllDeployments() + .find()

Related issues

No response

Confidential information

  • I confirm that do not share any confidential information

Activity

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

Metadata

Metadata

Labels

P3 – MediumSecondary flow or UX is degraded. No data loss. Reasonable workaround availableenhancementNew requested features or functional improvements to existing components.evalA tag for tasks related to tools and infrastructure used for evaluating model output quality

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions