Skip to content

test(support): narrow-frame helper compares with clientWidth, not innerWidth (#318) - #337

Merged
plainprogrammer merged 16 commits into
mainfrom
079-narrow-frame-honest-overflow
Nov 12, 2026
Merged

plainprogrammer merged 16 commits into
mainfrom
079-narrow-frame-honest-overflow

Conversation

@plainprogrammer

@plainprogrammer plainprogrammer commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Closes #318

What

The narrow-frame test helper reported "fits" as documentElement.scrollWidth <= innerWidth. innerWidth includes the frame's classic scrollbar (15px on a Mac, about 12px on CI, pinned in system specs by #271), so a page overflowing sideways by up to that much passed whenever the frame scrolled vertically. Spec 072's review found the trap; this closes it. Test support only: no app code, no page changes, so no screenshots.

Routing (ruled by the coordinator, 2026-11-12): a direct fix, no spec. The maintainer ruled the sweep of the same trap in the other specs (option A) part of this PR.

Changes (one commit each, red first where it applies)

  • spec/support/narrow_frame.rb: page_fits_sideways? is the one measure (scrollWidth <= clientWidth, for the page the driver is in), narrow_frame_fits? enters the frame and calls it, open_in_narrow_frame returns the same [innerWidth, fits] as before. open_in_viewport_frame(path, viewport:, ready:) opens a frame whose viewport is the width asked for (viewport + the measured scrollbar), as open_fold_in_frame does in the shape panel spec.
  • New spec/system/narrow_frame_spec.rb (4 examples): a 5px sideways overflow under a vertical scrollbar. Red on the old comparison (expected false, got true, preconditions asserted: scrollbar wider than 5px, overflow exactly 5px), green on clientWidth. The two later helpers were each red first (undefined method).
  • The same trap, 25 inline scrollWidth <= window.innerWidth checks and 4 element-edge right <= window.innerWidth checks across 21 spec files, swapped to the shared helpers or to clientWidth in place; nine specs' own fits?/frame_fits? methods deleted. footer_spec (the footer's right edge against the frame width minus the gutter) and three scanner_sitting_spec checks against the literal 360/390 were the same trap without the word innerWidth; the second review round found them.
  • Five examples went red with the honest measure, all the deck page at the 360px frame: deck_page_spec.rb x3 (AC-5.4/5.5 light and dark, and the zone-head one) and deck_shape_panel_spec.rb x2 (AC-5.1 light and dark). It is not a page bug and not the mana bar: a 360px frame with a classic scrollbar lays out in about 345px (348px on CI), and the zone table's worst-case row (60-character name, six-symbol cost, 1,234 proxies) is 355px wide there, 7 to 10px over. Spec 074 (decision 6, AC-1.15) recorded that this spill does not scroll the document at a true 360px viewport. They failed at 345px and pass at a true 360px viewport (open_in_viewport_frame); the 640, 768 and 1280px cases stay fixed frames. The edit in deck_shape_panel_spec.rb is minimal (Deck shape mana bar: a label wider than its segment wraps and is cut off #330 adds examples there).
  • Memory note .claude/memory/headless-firefox-narrow-frame.md updated; lesson docs/lessons/2026-11-12-sweep-a-measurement-trap-by-swapping-and-running-not-by-grep.md.

Evidence

  • Probe 1, helper only (a temporary edit, reverted): all 450 examples in the 40 system spec files that call open_in_narrow_frame passed with clientWidth, 0 failures, 3 min 25 s. Nothing was hiding behind the helper.
  • Probe 2, the 25 inline checks swapped (temporary, reverted): 17 files, 260 examples, 5 failures (above), 1 min 31 s.
  • After all commits, the 42 files that use the helper or changed: 458 examples, 0 failures, 3 min 32 s. After the second review round's fixes, footer_spec, scanner_sitting_spec, narrow_frame_spec, deck_page_spec: 58 examples, 0 failures.
  • GitHub CI on head ff8ddbfa (run 43234966773): all jobs pass, the four RSpec shards 1200 + 1109 + 1194 + 1037 = 4,540 examples, 0 failures, 2 pending. The pre-push full bin/ci passed on both pushes.
  • One flake, once, in the first full run of 452: menu_tab_bar_clearance_spec.rb:334 ("restores a page from Turbo's cache with every menu closed and the scroll it had", scroll_y 0 vs 498.75, seed 14592). It passed alone, and the whole file passed with the same seed (29 examples). This branch touches no app code and not that spec; recorded here, and as an issue only if it recurs.

Reviews (read-only, Opus)

  • Round 1 on the helper commits: APPROVE WITH CHANGES, 0 blocking, 1 major (the 27 inline checks with the same blind spot, which the maintainer then ruled in scope), 5 minor (YARD tags, platform scrollbar wording, the example opened the sign-up page, stale memory). All fixed.
  • Round 2 on the added diff: APPROVE WITH CHANGES, 0 blocking, 1 major (footer_spec gutter check, fixed), minors fixed (scanner leftovers, the viewport helper's contract in its comment, the example asserting the overflow is under the scrollbar, deck_page_spec header saying which 360px each group uses, memory note). Deferred until Deck shape mana bar: a label wider than its segment wraps and is cut off #330 merged, then done: open_fold_in_frame and open_phone_frame in deck_shape_panel_spec.rb repeated open_in_viewport_frame; after A mana bar label fits its segment or isn't drawn (spec 078, #330) #336 (spec 078) landed they call it (a small commit on the merged branch, deck_shape_panel_spec.rb and deck_page_spec.rb: 66 examples green, spec 078's included).

Merged main

origin/main (2780c1b4, #336 spec 078) merged into the branch with a merge commit, no conflicts; no new innerWidth check came in with it.

Owed to the maintainer

  • Spec 074 recorded the worst-case deck row's spill at a true 360px viewport only; it was not measured at 320px here, so a later spec that targets 320px phones should measure it first.

🤖 Generated with Claude Code

plainprogrammer and others added 16 commits November 12, 2026 08:18
…318)

Same measure (scrollWidth against innerWidth), now callable after a page in the
frame changes, so the next commit's example can overflow it by a few pixels.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…erWidth (#318)

innerWidth includes the frame's classic 15px scrollbar, so a page scrolling
sideways by up to that much passed whenever the frame scrolled vertically.
The new example overflows the sign-in page by 5px under a vertical scrollbar:
red on the old comparison (expected false, got true), green now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rollbar widths, sign-up page (#318)

Review fixes: YARD tags on open_in_narrow_frame and narrow_frame_fits?, the
scrollbar is about 12 to 15px by platform, the example opens the sign-up page
(first run redirects the sign-in page), and the memory note no longer lists the
trap as open.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…low (#318)

For the checks that run inside within_narrow_frame or on the top page. The
example was red (undefined method) before it; narrow_frame_fits? now enters
the frame and calls it, so the clientWidth comparison has one home.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…elpers (#318)

Their own fits? and frame_fits? compared scrollWidth with innerWidth, the trap
of the helper's fix. They now call page_fits_sideways? and narrow_frame_fits?.
91 examples green before and after: nothing was hiding in these files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ways? (#318)

Ten inline scrollWidth <= window.innerWidth expectations, same trap as the
helper's. 103 examples green before and after.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…Width (#318)

Six checks that sit in a script's result object, so they can't call the Ruby
helper, now read documentElement.clientWidth. 99 examples green before and after.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e's viewport (#318)

open_in_narrow_frame's width includes the classic scrollbar, so its 360px frame
lays a page out in about 345px. The new helper sizes the frame as the viewport
plus the measured scrollbar, as deck_shape_panel_spec's open_fold_in_frame does.
Its example was red (undefined method) first.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…0px viewport (#318)

fits? and two element-edge checks compared with innerWidth. With clientWidth, 3
examples failed at the 360px frame (AC-5.4/5.5 light and dark, and the zone
head one): the frame lays out in about 345px and the worst-case row's table
spills 10px past it, the spill spec 074 recorded at a true viewport. They now
open the frame as a 360px viewport (open_in_viewport_frame, 360 + measured
scrollbar) and pass, 29 examples. No page changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e 360px viewport (#318)

With clientWidth the AC-5.1 example failed at the 360px frame (light and dark):
the frame lays out in about 345px and the zone table's worst-case row spills
10px past it, not the mana bar. It now opens a 360px viewport
(open_in_viewport_frame) and passes, 29 examples. Minimal edit: #330 adds
examples to this file.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two element-edge checks (the title's and the sentence's right edge) read
window.innerWidth, the same blind spot as the overflow checks. 15 examples green.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…port, not the frame (#318)

footer_spec compared the footer text's right edge with the frame's width minus
the gutter, which includes the scrollbar (a variant of the trap that no
innerWidth grep finds): it now reads clientWidth. scanner_sitting_spec compared
scrollWidth with 360/390, the same weak copy: three checks call
page_fits_sideways?. 58 examples green across the four files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ck page's two 360px kinds, memory (#318)

The viewport helper's comment says the caller asserts the width it returns; its
example shows the overflow is under the scrollbar; deck_page_spec's header says
which 360px each group uses and the spill is 7 to 10px by platform; the memory
note names page_fits_sideways? and open_in_viewport_frame.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…unning (#318)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…318)

open_phone_frame and open_fold_in_frame repeated its scrollbar measuring; they
now call it and open the fold afterwards. Deferred until #330 (spec 078) merged,
as the PR said. deck_shape_panel_spec and deck_page_spec: 66 examples green.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@plainprogrammer
plainprogrammer marked this pull request as ready for review November 12, 2026 14:20
@plainprogrammer
plainprogrammer merged commit be0eec7 into main Nov 12, 2026
9 checks passed
@plainprogrammer
plainprogrammer deleted the 079-narrow-frame-honest-overflow branch November 12, 2026 14:21
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.

Narrow-frame helper misses overflow hidden by a scrollbar's width

1 participant