Skip to content

fix(web): make pre-merge frontend checks pass at HEAD (prettier drift + 15 stale tests) - #119

Merged
Quick104 merged 2 commits into
mainfrom
claude/interesting-buck-36cf92
Jun 9, 2026
Merged

Quick104 merged 2 commits into
mainfrom
claude/interesting-buck-36cf92

Conversation

@Quick104

@Quick104 Quick104 commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The frontend verification commands required before merge requests were failing at HEAD on main, independent of any feature work:

  • cd web && pnpm run format:check reported style issues in 19 files
  • cd web && pnpm run test had 15 failing tests across 6 files

What changed

Commit 1 — formatting only. Checked first whether the drift came from a prettier version bump: prettier has been pinned at 3.8.1 in web/pnpm-lock.yaml since the initial migration (only react-router and vitest were bumped since), so the 19 files were simply committed unformatted. Ran pnpm run format; whitespace/wrapping changes only.

Commit 2 — test files only, no component changes. The failing tests were committed already out of sync with the components they render (none of those components changed after the initial migration), so the current components are the source of truth:

  • SectionRow.test.tsx / SeriesContent.test.tsx: mock @/playback/watchPlaybackContext (ContinueWatchingCard and MediaItemMenu require the watch playback controller — same pattern as ContinueWatchingCard's own tests), mock the new useSimilarItems hook, add useOptionalAuth to the auth mock, and wrap renders in QueryClientProvider for MediaItemMenu's query hooks
  • SeriesContent.test.tsx: the component reads the rating from item.user_rating now (the useRating hook no longer exists), so the fixture sets user_rating: 4 and the stale mock is removed
  • ProfilesSettings.test.tsx: add useHouseholdSessions to the @/hooks/queries/profiles mock for the new HouseholdStreamsPanel
  • ImpersonationBanner.test.tsx: the banner was redesigned ("Viewing as" label, full-width sticky bar, no lg:pl-[292px] sidebar offset); the obsolete offset test now asserts the sticky positioning instead
  • EpisodeRow.test.tsx: the watched indicator uses the text-success design token instead of text-green-500
  • profile-management.test.ts: "adventurer" is no longer a resolvable avatar preset after the move to DiceBear-style refs (it round-trips to ""); switched to a valid dicebear:identicon:swift-fox ref, preserving the test's intent that clearKidsPreset leaves the avatar untouched

Verification

  • pnpm run test: 838/838 pass (was 823/838)
  • pnpm run format:check: clean
  • pnpm run lint: 0 errors (140 pre-existing warnings, untouched)
  • make verify-local-paths: clean

Risks / notes

No production code changes — formatting and test harnesses only. AI-use disclosure: authored with Claude Code.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests

    • Updated test assertions and mocks for improved test coverage across components and hooks, including playback context, household sessions, and profile management scenarios.
  • Style

    • Reorganized CSS class ordering for the connection status indicator and overlay label styling.
  • Refactor

    • Consolidated imports and reformatted code expressions across multiple components and hooks for consistency.
    • Refined icon computation logic in overlay badge resolution.

Quick104 and others added 2 commits June 9, 2026 19:16
prettier --check was failing on 19 files at HEAD. The pinned prettier
version (3.8.1) has not changed since the initial migration, so the
drift came from unformatted commits, not a toolchain bump. Formatting
changes only, no behavior change.

Co-Authored-By: Claude Fable 5 <[email protected]>
15 tests across 6 files were failing at HEAD; the components were
committed already out of sync with their tests in the initial
migration. All fixes are in test files only:

- SectionRow / SeriesContent: mock the watch playback controller
  required by ContinueWatchingCard and MediaItemMenu, mock the new
  useSimilarItems hook, add useOptionalAuth to the auth mock, and
  wrap renders in QueryClientProvider for MediaItemMenu query hooks
- SeriesContent: read rating from item.user_rating (the useRating
  hook no longer exists)
- ProfilesSettings: add useHouseholdSessions to the profiles mock
  for the new HouseholdStreamsPanel
- ImpersonationBanner: match the redesigned banner ("Viewing as",
  sticky full-width bar instead of sidebar offset)
- EpisodeRow: watched indicator uses the text-success token now
- profile-management: use a valid DiceBear preset ref; "adventurer"
  no longer resolves and round-trips to ""

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: acd47802-416d-4ffd-bb69-0f5004ed5ed6

📥 Commits

Reviewing files that changed from the base of the PR and between 4c38d8c and 59158c2.

📒 Files selected for processing (25)
  • web/src/components/EpisodeRow.test.tsx
  • web/src/components/ImpersonationBanner.test.tsx
  • web/src/components/SectionRow.test.tsx
  • web/src/components/ServerActivity.tsx
  • web/src/components/admin/TaskStatusBadge.tsx
  • web/src/components/catalog/CatalogFiltersPanel.tsx
  • web/src/components/collections/ManualCollectionItemsEditor.tsx
  • web/src/components/overlays/CardOverlays.tsx
  • web/src/components/overlays/OverlayPreviewCard.tsx
  • web/src/components/profiles/HouseholdStreamsPanel.tsx
  • web/src/hooks/queries/mediaSurfaceRefresh.test.ts
  • web/src/hooks/useOverlayPrefs.ts
  • web/src/hooks/useSortableList.ts
  • web/src/lib/mediaNavigation.test.ts
  • web/src/lib/mediaNavigation.ts
  • web/src/lib/overlays/index.ts
  • web/src/lib/overlays/presets.ts
  • web/src/lib/overlays/registry/tech.ts
  • web/src/lib/overlays/schema.ts
  • web/src/lib/profile-management.test.ts
  • web/src/pages/AdminHistoryImport.tsx
  • web/src/pages/ItemDetail/AudiobookContent.test.tsx
  • web/src/pages/ItemDetail/SeriesContent.test.tsx
  • web/src/pages/settings/CardOverlaySettings.tsx
  • web/src/pages/settings/ProfilesSettings.test.tsx

📝 Walkthrough

Walkthrough

This PR refactors web UI test infrastructure and formatting across 26 files. Changes include updating test mocks and assertions, consolidating multi-line imports, adjusting CSS class orderings, reformatting function signatures, and updating overlay configuration values.

Changes

Test infrastructure and rendering updates

Layer / File(s) Summary
Test infrastructure and dependency mocking
web/src/components/SectionRow.test.tsx, web/src/pages/ItemDetail/SeriesContent.test.tsx, web/src/pages/settings/ProfilesSettings.test.tsx
Adds Vitest mocks for playback context (useWatchPlaybackController), wraps renders in QueryClientProvider, and extends mocks for recommendations and auth hooks (useSimilarItems, useOptionalAuth). The makeSeriesItem helper now includes user_rating field.
Test string assertions and avatars
web/src/components/EpisodeRow.test.tsx, web/src/components/ImpersonationBanner.test.tsx, web/src/lib/profile-management.test.ts
Updates CSS class assertions (text-success), banner copy strings ("Viewing as", "End impersonation session"), sticky positioning test, and avatar preset values (dicebear:identicon:swift-fox).
Import statement consolidation
web/src/components/admin/TaskStatusBadge.tsx, web/src/components/collections/ManualCollectionItemsEditor.tsx, web/src/hooks/useOverlayPrefs.ts, web/src/hooks/useSortableList.ts, web/src/pages/settings/CardOverlaySettings.tsx
Converts multi-line named imports to single-line format for Tooltip, dnd-kit, overlay helpers, and Popover components.
Component rendering and styling adjustments
web/src/components/ServerActivity.tsx, web/src/components/overlays/OverlayPreviewCard.tsx, web/src/components/catalog/CatalogFiltersPanel.tsx, web/src/components/profiles/HouseholdStreamsPanel.tsx, web/src/pages/AdminHistoryImport.tsx, web/src/pages/settings/CardOverlaySettings.tsx
Updates CSS class ordering (ring-background, tracking-wider/uppercase), reformats boolean expressions for audiobook detection, simplifies array return statements, and adjusts JSX text layout in tables and descriptions.
Icon preference logic update
web/src/components/overlays/CardOverlays.tsx
Refactors showIcon computation to use explicit candidateIcon variable with null checks before applying icon preference fallback.
Test assertion formatting
web/src/hooks/queries/mediaSurfaceRefresh.test.ts, web/src/lib/mediaNavigation.test.ts, web/src/pages/ItemDetail/AudiobookContent.test.tsx
Collapses multi-line test expectations and mock object structures into single-line or more compact forms without changing test logic.
Function signatures and export formatting
web/src/lib/mediaNavigation.ts, web/src/lib/overlays/index.ts, web/src/lib/overlays/schema.ts
Reformats parameter destructuring across multiple lines, consolidates barrel export statements, and adjusts helper function declarations.
Overlay preset and registry configuration
web/src/lib/overlays/presets.ts, web/src/lib/overlays/registry/tech.ts
Updates classic preset badgeStyle background expression, expands PRESET_IDS array to multi-line format, adjusts string quoting style, and refines resolution check guard.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Silo-Server/silo-server#26: Main PR's web/src/components/ItemCard.tsx refactors rendering to consume sort_metrics-driven fields, which aligns with the retrieved PR's additions of sort_metrics to catalog responses and sort-metric computation in the backend.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/interesting-buck-36cf92

Comment @coderabbitai help to get the list of available commands and usage tips.

@Quick104
Quick104 merged commit 68e9bf1 into main Jun 9, 2026
1 check was pending
@Quick104
Quick104 deleted the claude/interesting-buck-36cf92 branch June 9, 2026 23:17
Quick104 added a commit that referenced this pull request Jun 11, 2026
… + 15 stale tests) (#119)

* style(web): run prettier over drifted files

prettier --check was failing on 19 files at HEAD. The pinned prettier
version (3.8.1) has not changed since the initial migration, so the
drift came from unformatted commits, not a toolchain bump. Formatting
changes only, no behavior change.

Co-Authored-By: Claude Fable 5 <[email protected]>

* test(web): sync stale test harnesses with current components

15 tests across 6 files were failing at HEAD; the components were
committed already out of sync with their tests in the initial
migration. All fixes are in test files only:

- SectionRow / SeriesContent: mock the watch playback controller
  required by ContinueWatchingCard and MediaItemMenu, mock the new
  useSimilarItems hook, add useOptionalAuth to the auth mock, and
  wrap renders in QueryClientProvider for MediaItemMenu query hooks
- SeriesContent: read rating from item.user_rating (the useRating
  hook no longer exists)
- ProfilesSettings: add useHouseholdSessions to the profiles mock
  for the new HouseholdStreamsPanel
- ImpersonationBanner: match the redesigned banner ("Viewing as",
  sticky full-width bar instead of sidebar offset)
- EpisodeRow: watched indicator uses the text-success token now
- profile-management: use a valid DiceBear preset ref; "adventurer"
  no longer resolves and round-trips to ""

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Quick104 added a commit that referenced this pull request Jun 17, 2026
… + 15 stale tests) (#119)

* style(web): run prettier over drifted files

prettier --check was failing on 19 files at HEAD. The pinned prettier
version (3.8.1) has not changed since the initial migration, so the
drift came from unformatted commits, not a toolchain bump. Formatting
changes only, no behavior change.

Co-Authored-By: Claude Fable 5 <[email protected]>

* test(web): sync stale test harnesses with current components

15 tests across 6 files were failing at HEAD; the components were
committed already out of sync with their tests in the initial
migration. All fixes are in test files only:

- SectionRow / SeriesContent: mock the watch playback controller
  required by ContinueWatchingCard and MediaItemMenu, mock the new
  useSimilarItems hook, add useOptionalAuth to the auth mock, and
  wrap renders in QueryClientProvider for MediaItemMenu query hooks
- SeriesContent: read rating from item.user_rating (the useRating
  hook no longer exists)
- ProfilesSettings: add useHouseholdSessions to the profiles mock
  for the new HouseholdStreamsPanel
- ImpersonationBanner: match the redesigned banner ("Viewing as",
  sticky full-width bar instead of sidebar offset)
- EpisodeRow: watched indicator uses the text-success token now
- profile-management: use a valid DiceBear preset ref; "adventurer"
  no longer resolves and round-trips to ""

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Quick104 added a commit that referenced this pull request Nov 20, 2026
* fix(web): say "Show it" on a restore toggle that covers one item

The Restore page's "Show them" / "Hide them" toggle now passes the count
of what it shows: the blocked group's size, the section's item count, or
the number of never-restored settings. With the catalog's plural form, a
group or section of one reads "Show it" / "Hide it".

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(web): sync translations to 2026.11.20-80e7bd8

Brings in the plural "Show it" / "Hide it" toggle keys
(Silo-Server/silo-translations#124), the singular blocked-group
headings (#119, #122), and the other catalog changes released since
the last pin.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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