Skip to content

Fix MCP JSON viewer key vertically centered against tall expanded string - #14949

Merged
acarl005 merged 1 commit into
masterfrom
fix/mcp-json-tree-key-alignment-app-5312
Aug 11, 2026
Merged

Fix MCP JSON viewer key vertically centered against tall expanded string#14949
acarl005 merged 1 commit into
masterfrom
fix/mcp-json-tree-key-alignment-app-5312

Conversation

@warp-agent-staging

@warp-agent-staging warp-agent-staging Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes the MCP JSON viewer key alignment bug reported in Slack: when the request/response JSON tree for an MCP tool call is expanded and a key's string value is expanded and wraps to many lines (e.g. a long multi-line note field), the key label and chevron were vertically centered against the whole tall value block instead of sitting on the value's first line.

Root cause: render_long_string_row in app/src/ui_components/json_tree.rs put the chevron, key label, and value into a single Flex::row() with CrossAxisAlignment::Center. That's correct while the value is a single line, but once the expanded string wraps to multiple lines, Center centers the chevron/key against the entire value block instead of its first line.

Linked Issue

Fixes APP-5312.

  • Screenshots included below.

Changes

  • render_long_string_row: group the chevron and key label into their own nested Flex::row() with CrossAxisAlignment::Center (so they stay centered against each other, as before), and add that group as a single child of the outer row, which now uses CrossAxisAlignment::Start unconditionally. The chevron+key pair's line box top-aligns with the value's first line, whatever the value's height — so there's no longer a branch on expansion state, and the row looks the same as before for single-line (collapsed/short) values.
  • render_container_node and render_scalar_row were left untouched — their rows only ever render a single line of content, so they can't exhibit this bug, and their output is unaffected by this change.

Testing

  • cargo build -p warp --bin warp — succeeds.
  • cargo clippy -p warp --all-targets --tests -- -D warnings — passes with no new warnings.
  • cargo nextest run -p warp --lib json_tree — all 34 existing json_tree unit tests pass unchanged.
  • Per the requester's instruction, no new tests or comments were added.

Screenshots / Videos

Verified by driving the actual render_json_tree / render_long_string_row production code path (from app/src/ui_components/json_tree.rs) in a temporary, uncommitted scratch example, with a payload shaped like the report: an object with a few short keys (id, status) and one long note value that wraps to ~30 lines, rendered both collapsed and expanded.

Full window — both sections:

Full winit window showing both the Collapsed and Expanded sections of the JSON tree with id, note, and status rows.

Close-up of the expanded note row — the chevron is centered against the note: label as a pair, and that pair sits on the value's first line:

Close-up of the Expanded section's note row: down-chevron and "note:" label aligned as a pair, sitting at the top of the tall value aligned with Line 1.

Observed: the id/status single-line rows and the collapsed note row (single-line truncated preview) are pixel-unaffected and identical across both sections — only the expanded, multi-line case changes.

  • I have manually tested my changes locally with ./script/run

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: Fixed the MCP tool-call JSON viewer's key/chevron being vertically centered against a tall expanded multi-line string value instead of aligned to its top.

Conversation: https://staging.warp.dev/conversation/2b5f2fc5-0a58-4b64-ae97-899f9985870b
Run: https://oz.staging.warp.dev/runs/019ff1e8-1dd5-707a-a1f8-46dd41a7c505

This PR was generated with Oz.

@warp-agent-staging
warp-agent-staging Bot requested a review from acarl005 August 11, 2026 18:22
@cla-bot cla-bot Bot added the cla-signed label Aug 11, 2026
@warp-agent-staging
warp-agent-staging Bot force-pushed the fix/mcp-json-tree-key-alignment-app-5312 branch from 949d928 to 58a5e79 Compare August 11, 2026 19:41
Group the chevron and key label of a long-string JSON tree row into
their own nested row, centered against each other, and give the outer
row unconditional top alignment. The chevron now always centers
against its key's line box, while that pair top-aligns with the
value's first line regardless of how tall the value is -- with no
branch on expansion state.

Fixes APP-5312.

Co-Authored-By: Warp Agent <agent@warp.dev>
@warp-agent-staging
warp-agent-staging Bot force-pushed the fix/mcp-json-tree-key-alignment-app-5312 branch from 58a5e79 to cd54f2e Compare August 11, 2026 19:45
@acarl005
acarl005 marked this pull request as ready for review August 11, 2026 19:47
@acarl005
acarl005 merged commit a1af68c into master Aug 11, 2026
39 checks passed
@acarl005
acarl005 deleted the fix/mcp-json-tree-key-alignment-app-5312 branch August 11, 2026 23:17
@acarl005 acarl005 self-assigned this Aug 11, 2026
iamwavecut pushed a commit to iamwavecut/warp that referenced this pull request Aug 12, 2026
…ing (warpdotdev#14949)

## Description
Fixes the MCP JSON viewer key alignment bug reported in Slack: when the
request/response JSON tree for an MCP tool call is expanded and a key's
string value is expanded and wraps to many lines (e.g. a long multi-line
`note` field), the key label and chevron were vertically **centered**
against the whole tall value block instead of sitting on the value's
first line.

Root cause: `render_long_string_row` in
`app/src/ui_components/json_tree.rs` put the chevron, key label, and
value into a single `Flex::row()` with `CrossAxisAlignment::Center`.
That's correct while the value is a single line, but once the expanded
string wraps to multiple lines, `Center` centers the chevron/key against
the *entire* value block instead of its first line.

## Linked Issue
Fixes
[APP-5312](https://linear.app/warpdotdev/issue/APP-5312/mcp-json-viewer-key-vertically-centered-against-tall-expanded-string).
- [x] Screenshots included below.

## Changes
- `render_long_string_row`: group the chevron and key label into their
own nested `Flex::row()` with `CrossAxisAlignment::Center` (so they stay
centered against each other, as before), and add that group as a single
child of the outer row, which now uses `CrossAxisAlignment::Start`
unconditionally. The chevron+key pair's line box top-aligns with the
value's first line, whatever the value's height — so there's no longer a
branch on expansion state, and the row looks the same as before for
single-line (collapsed/short) values.
- `render_container_node` and `render_scalar_row` were left untouched —
their rows only ever render a single line of content, so they can't
exhibit this bug, and their output is unaffected by this change.

## Testing
- `cargo build -p warp --bin warp` — succeeds.
- `cargo clippy -p warp --all-targets --tests -- -D warnings` — passes
with no new warnings.
- `cargo nextest run -p warp --lib json_tree` — all 34 existing
`json_tree` unit tests pass unchanged.
- Per the requester's instruction, no new tests or comments were added.

### Screenshots / Videos
Verified by driving the actual `render_json_tree` /
`render_long_string_row` production code path (from
`app/src/ui_components/json_tree.rs`) in a temporary, uncommitted
scratch example, with a payload shaped like the report: an object with a
few short keys (`id`, `status`) and one long `note` value that wraps to
~30 lines, rendered both collapsed and expanded.

Full window — both sections:

![Full winit window showing both the Collapsed and Expanded sections of
the JSON tree with id, note, and status
rows.](https://staging.warp.dev/api/v1/agent/artifacts/019ff24a-fc54-7445-b352-0dd81c22ce61/download)

Close-up of the expanded `note` row — the chevron is centered against
the `note:` label as a pair, and that pair sits on the value's first
line:

![Close-up of the Expanded section's note row: down-chevron and "note:"
label aligned as a pair, sitting at the top of the tall value aligned
with Line
1.](https://staging.warp.dev/api/v1/agent/artifacts/019ff24b-1264-7241-a371-b55687da4259/download)

Observed: the `id`/`status` single-line rows and the collapsed `note`
row (single-line truncated preview) are pixel-unaffected and identical
across both sections — only the expanded, multi-line case changes.

- [ ] I have manually tested my changes locally with `./script/run`

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: Fixed the MCP tool-call JSON viewer's key/chevron
being vertically centered against a tall expanded multi-line string
value instead of aligned to its top.

_Conversation:
https://staging.warp.dev/conversation/2b5f2fc5-0a58-4b64-ae97-899f9985870b_
_Run:
https://oz.staging.warp.dev/runs/019ff1e8-1dd5-707a-a1f8-46dd41a7c505_

_This PR was generated with [Oz](https://warp.dev/oz)._

Co-authored-by: Oz <oz-agent@warp.dev>
Co-authored-by: Warp Agent <agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants