Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3772ca1bbe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Star Lord reviewed 3772ca1. Please fix the Close/Force Quit issue below and the existing finding on cached normal geometry. This was a source review, and both paths still need verification on mixed-DPI hardware.
kalvinnchau
left a comment
There was a problem hiding this comment.
🤖 Two remaining concerns: position/size scale pairing and regression coverage of persistence wiring.
2142c2d to
558c0f9
Compare
kalvinnchau
left a comment
There was a problem hiding this comment.
🤖 The earlier position-scale reproduction now passes. Two P3 follow-ups remain: production restore-path coverage and the documented persistence contract. Native mixed-DPI behavior remains unverified.
558c0f9 to
2895c15
Compare
kalvinnchau
left a comment
There was a problem hiding this comment.
🤖 The prior restore-conversion coverage and documentation findings are addressed. One P3 remains: the mixed-scale test assumes logical units on Windows.
kalvinnchau
left a comment
There was a problem hiding this comment.
🤖 Approved at 2895c15.
The per-field scale tracking addresses the earlier cached position/size mismatch in source and model checks. The persisted-state reproduction now restores the expected position and size. Restore conversion runs through the tested production planner, and removing that conversion now fails the regression test. The persistence documentation also matches the implementation. No actionable security issue was identified.
The 25 window_state tests pass on macOS. One test-only P3 remains: the mixed-scale test expects logical units even on Windows, where restore deliberately uses physical units (#4112 (comment)). Gate that assertion or check the Windows physical result.
Native mixed-DPI quit/onboarding behavior and AppKit event ordering remain unverified; the full-package suite and native Linux/Windows runs were not performed. The possible dispatch-time scale mismatch remains a hypothesis, not a demonstrated runtime defect.
jedwards27
left a comment
There was a problem hiding this comment.
🤖 :bot: Jude’s code review agent
Verdict: COMMENT — recommend request changes at base 6ba83fa6a2bb73c6cf03c25a3ef3a74f883fc4c8, head 85ddde07e739c8130012abaf6c4e737af7960c65. Risk: high — native window geometry and paired persistence across launches.
Blocking finding (P2): stale scale metadata can corrupt restored geometry. src-tauri/src/lib.rs:1391–1394 saves the plugin's geometry file before Buzz writes .window-scale.json (src-tauri/src/window_state.rs:181–199). But restore_input accepts any syntactically valid scale file alongside any saved geometry (window_state.rs:300–315), and restore_plan uses that scale to convert size and position (window_state.rs:389–425). After a previous app version overwrites only the geometry file on a 1× monitor, or the process exits between these two writes, a surviving 2× scale is applied to fresh 1× pixels. A 1200×750-pixel saved window is requested as 600×375 logical points on re-upgrade—precisely the size-loss class this PR fixes. The PR description acknowledges the downgrade path. Author action: bind the sidecar to the exact geometry snapshot and fall back to legacy restore when the pair does not match; add a regression that overwrites only the geometry file and verifies both downgrade/re-upgrade and interrupted-save recovery. A digest of the geometry is one possible binding; ensure the check covers the file actually consumed on restore.
Other paths reviewed: per-field scale provenance for size/current/previous positions, onboarding snapshot selection, legacy fallback, and reachable-header relocation. No additional actionable UI/accessibility defect found. The pinned plugin ignores move/resize events while its restore lock is held, whereas Buzz's scale listener does not (window_state.rs:137–169); whether this creates a real AppKit ordering mismatch is unproven, not a second blocker. Inspect with a native maximized/reopen journey if possible.
Verification owner: author for stale-pair fix and fail-before/pass-after regression; reviewer/tooling for exact-head native mixed-DPI verification and the restore-event-order question. Validation: clean detached checkout at 85ddde07e739c8130012abaf6c4e737af7960c65; git diff --check 6ba83fa6a2bb73c6cf03c25a3ef3a74f883fc4c8...HEAD passed. CI required at this head passed on attempt 2, including its Linux Rust tests; Windows native validation was skipped. An independent macOS cargo test -p Buzz --lib window_state attempt timed out during cold compilation before tests ran. Manual/native evidence: no exact-head 2×/1× app journey performed. Residual risk: source/model checks and CI do not establish AppKit monitor-coordinate behavior. Run the 2×→1× and reverse quit/relaunch journey, close/hide→force-quit, disconnected display, and maximize/unmaximize with isolated app identity before merge.
85ddde0 to
91252a0
Compare
|
🤖 Thanks for the review. The P2 is fixed in 91252a0: On the restore lock: Buzz now ignores |
tauri-plugin-window-state saves physical pixels with no scale, and the reachable path sent them as physical, so macOS converted them at the startup screen's scale: a window saved on a 2x laptop reopened at double size when Buzz started on a 1x external, and the reverse halved it. Buzz now records the main window's scale in .window-scale.json next to the plugin's file at every plugin save (Exit, CloseRequested, and the onboarding preserve path, whose snapshot gets its own copy). On macOS and Linux, a recorded scale measures the monitors in the saved pixels and sends the result in logical units. State saved without a scale restores exactly as before. Windows is unchanged. Fixes #3083 Co-authored-by: mbot <3754f8729004d95654c46dbab3129e4ab9ef05cc2534e2a3fbfc155983bd637b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
While the window is maximized or minimized, tauri-plugin-window-state keeps the normal frame it cached earlier instead of saving the current one. Writing the current scale then paired that frame with another screen's scale, for example a window maximized on a 2x laptop, dragged to a 1x external and quit. Skip the scale write under the plugin's own condition, and give the onboarding snapshot a copy of the scale file paired with the plugin file it copies. Co-authored-by: mbot <3754f8729004d95654c46dbab3129e4ab9ef05cc2534e2a3fbfc155983bd637b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On CloseRequested the window-state plugin only updates its in-memory frame; its file is written at Exit or by our onboarding save. Writing the scale at close let a close followed by a crash or Force Quit pair the old geometry on disk with the new scale. Close now keeps the scale in memory, under the same maximized/minimized rule. Exit writes the window's current scale, or the kept one when the window is gone or its frame is kept, and nothing when neither exists. Co-authored-by: mbot <3754f8729004d95654c46dbab3129e4ab9ef05cc2534e2a3fbfc155983bd637b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rame tauri-plugin-window-state also updates its cached size on every Resized event while the window isn't maximized or minimized. Dragging a window from a 2x screen to a 1x one, maximizing and quitting left 1x pixels in its file beside the earlier 2x scale. The kept scale now starts from the scale file, as the plugin's cache starts from its file, and follows each cache update under the plugin's own condition: Resized (with its macOS decorated/resizable quirk), CloseRequested and Exit. Exit and onboarding write the kept scale if there is one, and nothing otherwise. Co-authored-by: mbot <3754f8729004d95654c46dbab3129e4ab9ef05cc2534e2a3fbfc155983bd637b@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The window-state plugin updates its cached position on Moved and its size on Resized, so a drag to another scale without a Resized leaves the two at different scales. Buzz now keeps a scale for the size, the position and the previous position (prev_x/prev_y), following the plugin's rules for each event, and restore converts each position from its own scale. The event mapping, the cache rules and the choice between the onboarding snapshot and the live files are now small functions with tests. Co-authored-by: Orbit Helper <0f7edbd528cce2e9ea41a9310dfea0c84e0f5f04c60551b7c3e657f8033a4a39@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… scales Restore now plans through one entry point, `restore_plan`, which converts the saved positions to the size's scale and builds the request. The mixed-scale tests read the files with `restore_input` and plan with `restore_plan`, so dropping the conversion from the restore path fails them. docs/shell-design.md now describes the scale file, the onboarding copy and the behaviour without a scale file. Co-authored-by: Orbit Helper <0f7edbd528cce2e9ea41a9310dfea0c84e0f5f04c60551b7c3e657f8033a4a39@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows restores in physical pixels and ignores recorded scales, so restore_plan returns no logical scale there and the test's expect would panic on the windows-native job. Co-authored-by: Orbit Helper <0f7edbd528cce2e9ea41a9310dfea0c84e0f5f04c60551b7c3e657f8033a4a39@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scale file now records the geometry it belongs to. Restore, and the scales Buzz keeps at launch, use it only when that matches the geometry file being restored, so a geometry file written without its scales (by an older build, or an exit cut short between the two writes) restores as it did before scales, instead of taking a stale scale. Buzz also ignores Moved and Resized while the plugin's restore_state runs, as the plugin does under its restore lock. Co-authored-by: Orbit Helper <0f7edbd528cce2e9ea41a9310dfea0c84e0f5f04c60551b7c3e657f8033a4a39@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
91252a0 to
06d1c0a
Compare
Why
Fixes #3083. On a Mac with a 2x laptop and a 1x external, the window reopens at double or half size when Buzz quits on one screen and starts on the other. Both monitors stay attached. The window then saves that wrong size for the next launch.
tauri-plugin-window-state saves physical pixels with no scale. When the saved rect is reachable,
restore_geometry_fromsends those pixels as physical, and macOS converts them at the scale of the screen the new window starts on, not the one it was saved on.Supersedes #2732.
What
Buzz records the scale factors of the plugin's saved size and position every time the plugin saves, and restores at those scales. The plugin stays the only writer of
.window-state.json. Buzz writes{"main": {"scale": 2.0, "position": 1.0, "prev": 2.0}}to its own.window-scale.jsonbeside it:scaleis the size's,positionis the saved x/y's, andprevis prev_x/prev_y's (the normal origin of a maximized window). A file with onlyscalereads the positions at that scale.How
.window-scale.jsonat launch, as the plugin's cache starts from its file.Moved(unless minimized) sets the position's scale, and the old one becomesprev, as the plugin moves x/y into prev_x/prev_y.Resized(unless minimized or maximized, with the plugin's macOS decorated/resizable quirk) sets the size's.CloseRequestedand Exit (unless minimized or maximized) set both.window_state::window_eventmaps window events to those updates;Kept::applyholds the rules.RunEvent::Exit, after the plugin's save, and inonboarding_preserve_window, Buzz writes the kept scales if it has the size's, and nothing otherwise. The onboarding snapshot gets a copy of the scale file,onboarding-window-scale.json. The onboarding restore uses that copy, then removes it.restore_inputpicks the onboarding snapshot and its scale copy while one is pending, else the plugin's file and.window-scale.json.restore_planconverts each saved position from its own scale to the size's pixels (at_size_scale), thenrestore_requestmeasures every monitor's work area, the fallback, the 48-point header and the client offset in the saved scale's pixels. It then runs the existing reachability check and sends the result as logical units at that scale, whether the rect is reachable or relocated. Measuring the monitors in the saved scale matters too: otherwise a rect saved on a 1x external that's now unplugged can fall inside a 2x laptop's physical rect, count as reachable, and open off-screen. The rule that treats a size below the minimum as saved at a lower scale is skipped here, because the scale is known.main.The issue's option 1 (guessing the scale from the monitor that contains the header) isn't included. In the reporter's layout the laptop's and the external's physical rects overlap, so that guess can be wrong.
Risk
main.Testing
cargo test -p Buzz --lib window_state: 25 pass. New tests:main.restore_inputand planned withrestore_planas restore does: a 2x size with its position moved to (2212, -200) points on the 1x external comes back there at 1200x750 points, and a maximized window's prev origin uses prev's scale.Resized, then a minimized quit, keeps a 2x size and a 1x position; maximizing moves the normal origin's scale into prev; saves never touch prev.window_event(other windows and other events are ignored), events alone never write the file, and Exit writes the scales of the plugin's save.restore_inputreads the onboarding snapshot with its own scale copy while it's pending, else the live pair.restore_stateholds its restore lock, Buzz ignoresMovedandResizedtoo.Moved, skipping the position conversion in the restore path, ignoring the recorded scale in the restore path, onboarding reading the live scale file, Close not reading the position, andMovedupdating while minimized. Removing the one-linewindow_eventcall inlib.rsisn't caught by a test.cargo clippy -p Buzz --all-targets -- -D warningsis clean.cargo test -p Buzz: 1261 pass. 2-3host_commandprocess tests fail locally, a different set each run. They don't touch window code.In-app check
This needs a 2x laptop with a 1x external still attached (Josh Friend has this setup).
🤖 Generated with Claude Code