Skip to content

test(#565): correct two stale widen specs (widen is one-dimensional by design) - #567

Merged
BorisTyshkevich merged 1 commit into
mainfrom
fix/stale-widen-specs-565
Jul 29, 2026
Merged

test(#565): correct two stale widen specs (widen is one-dimensional by design)#567
BorisTyshkevich merged 1 commit into
mainfrom
fix/stale-widen-specs-565

Conversation

@BorisTyshkevich

Copy link
Copy Markdown
Collaborator

What & why

Closes #565 — and corrects its premise. I opened that issue calling this a user-visible regression ("widen no longer grows a grid tile's height"). That was wrong. Widen behaves exactly as specified; the two specs were stale.

Measured live in Chromium against the real fixture:

initial   h=208px w= 867px   t-sales={"grid":{"span":8}}
press 1   h=208px w=1305px   t-sales={"grid":{"span":12,"height":2}}
press 2   h=208px w= 101px   t-sales={"grid":{"span":1,"height":2}}

Span doubles 8 → 12 and wraps to 1 at the maximum; the height never moves. src/dashboard/application/panel-widen.ts says so three times:

  • the module reads "only, and never anything two-dimensional: the corner drag (Add a rowless Grafana-style tile-grid Dashboard layout #291) stays the free-form resize";
  • for grid: "doubles span on each press and wraps to 1 at the maximum. Height is always resent unchanged";
  • nextPanelPlacement: "Height is preserved."

t-sales authors no height, so it resolves to DEFAULT_GRID_HEIGHT_UNITS (2) → 32 + 88*2 = 208px, before and after. The failing assertion demanded > 208 and got exactly 208.

What was actually stale

Both defects come from the grafana-grid@2 style-keyed placement shape, not from the widen step:

was now
rendered height toBeGreaterThan(before.height) — demanded the one thing widen must not do toBe(before.height) — the real invariant; fails if widen ever becomes two-dimensional
persisted placement { span: 12, height: 4 } — flat v1 shape, and a height that never existed { grid: { span: 12, height: 2 } }
narrow-tile poll items['t-sales']?.span — v1 path, resolves to undefined, so ?? null turned a shape mismatch into an opaque 5s timeout items['t-sales']?.grid?.span

The narrow-tile spec's expected value (2) was always correct and is unchanged: the two presses wrap span to 1, and the row it then clicks steps it to 2. I initially misread that as wrong too — the menu click is what makes 2 right.

Note the direction of the height fix: asserting equality is strictly stronger here than the old toBeGreaterThan, because it now pins the documented one-dimensional contract rather than leaving it unconstrained.

Quarantine removed

The test.fail() markers I added in #566 were based on the misdiagnosis. They're gone — these specs pass on their own merits now, no expected-failure bookkeeping.

Verification

npx playwright test tests/e2e/tile-open-workbench.spec.jschromium 21 passed, webkit 20 passed, quarantine removed. Nothing under src/ changes; this is a test-only correction.

Worth recording why this rotted unnoticed: the placement shape changed under these specs and the browser suite never ran on a pull request until #564. This is the first thing that gate caught.

Checklist

  • npm test passes (the per-file coverage gate is non-negotiable) — unaffected, no src/ or unit change
  • Tests added/updated in the same change as the code
  • npm run build succeeds (single-file dist/sql.html) — unaffected
  • Layers kept honest: pure logic in src/core/, network in src/net/ (injected fetch), DOM in src/ui/
  • No new runtime dependency
  • README / CHANGELOG.md ([Unreleased]) updated if behavior or the deployed surface changed — n/a, no behaviour change
  • Reconciled affected tracked work (roadmap Roadmap to 1.0.0 #68, the issue body, ADR/CHANGELOG) if this change reshaped it — Two tile-widen e2e specs are stale against the grafana-grid@2 placement shape #565 retitled and its premise corrected

🤖 Generated with Claude Code

https://claude.ai/code/session_01GiubaoqEuBzAyo5C4P8Vqr

These two specs were NOT catching a product bug. Widen behaves exactly as
`panel-widen.ts` specifies; the specs were left behind by the grafana-grid@2
style-keyed placement shape.

Measured live in Chromium against the real fixture:

    initial   h=208px w= 867px   t-sales={"grid":{"span":8}}
    press 1   h=208px w=1305px   t-sales={"grid":{"span":12,"height":2}}
    press 2   h=208px w= 101px   t-sales={"grid":{"span":1,"height":2}}

Span doubles 8 -> 12 and wraps to 1 at the maximum, and the height never
moves. That is the documented contract, stated three times in
`panel-widen.ts`: the module "never [does] anything two-dimensional" (the
corner drag, #291, owns free-form resize), grid "doubles span on each press"
with "height ... always resent unchanged", and `nextPanelPlacement` says
"Height is preserved". `t-sales` authors no height, so it resolves to
DEFAULT_GRID_HEIGHT_UNITS (2) -> `32 + 88*2` = 208px, before and after.

So the assertions were wrong, not the code:

- `expect(wide.height).toBeGreaterThan(before.height)` demanded the one thing
  widen must NOT do. Now asserts the height is unchanged, which is the real
  invariant and would fail if widen ever became two-dimensional.
- `toEqual({ span: 12, height: 4 })` used the flat v1 placement and a height
  that never existed. Now `{ grid: { span: 12, height: 2 } }`.
- the narrow-tile spec polled `items['t-sales']?.span`, a v1 path that
  resolves to `undefined` under v2, so `?? null` turned a shape mismatch into
  an opaque 5s timeout. Now reads `...?.grid?.span`. Its expected value (2)
  was always correct: the two presses wrap span to 1 and the menu row it then
  clicks steps it to 2.

Also removes the `test.fail()` quarantine added when this was misdiagnosed as
a regression. Nothing in `src/` changes.

Chromium 21 passed, WebKit 20 passed, quarantine removed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiubaoqEuBzAyo5C4P8Vqr
@BorisTyshkevich
BorisTyshkevich merged commit 90aceae into main Jul 29, 2026
8 checks passed
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.

Two tile-widen e2e specs are stale against the grafana-grid@2 placement shape

1 participant