Skip to content

test(app): close the three gaps left by the pinned-sessions PR - #191

Merged
quickbeard merged 1 commit into
mainfrom
pinned-coverage
Aug 11, 2026
Merged

quickbeard merged 1 commit into
mainfrom
pinned-coverage

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

#189 shipped the pinned section with coverage only through the sidebar row menu. Three behaviours it introduced had nothing behind them. This adds four e2e tests, all in the existing sidebar-pinned-sessions.spec.ts.

1. The five-row scroll cap

PINNED_VISIBLE_ROWS appeared in no test at all, so the cap that stops a long pin list from squeezing Recents out of the column was unguarded. A new harness seeds seven sessions and pins six:

  • the list stays capped at five rows' worth of height,
  • all six rows are still rendered — Pinned scrolls, unlike Recents, which truncates,
  • Recents keeps its height.

Reading the overflow needed care: ScrollView caps its root and scrolls an inner .scroll-view__viewport, so measuring scrollHeight on the element carrying the max-height reported no overflow and the first version of this test passed against a broken cap.

2. The in-session header menu

Every existing test drove the sidebar row menu. Pinning from the ⋯ beside a session title now has to appear in the sidebar's Pinned section, and the header then has to offer Unpin.

This is the failure DIVERGENCES.md singles out: the header resolves the pin's server independently of the sidebar (params.serverKey ?? the current connection), and if the two ever disagree the pin is filed under a key the sidebar never reads, so the row silently never appears.

3. Delete-drops-the-pin, and per-server storage

Deleting a pinned session has to clear it from Pinned and from storage — an id left behind would silently re-pin a future session that reused it. The mock serves /session from an array by reference, so the DELETE route splices it and the index refetch cannot resurrect the row.

Pins also have to be stored under the server they were made against rather than in one flat list, since session ids are only unique within a server.

Each test was checked against a break

test break applied result
scroll cap max-height raised to 50 rows fails
header menu header pins under a constant server key fails
delete drops pin pinned?.remove(...) deleted from deleteSession fails
per-server storage store flattened to a single "all" key fails

The per-server one needed tightening to earn its place. The first version asserted only that sessions had exactly one non-empty key holding the id — which the flattened { all: [...] } break satisfied, so it passed against the bug. It now asserts the exact server key, derived from the harness the same way playwright.config.ts builds it.

Verification

  • bun test:e2e:local — 134 passed, 0 failed (was 130)
  • bun test (packages/app) — 638 pass
  • bun typecheck (packages/app) — clean
  • bun lint — 4746 warnings + 1 error, identical to main

Test-only: no src changes, so no CHANGELOG or DIVERGENCES entry.

🤖 Generated with Claude Code

#189 shipped with the pinned section covered only through the sidebar
row menu. Three behaviours it introduced had nothing behind them.

- The five-row cap: pinning a sixth session now has to leave the list
  capped and scrolling, with all six rows still rendered, and Recents
  still holding its height. PINNED_VISIBLE_ROWS appeared in no test
  before this.
- The in-session header menu: pinning from the ⋯ beside a session title
  has to show up in the sidebar. That is the cross-surface agreement
  DIVERGENCES singles out as the silent breakage — the header resolves
  the pin's server independently, and a mismatch files the pin under a
  key the sidebar never reads.
- Deleting a pinned session has to drop the pin from storage, and pins
  have to be stored under the server they were made against rather than
  in one flat list.

Each was run against a deliberate break of the behaviour it covers and
fails there. The per-server test needed tightening to earn that: the
first version asserted only that some single key existed, which a
hardcoded "all" satisfied, so it now asserts the exact server key.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@quickbeard
quickbeard merged commit fea95da into main Aug 11, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the pinned-coverage branch August 11, 2026 10:15
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.

1 participant