Skip to content

FIX: Render target capabilities as structured columns in config table#1691

Merged
romanlutz merged 10 commits intomicrosoft:mainfrom
romanlutz:romanlutz/fix-target-capabilities-rendering
May 7, 2026
Merged

FIX: Render target capabilities as structured columns in config table#1691
romanlutz merged 10 commits intomicrosoft:mainfrom
romanlutz:romanlutz/fix-target-capabilities-rendering

Conversation

@romanlutz
Copy link
Copy Markdown
Contributor

@romanlutz romanlutz commented May 5, 2026

Summary

The target config page was rendering capabilities as a verbose JSON blob inside the Parameters column. This PR restructures the rendering to show capabilities as dedicated columns with clear visual indicators.

Changes

Backend

  • pyrit/backend/models/targets.py: Added TargetCapabilitiesInfo Pydantic model with 6 boolean capability fields. Added capabilities field to TargetInstance.
  • pyrit/backend/mappers/target_mappers.py: Populate capabilities from target_obj.capabilities. Added target_configuration to extracted_keys to filter the verbose blob from Parameters.

Frontend

  • frontend/src/types/index.ts: Added TargetCapabilitiesInfo interface and capabilities field to TargetInstance.
  • frontend/src/components/Config/TargetTable.tsx: Added 6 capability columns (Multi-turn, Multi-piece, JSON Schema, JSON Output, Edit History, System Prompt) with filled circle ✓/✗/— indicators and tooltip descriptions. Sticky table header for scroll visibility.
  • frontend/src/components/Chat/ChatWindow.tsx and ChatInputArea.tsx: Updated supports_multi_turn checks to prefer capabilities?.supports_multi_turn with legacy fallback.

Tests

  • Backend: Added tests for capabilities population, legacy field consistency, and target_configuration exclusion.
  • Frontend: Updated TargetTable tests with capabilities data and column verification.

Testing

  • All 13 backend mapper tests pass
  • All 15 frontend TargetTable tests pass
  • All 91 frontend Chat component tests pass

Screenshot

image

romanlutz and others added 6 commits May 5, 2026 12:12
- Add TargetCapabilitiesInfo model (6 boolean capability fields) to backend
- Populate capabilities in target mapper from target_obj.capabilities
- Add capability columns with checkmark/dismiss/dash indicators to TargetTable
- Update Chat components to prefer capabilities object with legacy fallback
- Add backend + frontend tests for capabilities population and rendering

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add target_configuration to extracted_keys so the verbose capabilities
  blob does not leak into the Parameters column
- Make checkmark/dismiss icons 16px bold for better visibility
- Add regression test for target_configuration filtering

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Switch to CheckmarkCircleFilled/DismissCircleFilled for better visibility
- Add sticky header so column names stay visible when scrolling

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread frontend/src/types/index.ts
Comment thread pyrit/backend/models/targets.py
Comment thread frontend/src/components/Config/TargetTable.tsx Outdated
Comment thread frontend/src/components/Config/TargetTable.test.tsx Outdated
Comment thread frontend/src/components/Config/TargetTable.test.tsx Outdated
Comment thread frontend/src/components/Config/TargetTable.tsx
Copy link
Copy Markdown
Contributor

@jbolor21 jbolor21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some tiny comments but looks good to me!

romanlutz and others added 4 commits May 6, 2026 15:49
- Move capability icon colors and cell width into makeStyles using design tokens (colorPaletteGreenForeground1, colorPaletteRedForeground1); drop hardcoded fontSize so icons inherit.

- Drop `Text size={200}` wrapper on table headers so they match other tables; switch tooltip trigger to a span with cursor:help class.

- Add tooltips for Type, Model, Endpoint, and Parameters columns.

- Tighten dash-count assertions to `toHaveLength(9)` and update inline comment to include the params dash.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Backend: expose flattened `supported_input_modalities` and `supported_output_modalities` on `TargetCapabilitiesInfo` so the frontend can render modality icons without re-deriving them.

- Frontend: new Inputs and Outputs columns rendering Fluent UI icons with hover tooltips. Canonical icon order: text, image, audio, video, reasoning, function call, function call output, tool call, binary, url. `function_call_output` is rendered as a composite `f(x)` plus return-arrow badge in the top-right corner.

- Adjust column widths so Endpoint has 1.5x more space (~450px) by trimming Type/Model/Capabilities/Parameters; Inputs gets a wider 160px column to accommodate up to 7 modality icons.

- Replace `Badge` for the Type column with plain `Text` to avoid the pill outline visual and prevent overlap with Model.

- Tighten `TargetConfig` test regex (`/reasoning_effort:/`) so the new Parameters tooltip text doesn't trigger a false positive.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ndow

The frontend was reading the deprecated top-level `supports_multi_turn` field via `capabilities.supports_multi_turn ?? supports_multi_turn`. Since the backend now always populates `capabilities`, the fallback is dead code and creates a two-source-of-truth issue. The legacy field will be removed in microsoft#1692; tightening the read sites here keeps that follow-up cleaner.

- ChatInputArea single-turn warning: read only from `capabilities`.

- ChatWindow single-turn limit and `isSingleTurn` flag: same.

- Tests: replace top-level `supports_multi_turn` fixtures with `capabilities` populated via a small `buildCapabilities` helper.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@romanlutz romanlutz enabled auto-merge May 7, 2026 19:07
@romanlutz romanlutz added this pull request to the merge queue May 7, 2026
Merged via the queue into microsoft:main with commit 1e39cdf May 7, 2026
48 checks passed
@romanlutz romanlutz deleted the romanlutz/fix-target-capabilities-rendering branch May 7, 2026 20:28
romanlutz added a commit to romanlutz/PyRIT that referenced this pull request May 8, 2026
Resolve overlapping `TargetCapabilitiesInfo` introduction between this
branch (modality blocking refactor) and main's PR microsoft#1691 (config table
capability columns):

- Use main's field naming: `supported_input_modalities` and
  `supported_output_modalities` (not `_data_types`)
- Drop the now-removed top-level `supports_multi_turn` from
  `TargetInstance` and its legacy-compat test
- Keep `capabilities` required (cleaner contract; main had it optional)
- Combine both filter additions in target_mappers.py: filter all
  `CapabilityName` enum values plus `target_configuration`
- Adopt main's `buildCapabilities` test helper everywhere; drop my
  duplicate `makeCaps` helper
- Update `ChatInputArea.tsx` modality check to use the renamed
  `supported_input_modalities` field

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants