Skip to content

Fix PopOut dashboard collapsing to its minimum size (SOU-222)#37

Merged
tsouth89 merged 2 commits into
mainfrom
tsouth2/sou-222-popout-collapse
Jul 16, 2026
Merged

Fix PopOut dashboard collapsing to its minimum size (SOU-222)#37
tsouth89 merged 2 commits into
mainfrom
tsouth2/sou-222-popout-collapse

Conversation

@tsouth89

@tsouth89 tsouth89 commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Fixes SOU-222.

Problem

The main dashboard (PopOut) reopened at exactly its 520x400 minimum instead of the 720x560 default, on every launch (reported in 0.43.3: tiny/hard-to-find window, felt non-resizable). Evidence: window_geometry.json had popOut saved at exactly the minimum.

Root cause

A self-reinforcing collapse:

  1. capped_logical_size capped the window to the monitor work area, flooring only to 320x240 — on a transient/incorrect monitor read it could cap below PopOut's 520x400 minimum.
  2. set_size then requested a sub-minimum size; the OS + set_min_size clamped it back up to 520x400.
  3. That clamp fired a resize event, and remember_current_geometry_if_eligible persisted the clamped minimum as if the user had resized — so it reopened tiny forever.

Fix

  1. Don't persist the app's own programmatic sizing. New AppState::suppress_geometry_capture_until: apply_window_layout arms a 750 ms suppression right before its set_size, and the window-event save path skips while it's active. The app's open/transition layout can no longer be mistaken for a user drag. (This is the core fix — even a transient collapse is never persisted.)
  2. Cap never drops below the minimum. Extracted a pure cap_to_available helper; the work-area cap floors to the window's own min_width/min_height (320x240 baseline for min-less modes). No sub-minimum set_size -> no OS clamp -> nothing to mis-persist.

Tests

  • cap_to_available: floors to the minimum on a tiny work area, applies the available size between min and requested, keeps the requested size when it fits, and keeps the 320x240 baseline for min-less modes.
  • AppState geometry-capture suppression arms and expires correctly.
  • Full crate suite green (370 passed), clippy -D warnings clean, fmt --check clean.

Note: couldn't reproduce the GUI end-to-end headlessly; logic + unit tests verified. The "can't resize" secondary note in the issue (borderless hit-testing) is left for follow-up — at the restored default size the window resizes fine.

Summary by CodeRabbit

  • Bug Fixes

    • Prevented automatic window transitions from overwriting users’ saved window position and size.
    • Improved window sizing when restoring or displaying the desktop app.
    • Preserved configured minimum window dimensions while fitting windows to the available screen area.
  • Tests

    • Added coverage for window sizing limits and temporary geometry-capture suppression.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ceiling ea8ecca Commit Preview URL

Branch Preview URL
Jul 16 2026, 10:25 PM

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Programmatic window restoration now suppresses temporary geometry persistence. Window sizing also respects configured minimum dimensions while capping to monitor work areas, with tests covering suppression expiry and sizing floors.

Changes

Geometry capture and sizing

Layer / File(s) Summary
Geometry suppression state
apps/desktop-tauri/src-tauri/src/state.rs
AppState tracks a timed suppression window, exposes methods to arm and query it, initializes it as inactive, and tests its expiry behavior.
Window restoration sizing
apps/desktop-tauri/src-tauri/src/shell/window.rs
Visible-window restoration arms suppression before programmatic size and position updates; logical sizing now honors configured minimums, work-area limits, and 320×240 defaults, with unit tests for these cases.
Persistence guard
apps/desktop-tauri/src-tauri/src/shell/position.rs
Geometry persistence exits before saving when capture suppression is active.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: finesssee

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing the PopOut dashboard’s minimum-size collapse issue in SOU-222.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tsouth2/sou-222-popout-collapse

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/desktop-tauri/src-tauri/src/shell/window.rs (1)

150-201: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make cap_to_available enforce its lower-bound contract.

For example, (width, height) = (100, 100) with minima (520, 400) returns (100, 100), because the current code only caps the upper bound. Add .max(floor) to each result and a regression test for requested sizes below the minimum.

Also applies to: 318-358

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop-tauri/src-tauri/src/shell/window.rs` around lines 150 - 201, The
cap_to_available function currently enforces only upper bounds and can return
sizes below the configured minimums. Update each returned dimension to clamp
between its corresponding minimum floor and computed maximum, while preserving
the 320x240 fallback floors for absent minima; add a regression test covering
requested dimensions below configured minima.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/desktop-tauri/src-tauri/src/shell/window.rs`:
- Around line 89-105: Move the geometry-capture suppression setup in the window
sizing flow so it runs after logical_size_from_geometry and capped_logical_size
have computed the final dimensions, immediately before set_size. Keep the
existing 750ms deadline and AppState locking behavior, ensuring the guard covers
the geometry mutation rather than the preceding load, monitor lookup, and
capping work.

---

Outside diff comments:
In `@apps/desktop-tauri/src-tauri/src/shell/window.rs`:
- Around line 150-201: The cap_to_available function currently enforces only
upper bounds and can return sizes below the configured minimums. Update each
returned dimension to clamp between its corresponding minimum floor and computed
maximum, while preserving the 320x240 fallback floors for absent minima; add a
regression test covering requested dimensions below configured minima.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 68753ed8-409a-4120-a1d5-d47d2e0bd3a8

📥 Commits

Reviewing files that changed from the base of the PR and between dfc0dec and 06af7eb.

📒 Files selected for processing (3)
  • apps/desktop-tauri/src-tauri/src/shell/position.rs
  • apps/desktop-tauri/src-tauri/src/shell/window.rs
  • apps/desktop-tauri/src-tauri/src/state.rs

Comment thread apps/desktop-tauri/src-tauri/src/shell/window.rs Outdated
@tsouth89
tsouth89 merged commit 39028b2 into main Jul 16, 2026
5 checks passed
@tsouth89
tsouth89 deleted the tsouth2/sou-222-popout-collapse branch July 16, 2026 22:29
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.

1 participant