Fix diff button when Show code review button toggle is off#9600
Conversation
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I reviewed this pull request and requested human review from: @vorporeal. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR removes the show_code_review_button guard from Workspace::setup_code_review_panel, keeping the setting scoped to toolbar button visibility while allowing explicit panel-open paths such as git-diff block actions to initialize the code review panel.
Concerns
- No blocking correctness, security, error-handling, or performance concerns found in the changed diff lines.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
|
reassigning to @moirahuang, based on some historical git blame information |
| if !*TabSettings::as_ref(ctx).show_code_review_button { | ||
| return; | ||
| } | ||
| // Note: do NOT gate this on `show_code_review_button` — that setting |
There was a problem hiding this comment.
nit: i think we don't need this comment! although this is helpful context for this PR, i think we don't need a comment explaining why code is not there
|
I just tested this locally and I'm not seeing the panel open w the setting off, mind locally confirming your change please? |
dace6dc to
19cf7ba
Compare
|
@moirahuang Good catch — you were right, the original fix was incomplete. Pushed What was wrongThe original commit removed the Net effect:
That matches your repro exactly. The fix
This is safe for the other variants in the match: Verified locallyBuilt
Result: code review panel opens on the right with the diff visible, while the toolbar button stays hidden — exactly what #9196 reports as the expected behaviour. Toolbar button gating is preserved ( Format check passes. cargo nextest skipped locally (Metal toolchain unavailable, same as #9277). Ready for re-review. |
| /// Returns `None` if the panel should not be rendered (item not supported, | ||
| /// panel not open, or item is not a panel type). | ||
| /// | ||
| /// Uses `is_supported` instead of `is_available` because user show/hide |
There was a problem hiding this comment.
similar comment as here, i think we don't need this comment. it makes sense in the context of this PR but it's not needed in the actual code
| } | ||
|
|
||
| /// Renders the maximized code review panel if it is configured and maximized. | ||
| /// Uses `is_supported` instead of `is_available` for the same reason as |
There was a problem hiding this comment.
similar request here that we don't need this comment
19cf7ba to
a75e74e
Compare
|
@moirahuang Pushed 1. Removed the three explanatory comments
2. Toolbar-removed edge caseYou're right — Added a fallback after the right-side iteration in both render paths (horizontal-tabs at } else if !config.contains_item(&HeaderToolbarItemKind::CodeReview) {
Self::add_panel_with_separator(
&mut main_content,
&mut prev_panel_added,
self.render_config_panel(&HeaderToolbarItemKind::CodeReview, …),
app,
);
}The fallback is gated on the same To support that without scattering the 3. Unit testsFour new tests in
Local verification
Branch rebased onto |
Closes warpdotdev#9196. The `show_code_review_button` setting is meant to gate only the toolbar button's visibility — but two unrelated places in the workspace also short-circuited on it, so explicit user actions like clicking the diff chip on the prompt or hitting the toggle keybinding silently did nothing whenever the user had hidden the toolbar button. This PR removes both gates and adds a render fallback for the case where the user has removed the Code Review item from the toolbar layout entirely. Three changes in `app/src/workspace/view.rs`, one helper in `app/src/workspace/tab_settings.rs`, and four unit tests in `app/src/workspace/tab_settings_tests.rs`. 1. **Data path** — `Workspace::setup_code_review_panel` no longer bails out on `!show_code_review_button`. The setting controls toolbar button visibility, which is already enforced correctly by `header_toolbar_item.rs::is_available` (driving `render_header_toolbar_button`); the panel infrastructure must not disappear when the user just hides the button. 2. **Render path** — `render_config_panel` and `render_config_panel_maximized` previously gated on `is_available()`, which for `CodeReview` includes the same `show_code_review_button` user preference. Both call sites switch to `is_supported(app)` (compile-time `cfg!(feature = "local_fs")`). `is_available`'s own doc-comment scopes it to "should be shown in the toolbar" — using it for panel rendering conflated two unrelated concerns. `TabsPanel`/`ToolsPanel` are unaffected because their `is_available` already equals `is_supported`, and `AgentManagement`/`NotificationsMailbox` return `None` unconditionally inside `render_config_panel`. 3. **Toolbar-removed fallback** — when the user removes the Code Review item from the toolbar via the toolbar editor, the `config.left_items()` / `config.right_items()` iterations skip it entirely, so the panel could never render even with the data path open. After the right-side iteration in both the horizontal and vertical-tabs render paths, fall back to rendering the Code Review panel directly when the item isn't part of the layout. The fallback is gated on the same `is_supported` + `right_panel_open` checks inside `render_config_panel`, so it's a no-op when the panel is closed or the feature isn't compiled in. Adds `HeaderToolbarChipSelection::contains_item` for the fallback check, with four unit tests covering Default and Custom variants (present, absent, side-insensitive, empty).
a75e74e to
e2808df
Compare
moirahuang
left a comment
There was a problem hiding this comment.
looks good to me! thanks for making this PR
…v#9600) Closes warpdotdev#9196. ### Description Two `show_code_review_button` gates were dropping panel-open requests on the floor when the user had hidden the toolbar button: **1. Data-path gate at `Workspace::setup_code_review_panel` (`view.rs:7982`)** ```rust if !*TabSettings::as_ref(ctx).show_code_review_button { return; } ``` `update_right_panel_open_state` calls into this whenever the right panel is being opened (chip click, `Shift+Cmd+=` keybinding, etc.), so the early return silently swallowed every explicit user action. **2. Render-path gate at `Workspace::render_config_panel` and `render_config_panel_maximized` (`view.rs:18981` / `19040`)** ```rust if !item.is_available(app) || !item.is_panel() { return None; } … if !HeaderToolbarItemKind::CodeReview.is_available(app) { return None; } ``` `HeaderToolbarItemKind::is_available` for `CodeReview` returns `*TabSettings::as_ref(app).show_code_review_button.value()` (`header_toolbar_item.rs:89`). So even after fix #1 set `pane_group.right_panel_open = true` and `setup_code_review_panel` ran, the next render frame saw `is_available() == false` and returned `None` — the `right_panel_view` was never added to the layout. This second gate is what @moirahuang flagged when their local repro still showed nothing happening after the first fix landed. The data was correct; the panel was just never composed into the UI. ### Fix 1. **Drop the early return at `setup_code_review_panel`.** The setting is meant to gate only the toolbar button's visibility (already enforced correctly by `header_toolbar_item.rs::is_available`, which feeds `render_header_toolbar_button` at `view.rs:17276`). 2. **Switch panel-render call sites from `is_available` → `is_supported`.** `is_available`'s own doc-comment says it's specifically *"Whether this item should be shown in the **toolbar** — checks both `is_supported` and user show/hide preferences."* Using it to gate panel rendering conflates two unrelated concerns. Panel rendering should only care about whether the feature is compiled in (`is_supported`), not whether the user has hidden the toolbar button. For `CodeReview`, `is_supported` is `cfg!(feature = "local_fs")`. For the other variants in the same match (`TabsPanel`, `ToolsPanel`), `is_available` already equals `is_supported` (default `_ => true` arm in the inner match), so behaviour is unchanged. `AgentManagement` and `NotificationsMailbox` return `None` unconditionally inside `render_config_panel`, so the change is moot for them too. ### Caller audit for `setup_code_review_panel` 5 call sites in `view.rs`: 1. `view.rs:3681` — `TransferredTab` flow, only runs when the source tab already had `right_panel_open == true`. 2. `view.rs:8136` — `update_right_panel_open_state` with `should_open == true`. **The diff-button path** that warpdotdev#9196 is about. 3. `view.rs:13372` — `PaneFocused` event, gated on `right_panel_open` already true. 4. `view.rs:13490` — `RepoChanged` event, gated on `right_panel_open` already true. 5. `view.rs:14458` — session env update, gated on `right_panel_open` already true. None of these need the `show_code_review_button` gate — they're either explicit user actions or gated on `right_panel_open` already being open. The toolbar button toggle continues to do its job at `render_header_toolbar_button` independently. ### Testing Reproduced @moirahuang's test locally on macOS 26.4.1 (Apple Silicon) against `WarpOss.app` built from this branch: 1. Settings → "Show code review button" → **OFF** 2. `echo "x" >> README.md` inside a git repo 3. Click the diff stats chip on the prompt (`+1 -0`) **Result:** Code review panel opens on the right showing the diff, while the toolbar button stays hidden — exactly the expected behaviour from issue warpdotdev#9196. Inverse case (toggle ON) also verified: toolbar button visible, panel still works the same. - `cargo fmt -p warp -- --check` passes. - `cargo nextest` skipped locally — Metal toolchain unavailable on my machine, mirroring warpdotdev#9277. CI will exercise the change. ### Server API No server changes. ### Agent Mode Not applicable. ### Changelog Entries `CHANGELOG-BUG-FIX`: The diff button on the terminal prompt now opens the code review panel even when the toolbar's "Show code review button" toggle is disabled (regression from a recent release). Co-authored-by: anshul-garg27 <[email protected]>
…v#9600) Closes warpdotdev#9196. ### Description Two `show_code_review_button` gates were dropping panel-open requests on the floor when the user had hidden the toolbar button: **1. Data-path gate at `Workspace::setup_code_review_panel` (`view.rs:7982`)** ```rust if !*TabSettings::as_ref(ctx).show_code_review_button { return; } ``` `update_right_panel_open_state` calls into this whenever the right panel is being opened (chip click, `Shift+Cmd+=` keybinding, etc.), so the early return silently swallowed every explicit user action. **2. Render-path gate at `Workspace::render_config_panel` and `render_config_panel_maximized` (`view.rs:18981` / `19040`)** ```rust if !item.is_available(app) || !item.is_panel() { return None; } … if !HeaderToolbarItemKind::CodeReview.is_available(app) { return None; } ``` `HeaderToolbarItemKind::is_available` for `CodeReview` returns `*TabSettings::as_ref(app).show_code_review_button.value()` (`header_toolbar_item.rs:89`). So even after fix warpdotdev#1 set `pane_group.right_panel_open = true` and `setup_code_review_panel` ran, the next render frame saw `is_available() == false` and returned `None` — the `right_panel_view` was never added to the layout. This second gate is what @moirahuang flagged when their local repro still showed nothing happening after the first fix landed. The data was correct; the panel was just never composed into the UI. ### Fix 1. **Drop the early return at `setup_code_review_panel`.** The setting is meant to gate only the toolbar button's visibility (already enforced correctly by `header_toolbar_item.rs::is_available`, which feeds `render_header_toolbar_button` at `view.rs:17276`). 2. **Switch panel-render call sites from `is_available` → `is_supported`.** `is_available`'s own doc-comment says it's specifically *"Whether this item should be shown in the **toolbar** — checks both `is_supported` and user show/hide preferences."* Using it to gate panel rendering conflates two unrelated concerns. Panel rendering should only care about whether the feature is compiled in (`is_supported`), not whether the user has hidden the toolbar button. For `CodeReview`, `is_supported` is `cfg!(feature = "local_fs")`. For the other variants in the same match (`TabsPanel`, `ToolsPanel`), `is_available` already equals `is_supported` (default `_ => true` arm in the inner match), so behaviour is unchanged. `AgentManagement` and `NotificationsMailbox` return `None` unconditionally inside `render_config_panel`, so the change is moot for them too. ### Caller audit for `setup_code_review_panel` 5 call sites in `view.rs`: 1. `view.rs:3681` — `TransferredTab` flow, only runs when the source tab already had `right_panel_open == true`. 2. `view.rs:8136` — `update_right_panel_open_state` with `should_open == true`. **The diff-button path** that warpdotdev#9196 is about. 3. `view.rs:13372` — `PaneFocused` event, gated on `right_panel_open` already true. 4. `view.rs:13490` — `RepoChanged` event, gated on `right_panel_open` already true. 5. `view.rs:14458` — session env update, gated on `right_panel_open` already true. None of these need the `show_code_review_button` gate — they're either explicit user actions or gated on `right_panel_open` already being open. The toolbar button toggle continues to do its job at `render_header_toolbar_button` independently. ### Testing Reproduced @moirahuang's test locally on macOS 26.4.1 (Apple Silicon) against `WarpOss.app` built from this branch: 1. Settings → "Show code review button" → **OFF** 2. `echo "x" >> README.md` inside a git repo 3. Click the diff stats chip on the prompt (`+1 -0`) **Result:** Code review panel opens on the right showing the diff, while the toolbar button stays hidden — exactly the expected behaviour from issue warpdotdev#9196. Inverse case (toggle ON) also verified: toolbar button visible, panel still works the same. - `cargo fmt -p warp -- --check` passes. - `cargo nextest` skipped locally — Metal toolchain unavailable on my machine, mirroring warpdotdev#9277. CI will exercise the change. ### Server API No server changes. ### Agent Mode Not applicable. ### Changelog Entries `CHANGELOG-BUG-FIX`: The diff button on the terminal prompt now opens the code review panel even when the toolbar's "Show code review button" toggle is disabled (regression from a recent release). Co-authored-by: anshul-garg27 <[email protected]>
Cherry-picked from upstream: - fix: highlight C++ header extensions (warpdotdev#9388) - Run executable shell scripts in the terminal (warpdotdev#9503) - Revert schema generator binary recompilation fix (warpdotdev#9676) - Remove stray backticks from Windows installer README (warpdotdev#9691) - Fix chord shortcuts on Windows non-Latin keyboard layouts (warpdotdev#9476) - Scroll output with Page Up/Down from prompt (warpdotdev#9624) - Respect Markdown Viewer setting for .md links in AI rules/facts panel (warpdotdev#9699) - fix: disable reset grid checks for restored blocks on Windows (warpdotdev#9987) - add RedirectionGuard=no to windows-installer.iss (warpdotdev#9863) - Windows quake mode window correctly sized (warpdotdev#9891) - fix: update rand to 0.9.4 (GHSA-cq8v-f236-94qc) (warpdotdev#10060) - Fix diff button when Show code review button toggle is off (warpdotdev#9600) - Fix freshly cloned repo stuck in loading state (warpdotdev#9998) - Fix terminal text selection not auto-scrolling when dragging (warpdotdev#9448) - Resolve conflict markers from 3f0ac51 and edac651

Closes #9196.
Description
Two
show_code_review_buttongates were dropping panel-open requests on the floor when the user had hidden the toolbar button:1. Data-path gate at
Workspace::setup_code_review_panel(view.rs:7982)update_right_panel_open_statecalls into this whenever the right panel is being opened (chip click,Shift+Cmd+=keybinding, etc.), so the early return silently swallowed every explicit user action.2. Render-path gate at
Workspace::render_config_panelandrender_config_panel_maximized(view.rs:18981/19040)HeaderToolbarItemKind::is_availableforCodeReviewreturns*TabSettings::as_ref(app).show_code_review_button.value()(header_toolbar_item.rs:89). So even after fix #1 setpane_group.right_panel_open = trueandsetup_code_review_panelran, the next render frame sawis_available() == falseand returnedNone— theright_panel_viewwas never added to the layout.This second gate is what @moirahuang flagged when their local repro still showed nothing happening after the first fix landed. The data was correct; the panel was just never composed into the UI.
Fix
setup_code_review_panel. The setting is meant to gate only the toolbar button's visibility (already enforced correctly byheader_toolbar_item.rs::is_available, which feedsrender_header_toolbar_buttonatview.rs:17276).is_available→is_supported.is_available's own doc-comment says it's specifically "Whether this item should be shown in the toolbar — checks bothis_supportedand user show/hide preferences." Using it to gate panel rendering conflates two unrelated concerns. Panel rendering should only care about whether the feature is compiled in (is_supported), not whether the user has hidden the toolbar button.For
CodeReview,is_supportediscfg!(feature = "local_fs"). For the other variants in the same match (TabsPanel,ToolsPanel),is_availablealready equalsis_supported(default_ => truearm in the inner match), so behaviour is unchanged.AgentManagementandNotificationsMailboxreturnNoneunconditionally insiderender_config_panel, so the change is moot for them too.Caller audit for
setup_code_review_panel5 call sites in
view.rs:view.rs:3681—TransferredTabflow, only runs when the source tab already hadright_panel_open == true.view.rs:8136—update_right_panel_open_statewithshould_open == true. The diff-button path that terminal prompt: diff button no longer working when code review tool is disabled #9196 is about.view.rs:13372—PaneFocusedevent, gated onright_panel_openalready true.view.rs:13490—RepoChangedevent, gated onright_panel_openalready true.view.rs:14458— session env update, gated onright_panel_openalready true.None of these need the
show_code_review_buttongate — they're either explicit user actions or gated onright_panel_openalready being open. The toolbar button toggle continues to do its job atrender_header_toolbar_buttonindependently.Testing
Reproduced @moirahuang's test locally on macOS 26.4.1 (Apple Silicon) against
WarpOss.appbuilt from this branch:echo "x" >> README.mdinside a git repo+1 -0)Result: Code review panel opens on the right showing the diff, while the toolbar button stays hidden — exactly the expected behaviour from issue #9196. Inverse case (toggle ON) also verified: toolbar button visible, panel still works the same.
cargo fmt -p warp -- --checkpasses.cargo nextestskipped locally — Metal toolchain unavailable on my machine, mirroring Expand~inwarp://action/new_tab?path=URLs #9277. CI will exercise the change.Server API
No server changes.
Agent Mode
Not applicable.
Changelog Entries
CHANGELOG-BUG-FIX: The diff button on the terminal prompt now opens the code review panel even when the toolbar's "Show code review button" toggle is disabled (regression from a recent release).