Repository navigation
fix(workspace): the rail's maximum comes from the viewport, not a constant (#2617) - #2649
Conversation
…stant (#2617) `RAIL_MAX = 560` was applied unconditionally, so the wider the display the SMALLER the share a person could give the column — about 22% of a 2560px screen. That is the opposite of what a resize handle is for, and it contradicted the file's own stated intent ("deliberately generous — this is a person arranging their own screen, not a layout that needs defending from them"), which an absolute pixel number cannot express. Operator report: "it does not go bigger than like 20% or something. I should be able to make it whatever I want, say half the screen width." The replacement bound was already in the file. `CONVERSATION_MIN` is the readable floor `fitsThreeColumns` already refuses to break, so a column may take everything left after its neighbour and that floor: railMaxFor(viewport, sidebar) = viewport - sidebar - CONVERSATION_MIN On 2560 with the default sidebar that is ~70% of the screen; on a laptop it is exactly what the old auto-collapse rule already permitted. One rule at both ends, rather than a constant that is generous at one width and restrictive at every other. Three details are load-bearing: * **Floored at the column's own minimum.** A ceiling below the floor inverts `Math.min(max, Math.max(min, px))` — it pins the column to the MAXIMUM and quietly breaks the floor the minimum exists to hold. On a viewport with no room for three columns the auto-collapse rule applies, not a negative ceiling. * **Desired width and effective width are two numbers (AC 4).** What is stored and dragged is what the person asked for; what the grid renders is `min(desired, derived max)`. A layout arranged on a 2560px monitor is clamped down for display on a laptop and comes back intact. Clamping at the persistence boundary instead would have written the laptop's ceiling over their choice on the first `commit()` — "silently discarded" wearing a clamp. * **`enforceFit` tests the EFFECTIVE widths.** Testing the desired one would collapse a rail that fits, purely because a wider one was once arranged on a bigger screen. Since the drag is now bounded by the same floor `fitsThreeColumns` asks about, a drag can no longer break the fit at all; what remains is the case that rule was written for. `SIDEBAR_MAX` got the same treatment (AC 7). Nobody had hit it, but leaving one derived and one fixed would leave the next reader guessing which rule this file follows. The ceilings are exposed as top-level computeds rather than folded back into `limits`, so `aria-valuemax` and `End` follow them: a ref nested inside a plain object is NOT auto-unwrapped in a template and `limits.rail.max` would have rendered `[object Object]`. `limits` no longer carries a `max` at all rather than carrying a stale number a caller could still read. Tests: `workspaceColumnMaxFromViewport.spec.js` (15) — the reported case at 1280 / 1440 / 2560, the exact derivation, monotonicity in viewport width, the inverted-clamp guard, an unmeasured viewport, that a clamped drag can never break the conversation floor at any width, and the AC-4 round trip (wide → laptop → wide). Two assertions in the ent#492 spec were rewritten: the ceiling is an argument now, and persistence floors rather than caps. Frontend suite: 113 files, 2530 tests, all passing; both ratchets green; build clean. Related to #2617 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Bd71qsYbFodvofba8P69eP
|
merge-train 2026-09-09: not on this train. Two findings in the changed lines, both verified against the source. 1. The comment directly above says the ceiling is measured against "what the rail is ACTUALLY taking", but 2. Both handles bind the desired width to Removing the The one-identifier fix for (1) changes rendered behaviour, and whether a drag from a clamped position should overwrite the stored desire (2) is a product call — so this goes back to you rather than getting patched on the train. Worth noting for both: no test instantiates Rides the next train once fixed. |
…ort the effective width (#2617) Two findings from review, both the same shape — a derived ceiling paired with the wrong width. 1. `sidebarMax` was measured against `effectiveRail`, which carries no `railOpen` term, so a COLLAPSED rail was still charged at its full open width. At a 1280px viewport the ceiling landed at 416 while 752 was genuinely free — below the `SIDEBAR_MAX = 480` constant this PR replaces, so AC 3 ("narrow windows are unchanged") regressed. It now reads `railWidth`, the width the rail actually renders: its effective width when open, the 48px strip when closed. `railWidth` moved above `sidebarMax` so the file still declares in dependency order; `railMax` still keys off the sidebar's DESIRE, so there is no cycle. 2. Both handles bound `:value` to the desired width while `:max` was the derived ceiling. That lets `aria-valuenow` exceed `aria-valuemax`, and `ColumnResizeHandle` takes `startValue = props.value` and clamps every `pointermove` — so on a laptop showing a layout arranged on a 2560px monitor the rail handle is inert for several hundred px of travel. They now bind `columns.effectiveSidebar` / `columns.effectiveRail`, which is what the two exported computeds were for. The desire survives untouched in storage and returns when there is room; a drag from a clamped position replaces it, which is the intended call — the person is moving the handle they can see. Tests: the composable is now DRIVEN rather than scanned. `effectScope` plus a stubbed `window` gives it a reactive owner (the two lifecycle hooks are the only thing it wanted a component for), and eleven cases execute the real computeds — the collapsed-rail ceiling, the no-regression floor, the open/close round trip, the three-column sum, desired-vs-effective on a narrow viewport, the ARIA relation, and a drag from a clamped position moving on pixel one while the desire-bound version stays pinned for 300+px. Three of them fail against the pre-fix `effectiveRail` wiring — verified by reverting the one identifier. The AC-4 test that shipped green recomputed its expectation from `railMaxFor` instead of reading what the composable derives, which is why (1) got through. 113 files / 2540 tests green; raw-colour scan unchanged. Related to #2617 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01RSjVEjay9ztC1oDXXkh9uN
|
Both fixed in 1. 2. Both handles bind Tests. You also called the mechanism: the AC-4 test recomputed its expectation from
|
|
Re-review after the fixes. Clean from me — I went looking for a third instance of the same class and did not find one. Specifically re-checked, because a ceiling that reads the wrong width is exactly the bug that shipped twice here:
The |
|
Deeper self re-review. No defect. Two things I had asserted in the first pass and have now actually driven, plus one honest limit.
The limit worth stating: this PR's tests drive Everything else from the earlier pass holds: |
vybe
left a comment
There was a problem hiding this comment.
validate-pr (Lane B): both merge-train findings verified fixed in 9efcd0a — sidebarMax reads railWidth (carries railOpen), handles bind effectiveSidebar/effectiveRail; composable is now driven via effectScope. Security greps clean; CI incl. vitest + e2e green; no overlap with the two dev-side Portal.vue commits since base. Body patched to Fixes #2617 so the issue auto-promotes.
RAIL_MAX = 560, applied unconditionally, meant the wider the display the smaller the share a person could give the column — about 22% of a 2560px screen.That is the opposite of what a resize handle is for, and it contradicted the file's own stated intent — "deliberately generous — this is a person arranging their own screen, not a layout that needs defending from them" — which an absolute pixel number cannot express at more than one width.
The bound that replaces it was already in the file
CONVERSATION_MINis the readable floorfitsThreeColumnsalready refuses to break. So a column may take everything left after its neighbour and that floor:On 2560 with the default sidebar that is ~70% of the screen; on a laptop it is exactly what the auto-collapse rule already permitted. One rule at both ends, rather than a constant that is generous at one width and restrictive at every other.
Three details that are load-bearing
Math.min(max, Math.max(min, px))— it pins the column to the maximum and quietly breaks the floor the minimum exists to hold. On a viewport with no room for three columns the auto-collapse rule applies, not a negative ceiling.min(desired, derived max). So a layout arranged on a 2560px monitor is clamped down for display on a laptop and comes back intact. Clamping at the persistence boundary instead would have written the laptop's ceiling over their choice on the firstcommit()— "silently discarded" wearing a clamp, which is the failure mode the AC names.enforceFittests the EFFECTIVE widths. Testing the desired one would collapse a rail that fits, purely because a wider one was once arranged on a bigger screen. And since the drag is now bounded by the same floorfitsThreeColumnsasks about, a drag can no longer break the fit at all — what remains for auto-collapse is exactly the case it was written for: a window too narrow for three columns at their minima.Acceptance criteria
fitsThreeColumns→enforceFitstill fires before it is squeezed.railMax/sidebarMaxare what the handles receive, soEndandaria-valuemaxfollow the derived value and update on window resize.MESSAGE_MAX, untouched.SIDEBAR_MAXreviewed and given the same treatment (AC 7) — nobody had hit it, but leaving one derived and one fixed would leave the next reader guessing which rule this file follows.fitsThreeColumnstests stay green.A trap worth naming for review
The ceilings are exposed as top-level computeds, not folded back into
limits. A ref nested inside a plain object is not auto-unwrapped in a template, so:max="columns.limits.rail.max"would have rendered[object Object]intoaria-valuemax— silently, since nothing type-checks an ARIA attribute.limitsnow carries nomaxat all rather than a stale number a caller could still read and believe.Verification
workspaceColumnMaxFromViewport.spec.js— 15 passed: the reported case, the exact derivation at four widths, monotonicity in viewport width, the neighbour trade-off, the inverted-clamp guard, an unmeasured viewport (0/null/NaN/a string), that a clamped drag can never break the conversation floor at any width, the sidebar's parity, and the AC-4 round trip (arranged at 2560 → clamped on a laptop → restored at 2560).workspaceColumnResize.spec.js— two assertions rewritten, not deleted: the ceiling is an argument now, and persistence floors rather than caps. Both rewrites say why in place.vite buildclean.RAIL_MAX,SIDEBAR_MAXorlimits.*.maxsurvives outside the comments that explain their removal.What I could not check
No browser here, so the feel of dragging to 70% of a 2560px screen is unverified — the arithmetic, the clamp behaviour and the wiring are. The
aria-valuemaxtrap above is the reason I would still want one pass with a real handle in hand.Fixes #2617
🤖 Generated with Claude Code
https://claude.ai/code/session_01Bd71qsYbFodvofba8P69eP