FIX Clarify target choices in the Add Target picker - #2316
Open
romanlutz wants to merge 1 commit into
Open
Conversation
The Add Target dialog listed the eight selectable targets as bare implementation class names, so the similar OpenAI entries were impossible to tell apart before committing to one. Replace the native select with a Fluent Dropdown whose options show a human-friendly name, the backend catalog description, the implementation identifier as secondary detail, and the supported authentication modes. The same facts stay visible after the list closes in a "Selected target details" region, and the picker now reports catalog loading and catalog failure explicitly instead of silently falling back. All metadata comes from the existing /targets/catalog response; no new capabilities are claimed and no backend change is needed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2c45e075-9e85-40b5-8352-fb0bcab7261c
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.
Description
The Add Target dialog listed its eight choices as raw implementation class names only (
AzureMLChatTarget,OpenAIChatTarget,OpenAICompletionTarget,OpenAIImageTarget,OpenAIResponseTarget,OpenAITTSTarget,OpenAIVideoTarget,RoundRobinTarget). The five OpenAI entries are nearly indistinguishable from their names alone, and nothing in the selection UI explained what a target does or how it authenticates. A first-time user had to guess.The backend already had everything needed to fix this.
GET /targets/catalogreturns adescriptionper entry (sourced frommetadata.class_description) plussupported_auth_modes, andTargetCatalogEntry.descriptionwas already declared infrontend/src/types/index.ts.target_service.pynotes that deciding what to surface "is a presentation concern owned by the caller", so this is a frontend-only change with no API or backend work.Approach: the bare native
Selectis replaced with a FluentDropdown. Each option now renders a human-friendly name, the catalog description, the implementation identifier as secondary detail, and the supported auth modes. Once a target is chosen, a "Selected target details" region keeps that same information visible so the user can confirm the choice before filling in parameters, rather than being left with just a class name.Before and after with
RoundRobinTargetselected:Notes for reviewers:
supported_auth_modes.TARGET_DISPLAY_NAMES,FALLBACK_TARGET_CATALOG_ENTRIES). The fallback only supplies the friendly label and identifier when the catalog request fails, so the picker degrades to roughly today's behavior plus aMessageBarrather than rendering an empty list. Descriptions are never faked.aria-labelof the form"<display>. <description>. Implementation: <TypeName>. Supported authentication: ...", which is what both the Jest and Playwright tests select on. That string is unambiguous across the similar OpenAI names.seenOpenstate variable instead of asetStateinside an effect, which thereact-hooks/set-state-in-effectrule forbids.e2e/accessibility.spec.ts"mobile touch context" failures are pre-existing and unrelated (onboarding tour touch targets are 24px). I confirmed this by stashing these changes and reproducing the failures on unmodifiedmain.Tests and Documentation
CreateTargetDialog.test.tsxgrows from 46 to 50 tests, covering the loading spinner, the catalog-unavailable message bar, description and auth rendering per option, and the selected-target details region. The existing creation, validation, and parameter tests were migrated to the new control.Two jsdom-only quirks of the Fluent
Dropdownwhen nested in a FluentDialogforced a test-helper change, and they are documented in a comment block above the helpers so the next person does not rediscover them:userEvent.clickdoes not open the popover in that nesting (it works standalone);fireEvent.clickdoes.aria-hidden="true"on the dialog while the listbox is open and never removes it, which hides the rest of the form from role-based queries.restoreDialogAccessibility()strips it after close.Neither reproduces in a real browser, which the Playwright coverage confirms.
e2e/config.spec.tsadds a test asserting all eight choices are present and distinguishable, and exercises keyboard navigation through the picker.Results: Jest 41 suites / 877 tests pass.
npm run lintandnpm run type-checkare clean. Playwrightconfig.spec.tspasses 15/15.JupyText: N/A, no files under
doc/changed.