Repository navigation
fix(cmux-tui-core): set-layout-sizes takes a value only as exactly one pair and refuses a non-finite ratio; tests and docs (#34928 review follow-ups) - #35261
Conversation
… and a non-finite ratio; covers the ratio arm, two screens, a no-op batch, one layout event and the capability (#34928 review follow-ups, red) Red: a value with both a ratio and a width decodes as a ratio and drops the width (review A); a NaN or infinite ratio is committed in-process (review B). The rest pins behavior that is right already (review C): a_ratio_value_uses_the_widths_the_batch_set_before_it, values_on_two_screens_are_refused_whole, a_batch_of_the_current_sizes_commits_nothing, a_batch_sends_one_layout_changed_event, identify_advertises_the_layout_sizes_batch.
…tly one pair and a non-finite ratio; its wire type moves to cmd_panes (#34928 review follow-ups) - Review A: LayoutSizeWire's variants are newtypes over two structs with deny_unknown_fields, so a value with both {split, ratio} and {pane, width} (or any other field) is refused, not decoded as a ratio with the width dropped. - Review B: a NaN or infinite ratio is refused in-process (LayoutSizesError::NonFiniteRatio, invalid-argument), as the single command refuses it; the clamp keeps a NaN. - Review D: events.md lists set-layout-sizes among the commands whose transaction layout-changed echoes; commands.md states the strict value shape. (DESIGN 2.10.1 already names layout-sizes-other-screen.) - Review E: LayoutSizeWire and its From impl move from server.rs to server/cmd_panes.rs (server.rs 3022 -> 3006 lines; still over its warn-only ceiling of 2978). The Command field keeps the name, so check-sdk-schema.py maps it as before; generate.py --check and check-sdk-schema.py pass. Tests (red at efe6dbf): set_layout_sizes_applies_a_trade_whole_or_refuses_it_whole (the both-pairs case), a_non_finite_ratio_is_refused_and_changes_nothing.
…34928 review B, on the path it named) a_non_finite_ratio_is_refused_and_changes_nothing used a column split, where the implied width already refuses a NaN, so it passed before the fix. A tree split takes the ratio as it is: this is the path the review named.
|
Found 11 test failures on Blacksmith runners: Failures
...and 1 more test failures. View all on Blacksmith
|
|
Review (claude-reviewer-rds-batch): SHIP at c7b0434 No defect must be fixed before merge. The four findings below are should-do. I read the full diff at the head, the serde 1.0.229 and serde_derive 1.0.229 code that these derives expand to (the versions in Verified
Findings (all should-do)
Observed / Not run
|
…ps an infinite ratio as set-split-ratio does; the event echoes its transaction (#35261 review, red) Red at c7b0434: the newtype-over-struct LayoutSizeWire accepts [split, ratio] (serde gives a plain struct a sequence form; untagged struct variants have none), and NonFiniteRatio refuses an infinite ratio that set-split-ratio clamps to 0.95 (JSON 1e39 reads as f32 infinity). Also: a ratio value on the wire, the bad-request shape of a refused value, the layout-changed event's transaction echo.
…nts with deny_unknown_fields; only a NaN ratio is refused (#35261 review) - Review 1: back to struct variants, with #[serde(untagged, deny_unknown_fields)] on the enum: a value with both pairs or another field is still refused, and an array value is refused again (serde gives untagged struct variants no sequence form; the newtype structs had one). - Review 2: an infinite ratio clamps to 0.95 as set-split-ratio clamps it ('same clamping and ranges' in commands.md). Only a NaN is refused (LayoutSizesError::NanRatio, invalid-argument): in-process callers only, the clamp keeps a NaN and the store cannot persist one (before, the batch answered layout-sizes-not-persisted). - The tests match the variant (NanRatio) where they only matched an index. Tests (red at 20f0fa4): set_layout_sizes_applies_a_trade_whole_or_refuses_it_whole (the array case), a_nan_ratio_on_a_tree_split_is_refused_and_an_infinite_one_clamps.
|
Review (claude-reviewer-rds-batch): SHIP at d64337c This is a review of the push after my SHIP at c7b0434. I read Verified
Observed / Not run |
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Summary
Follow-ups from the review of #34928 (
set-layout-sizes, merged), points A to E of "Review (claude-reviewer-rds-batch): SHIP at ca012e6". No app path sends the command yet (STATUS 11385), so nothing a person sees changes.LayoutSizeWirekeeps its two struct variants, now with#[serde(untagged, deny_unknown_fields)]on the enum. A value with both{split, ratio}and{pane, width}, or with any other field, is refused as a malformed request (bad request: ..., noerror_code). Before, it decoded as a ratio, and the width was dropped silently, so the command answeredok:truefor a half-applied value. An array value stays refused: serde gives untagged struct variants no sequence form. (My first version used newtypes over structs, which accept arrays; the review found it.)Mux::set_layout_sizes_in_transaction_checked_aswith a NaN ratio gotlayout-sizes-not-persisted(the clamp keeps a NaN, and the store cannot persist one; JSON cannot carry a NaN). Now it getsLayoutSizesError::NanRatio(invalid-argument). An infinite ratio (JSON1e39reads as f32 infinity) clamps to 0.95, asset-split-ratioclamps it, which keeps commands.md's "same clamping and ranges". (My first version refused infinity too; the review found it.)layout-changedevent with the transaction echo, the capability in identify, a ratio value on the wire, and the refused shapes (both pairs, an array) with theirbad requesterror.events.mdlistsset-layout-sizesamong the commands whosetransactionthelayout-changedevent echoes.commands.mdstates the strict value shape.LayoutSizeWireand itsFromimpl move fromserver.rstoserver/cmd_panes.rs(server.rs 3022 -> 3006 lines; still over its warn-only ceiling of 2978). TheCommandfield keeps the type name, socheck-sdk-schema.pymaps it as before.Testing
Focused commands:
./scripts/verify-cmux-tui-hosted.sh --filter layout_sizesand--filter a_non_finite_ratio_on_a_tree_split_is_refused(Linuxtest (linux)).Red at efe6dbf (
test/rds-batch-followups-red-never-merge), run https://github.com/manaflow-ai/cmux/actions/runs/41810867146:set_layout_sizes_applies_a_trade_whole_or_refuses_it_wholeFAILED (the both-pairs value was taken); 10 other tests passed.My first NaN test used a column split, where the implied-width check already refuses a NaN, so it passed before the fix and proved nothing. The tree-split test covers the path the review named: red at b19c850, run https://github.com/manaflow-ai/cmux/actions/runs/41813144619 FAILED; green at c7b0434, run https://github.com/manaflow-ai/cmux/actions/runs/41813156656.
Review of this PR (SHIP at c7b0434 with should-dos): red at 20f0fa4 (
test/rds-batch-r2-red-never-merge; the array value accepted, an infinite ratio refused), run https://github.com/manaflow-ai/cmux/actions/runs/41821943619; fix at d80a3c7, run https://github.com/manaflow-ai/cmux/actions/runs/41821947239 (--filter layout_).Green at 6002a22: runs https://github.com/manaflow-ai/cmux/actions/runs/41811365643 (
layout_sizes, 11 passed), https://github.com/manaflow-ai/cmux/actions/runs/41811373538 (the wire test), https://github.com/manaflow-ai/cmux/actions/runs/41811381409 (the capability test).python3 cmux-tui/scripts/check-sdk-schema.py: ok (290 commands).PATH=/usr/local/go/bin:$PATH python3 cmux-tui/bindings/codegen/generate.py --check: ok.At the head d64337c (feat e8ff27a merged so that
lint (linux)reaches this PR's crate; own-diff patch-id f97e5f1b4150 unchanged): run https://github.com/manaflow-ai/cmux/actions/runs/41825913708 (--filter layout):test (linux)passed, witha_nan_ratio_on_a_tree_split_is_refused_and_an_infinite_one_clampsandset_layout_sizes_applies_a_trade_whole_or_refuses_it_whole;lint (linux)passed.Compile: fleet job ccc2b1a688d28cedf0989108 at the head d64337c: CmuxNext, app and cmux-tui passed (also 3d21132e0b1438b79e4e91d9 at d80a3c7 and 6817893c5323186f269cdb2d at 6002a22).
Observed / Not run
lint (linux)passed. Before the feat merge it was red only on base findings:cmux-cloud-environment/src/lib.rs:262(from feat(cloud): select NEXT backend at runtime in Rust #35133, fixed on feat by cmux-cloud-environment: collapse nested if (clippy base red) #35222) and the panic ratchetcmux-tuiindexing_slicing 841 > 831 (all hits incrates/cmux-tui/src).clippy (changed cmux-tui packages)is red oncrates/cmux-tui/src/cloud_environment.rs:22(base); it checked cmux-tui-core with no error.Changelog
none
Proof
No capture: daemon command only; no app path sends it yet.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Implements the review follow-ups for
set-layout-sizesfrom #34928 and #35261: a value must be exactly one pair, and a non-finite ratio is refused. No app path sends the command yet, so nothing a person sees changes.{split, ratio}and{pane, width}, any other field, or an array is refused as malformed; previously it decoded as a ratio and silently dropped other fields.LayoutSizesError::NanRatio(invalid-argument) for a NaN ratio; an infinite ratio clamps to 0.95, matchingset-split-ratio.LayoutSizeWiremoves fromserver.rstoserver/cmd_panes.rs.commands.mddocuments the strict value shape andevents.mdlistsset-layout-sizesamong commands whosetransactionthelayout-changedevent echoes.Written for commit d64337c. Summary will update on new commits.