Commit 7b6a05c
feat: content-aware column widths, width estimation tests, and screenshot comparison infra (#606)
* feat: add StylingIssues stories and before/after screenshot CI
- 16 Storybook stories reproducing #587, #595-#597, #599-#602
- Playwright spec capturing screenshots with SCREENSHOT_DIR env var
- CI job StylingScreenshots: captures after (current) + before (b7956f8)
via git worktree, uploads as two named artifacts
- download_styling_screenshots.sh: fetch artifacts via gh CLI
- gen_screenshot_compare.py: self-contained before/after HTML viewer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: correct story IDs in spec + remove spurious f-string prefixes
- Fix Storybook story IDs: export names go through startCase() before
slugifying, so FewCols_ShortHdr_ShortData → few-cols-short-hdr-short-data
- Remove extraneous f-string prefixes in gen_screenshot_compare.py (ruff F541)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: kill storybook between after/before screenshot captures
The reuseExistingServer:true in playwright config caused the "before"
screenshots to be captured against the still-running "after" storybook,
making all screenshots identical.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: redesign screenshot compare viewer with sidebar nav and zoom/pan
Left sidebar (20%) with story list and keyboard navigation (j/k/arrows).
Detail view with stacked before/after images, zoom slider (50-500%),
and pan X/Y controls that apply to both images simultaneously.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Revert "fix: kill storybook between after/before screenshot captures"
This reverts commit 4047c0c.
* simplify StylingScreenshots CI job — single artifact per branch
Remove the broken worktree-based before/after approach. Each branch
just captures its own screenshots and uploads one artifact. Compare
by running CI on two separate branches.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: checkout PR head SHA for screenshots, not merge ref
GitHub PR events checkout a merge of PR+base, so the baseline branch
was getting main's fixes merged in. Use head.sha to get the actual
branch code. Also use --no-frozen-lockfile for older branches.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: scroll grid body in pinned-index screenshots to expose #587
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: pierce shadow DOM for pinned-index scroll in screenshots
The AG-Grid is inside a Shadow DOM wrapper, so page.locator can't
find .ag-body-viewport. Use page.evaluate to access shadowRoot.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: walk all shadow roots to find ag-body-viewport for scroll
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use long headers in pinned stories so grid requires horizontal scroll
C13/C14/D15 had short headers that fit in 800px with no scrollbar.
Use long headers + scroll to scrollWidth to expose #587 alignment bug.
Also simplified scroll code — Playwright locators pierce shadow DOM.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* debug: add scroll logging for pinned-index screenshots
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use 400px container for pinned stories to force horizontal scroll
fitCellContents was shrinking all columns to fit 800px viewport
(scrollWidth == clientWidth). Narrower container forces overflow
so the scroll-right in the spec actually works.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add minWidth:120 via ag_grid_specs on pinned stories to force overflow
fitCellContents shrinks all columns to fit container regardless of
defaultMinWidth. Explicit minWidth on ColDef forces horizontal scroll.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use keyboard End key to scroll pinned stories to rightmost column
AG-Grid fitCellContents prevents programmatic scroll (scrollWidth==clientWidth).
Click a cell then press End to let AG-Grid handle navigation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add A9 story for #595 — many cols, long headers, year-like data
15 cols with long headers (revenue_total, etc.) and 4-digit year values.
Without defaultMinWidth, fitCellContents crushes columns to data width
(~35px), truncating headers. With the fix, columns get min 80px.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: A9 story — 25 long cols in 400px to force data truncation (#595)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: A9 — force maxWidth:50 on columns to reproduce #595 truncation
fitCellContents never crushes columns, so use ag_grid_specs maxWidth
to cap columns at 50px. 7-digit data should show "..." truncation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add defaultColDef.minWidth:80 to prevent column truncation (#595)
- Set minWidth:80 on defaultColDef so AG-Grid enforces a minimum column
width regardless of auto-size strategy
- Remove broken defaultMinWidth on fitCellContents (that property only
exists on fitGridWidth strategy and was silently ignored)
- Update A9 story to demonstrate the fix: width:40 + suppressAutoSize
creates narrow columns; minWidth:80 overrides to show readable values
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add hash routing to screenshot compare viewer
Navigate directly to a story via URL hash (e.g. compare.html#A9_ManyCols_LongHdr_YearData).
Also update A9 tag from no-diff to diff.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use fitGridWidth for A9 story; allow extra_grid_config.autoSizeStrategy override
- A9 now uses fitGridWidth strategy (15 cols in 800px → ~53px each)
- extra_grid_config.autoSizeStrategy takes precedence over default
- minWidth:80 on defaultColDef prevents columns from crushing → readable values
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use 25 cols in A9 story to force visible truncation at fitGridWidth
25 cols in 800px → ~32px each without minWidth → "2,..." on every cell.
With minWidth:80 → 10 readable columns with horizontal scroll.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: capture before/after styling screenshots from baseline b7956f8
Update StylingScreenshots CI job to:
- Start Storybook (was missing, causing Playwright failures)
- Checkout baseline b7956f8, copy stories, capture "before" screenshots
- Checkout current branch, capture "after" screenshots
- Upload as two separate artifacts (styling-screenshots-before/after)
The download script and compare viewer already expect this artifact layout.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: force-checkout current branch after baseline pnpm install
pnpm install --no-frozen-lockfile at baseline modifies pnpm-lock.yaml,
causing git checkout to fail. Use -f flag and git clean to discard
changes from the baseline install.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: content-aware per-column minWidth from Python analysis
Replace blanket defaultColDef.minWidth:80 with per-column widths
computed from displayer type, data range, and header name length.
Python side (styling.py):
- estimate_min_width_px() computes pixel width from formatted char count
- Accounts for commas in integers, decimal+fraction in floats, header length
- Histogram pinned rows request 100px minimum
- Set via ag_grid_specs.minWidth per column
JS side:
- Remove hardcoded minWidth:80 from defaultColDef
- Per-column ag_grid_specs.minWidth already flows through via gridUtils
Narrow columns (1-2 digit data, short headers) stay tight instead of
being forced to 80px. Wide columns get appropriate minimums.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add width estimation tests, Python-computed minWidth stories, histogram stories
- 23 unit tests for estimate_min_width_px() and _formatted_char_count()
covering all displayer types, edge cases (NaN, None, negative), and
histogram minimum width enforcement
- 3 new stories (Section E) exercising Python-computed ag_grid_specs.minWidth
with realistic values (38px narrow ints, 134px long headers, mixed types)
- 2 new stories (Section F) showing histogram + narrow columns: one with
100px histogram minimum, one without (to show the difference)
- Updated Playwright spec and compare tool for new stories
- Added docs/column-width-design.md documenting all width levers and approaches
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use HistogramBar[] format for histogram story summary data
The histogram renderer expects [{name, population}] objects, not raw
number arrays. Fixes blank histogram rows in F20/F21 stories.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent fcfe368 commit 7b6a05c
13 files changed
Lines changed: 1998 additions & 15 deletions
File tree
- .github/workflows
- buckaroo/customizations
- docs
- packages/buckaroo-js-core
- pw-tests
- src
- components/DFViewerParts
- stories
- scripts
- tests/unit/dataflow
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
410 | 510 | | |
411 | 511 | | |
412 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
5 | 60 | | |
6 | 61 | | |
7 | 62 | | |
| |||
30 | 85 | | |
31 | 86 | | |
32 | 87 | | |
33 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
34 | 99 | | |
35 | 100 | | |
36 | 101 | | |
| |||
0 commit comments