-
Notifications
You must be signed in to change notification settings - Fork 0
chore(ci): import-cycle ratchet + mobile viewport regression suite #808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,812
−118
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
79ef02a
chore(ci): import-cycle ratchet + mobile viewport regression suite
claude 5be6490
chore(ci): run public mobile viewport checks on PRs via pr-smoke
claude 32a9e72
fix(ci): single dev-server lifecycle for mobile suite + fail-loud bot…
claude 915c110
fix(ci): madge API over CLI, skipped-file ratchet, shared bottom-nav …
615db04
fix(ci): single dev-server lifecycle in pr-smoke's a11y + mobile steps
f1aa62a
Merge branch 'main' into chore/ci-guardrails-cycles-mobile
njrini99-code cd9494f
fix(ci): fail fast when the pr-smoke dev server dies during startup
2ca1475
fix(e2e): tabs join the clipping scan; public routes assert final pat…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| { | ||
| "skipped": [ | ||
| "server-only" | ||
| ], | ||
| "cycles": [ | ||
| "app/golf/actions/stats-data.ts > lib/golf/detailed-stats-admin-bridge.ts", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/CoverHero.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/EmptyIssue.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/GradeStampGrid.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/KPIContentsStrip.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/PlayerRowPlate.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/RecruitCard.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/SlashLine.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/StatLineStack.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/TearSheet.tsx", | ||
| "components/baseball/living-annual/index.ts > components/baseball/living-annual/molecules/index.ts > components/baseball/living-annual/molecules/ToolRailStack.tsx", | ||
| "components/baseball/stat-visuals/StatVisualsSection.tsx > components/baseball/stat-visuals/index.ts", | ||
| "components/fairway/cards-insight/themes/CauseRow.tsx > components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayPlayerCoachHelm.tsx > components/fairway/cards-insight/themes/index.ts", | ||
| "components/fairway/cards-insight/themes/ThemeCard.tsx > components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayPlayerCoachHelm.tsx > components/fairway/cards-insight/themes/index.ts", | ||
| "components/fairway/cards-insight/themes/ThemesPanel.tsx > components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayPlayerCoachHelm.tsx > components/fairway/cards-insight/themes/index.ts", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayBrief.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayEffectiveness.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayMyDevelopment.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayMyDevelopment.tsx > components/fairway/pages/coachhelm/CausalWhyPanel.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayMyDevelopment.tsx > components/fairway/pages/coachhelm/FocusAreaCard.tsx > components/fairway/pages/coachhelm/PracticeRxForInsight.tsx > components/fairway/pages/coachhelm/PracticeRxPanel.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayMyDevelopment.tsx > components/fairway/pages/coachhelm/GoalsSection.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayMyDevelopment.tsx > components/fairway/pages/coachhelm/GoalsSection.tsx > components/fairway/pages/coachhelm/FairwayGoalCard.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/FairwayPlayerCoachHelm.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/GenomeCompareView.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/GenomeDetailView.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/coachhelm/index.ts > components/fairway/pages/coachhelm/PlayersGridView.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/dashboard/index.ts > components/fairway/pages/dashboard/FairwayPlayerDashboard.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/dashboard/index.ts > components/fairway/pages/dashboard/FairwayPlayerDashboard.tsx > components/fairway/pages/dashboard/PlayerActionCenter.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/dashboard/index.ts > components/fairway/pages/dashboard/FairwayPlayerDashboard.tsx > components/fairway/pages/dashboard/PlayerActionCenter.tsx > components/fairway/pages/dashboard/player-dashboard-parts.tsx", | ||
| "components/fairway/index.ts > components/fairway/pages/dashboard/index.ts > components/fairway/pages/dashboard/FairwayPlayerDashboard.tsx > components/fairway/pages/dashboard/PlayerActionCenter.tsx > components/fairway/pages/hub/hub-parts.tsx", | ||
| "components/fairway/pages/coachhelm/FairwayBrief.tsx > components/fairway/pages/coachhelm/index.ts", | ||
| "components/golf/coachhelm/insights/DiagnosisPanel.tsx > components/golf/coachhelm/insights/EvidencePanel.tsx", | ||
| "lib/admin/data/incident-feed.ts > lib/admin/data/triage.ts" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "fileExtensions": ["ts", "tsx"], | ||
| "tsConfig": "tsconfig.json", | ||
| "detectiveOptions": { | ||
| "ts": { "skipTypeImports": true }, | ||
| "tsx": { "skipTypeImports": true } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,231 @@ | ||
| import { test, expect, type Page } from '@playwright/test'; | ||
|
|
||
| /** | ||
| * Mobile viewport regression suite. | ||
| * | ||
| * Encodes the phone-width defect classes that have repeatedly shipped and | ||
| * been fixed by hand (PR #799 FAB/bottom-nav collisions, PR #806 calendar | ||
| * "Today" pill clipped at 390px) as functional assertions at real device | ||
| * widths, per docs/MOBILE_DOCTRINE.md: | ||
| * | ||
| * 1. No horizontal page pan — the page never scrolls sideways. | ||
| * 2. No partially-clipped header/nav controls — a control that is visible | ||
| * but cut off by the viewport edge (the #806 class). Fully off-screen | ||
| * elements are ignored: closed drawers/sheets legitimately park at | ||
| * translateX(100%). | ||
| * 3. No fixed element overlapping the bottom navigation (the #799 class). | ||
| * | ||
| * Projects (see playwright.config.ts): `mobile-public` runs unauthenticated; | ||
| * `mobile-coach` / `mobile-player` reuse the CI-seeded baseball storageState | ||
| * from the `setup` project, same as the mandatory smoke suite. | ||
| */ | ||
|
|
||
| const VIEWPORTS = [ | ||
| { width: 320, height: 568 }, | ||
| { width: 390, height: 844 }, | ||
| { width: 430, height: 932 }, | ||
| ] as const; | ||
|
|
||
| const PUBLIC_ROUTES = ['/', '/golf/login', '/baseball/login']; | ||
|
|
||
| const COACH_ROUTES = [ | ||
| '/baseball/dashboard/command-center', | ||
| '/baseball/dashboard/calendar', | ||
| '/baseball/dashboard/roster', | ||
| '/baseball/dashboard/stats-center', | ||
| '/baseball/dashboard/settings', | ||
| ]; | ||
|
|
||
| const PLAYER_ROUTES = [ | ||
| '/baseball/player/today', | ||
| '/baseball/dashboard/calendar', | ||
| '/baseball/dashboard/roster', | ||
| '/baseball/dashboard/my-stats', | ||
| ]; | ||
|
|
||
| async function gotoSettled(page: Page, route: string): Promise<void> { | ||
| // Reduced motion stabilizes geometry: entrance animations otherwise leave | ||
| // elements mid-transform when we measure. | ||
| await page.emulateMedia({ reducedMotion: 'reduce' }); | ||
| await page.goto(route, { waitUntil: 'domcontentloaded' }); | ||
| await page.waitForLoadState('networkidle', { timeout: 8000 }).catch(() => {}); | ||
| await page.waitForTimeout(250); | ||
| } | ||
|
|
||
| type MobileFitState = { | ||
| scrollWidth: number; | ||
| innerWidth: number; | ||
| clipped: string[]; | ||
| bottomNavFound: boolean; | ||
| collisions: string[]; | ||
| }; | ||
|
|
||
| // Single evaluate pass shared by all three checks below. The bottom-nav | ||
| // element is detected ONCE here and reused both as an extra container to | ||
| // scan for clipped controls and as the collision-check target, so a plain | ||
| // fixed wrapper (no <nav>/role="navigation") is treated identically by both | ||
| // checks instead of only being recognized by one of them. | ||
| async function collectMobileFitState(page: Page): Promise<MobileFitState> { | ||
| return page.evaluate(() => { | ||
| const fixedEls: Element[] = []; | ||
| for (const el of Array.from(document.body.querySelectorAll('*'))) { | ||
| const style = getComputedStyle(el); | ||
| if (style.position !== 'fixed') continue; | ||
| if (style.pointerEvents === 'none') continue; // toast portals, inset-0 wrappers | ||
| const r = el.getBoundingClientRect(); | ||
| if (r.width === 0 || r.height === 0) continue; | ||
| fixedEls.push(el); | ||
| } | ||
| // A bottom nav is either semantically marked (nav / role=navigation) OR | ||
| // merely tab-bar SHAPED: bottom-pinned, near-full-width, with 2+ | ||
| // interactive children. The shape fallback keeps this check alive if the | ||
| // app shell ever renders the bar as a plain fixed wrapper. | ||
| const bottomNav = | ||
| fixedEls.find((el) => { | ||
| const r = el.getBoundingClientRect(); | ||
| const bottomPinned = r.top > window.innerHeight - 140 && r.bottom >= window.innerHeight - 40; | ||
| const wide = r.width > window.innerWidth * 0.6; | ||
| if (!bottomPinned || !wide) return false; | ||
| const semantic = | ||
| el.tagName === 'NAV' || el.getAttribute('role') === 'navigation' || el.querySelector('nav') !== null; | ||
| const tabBarShaped = el.querySelectorAll('a, button, [role="button"], [role="tab"]').length >= 2; | ||
| return semantic || tabBarShaped; | ||
| }) ?? null; | ||
|
|
||
| // --- clipped header/nav/toolbar controls ----------------------------- | ||
| const containers = new Set<Element>( | ||
| document.querySelectorAll('header, nav, [role="navigation"], [role="toolbar"]'), | ||
| ); | ||
| // A plain fixed bottom-nav wrapper (recognized only via the shape | ||
| // heuristic above, not <nav>/role) is otherwise invisible to this scan — | ||
| // include it so a clipped control inside it is still caught. | ||
| if (bottomNav) containers.add(bottomNav); | ||
|
|
||
| const clipped: string[] = []; | ||
| const seen = new Set<Element>(); | ||
| for (const container of containers) { | ||
| for (const el of Array.from(container.querySelectorAll('a, button, [role="button"]'))) { | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| if (seen.has(el)) continue; | ||
| seen.add(el); | ||
| const r = el.getBoundingClientRect(); | ||
| if (r.width === 0 || r.height === 0) continue; | ||
| if (r.bottom < 0 || r.top > window.innerHeight) continue; | ||
| // Only flag PARTIAL clipping: visible in the viewport but cut off at | ||
| // an edge. Fully off-screen = intentional off-canvas UI, not a bug. | ||
| const partiallyVisible = r.left < window.innerWidth && r.right > 0; | ||
| const cutRight = r.right > window.innerWidth + 1 && r.left < window.innerWidth - 8; | ||
| const cutLeft = r.left < -1 && r.right > 8; | ||
| if (partiallyVisible && (cutRight || cutLeft)) { | ||
| const label = (el.textContent || el.getAttribute('aria-label') || el.tagName) | ||
| .trim() | ||
| .slice(0, 40); | ||
| clipped.push(`"${label}" [left ${Math.round(r.left)}, right ${Math.round(r.right)}] vs viewport ${window.innerWidth}`); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // --- bottom-nav collision --------------------------------------------- | ||
| const collisions: string[] = []; | ||
| if (bottomNav) { | ||
| const navRect = bottomNav.getBoundingClientRect(); | ||
| for (const el of fixedEls) { | ||
| if (el === bottomNav || bottomNav.contains(el) || el.contains(bottomNav)) continue; | ||
| const r = el.getBoundingClientRect(); | ||
| const overlapX = Math.min(r.right, navRect.right) - Math.max(r.left, navRect.left); | ||
| const overlapY = Math.min(r.bottom, navRect.bottom) - Math.max(r.top, navRect.top); | ||
| if (overlapX > 8 && overlapY > 8) { | ||
| const label = (el.getAttribute('aria-label') || el.textContent || el.className.toString()) | ||
| .trim() | ||
| .slice(0, 40); | ||
| collisions.push(`"${label}" overlaps bottom nav by ${Math.round(overlapX)}×${Math.round(overlapY)}px`); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return { | ||
| scrollWidth: document.documentElement.scrollWidth, | ||
| innerWidth: window.innerWidth, | ||
| clipped, | ||
| bottomNavFound: bottomNav !== null, | ||
| collisions, | ||
| }; | ||
| }); | ||
| } | ||
|
|
||
| function assertNoHorizontalPan(state: MobileFitState, route: string): void { | ||
| expect | ||
| .soft( | ||
| state.scrollWidth, | ||
| `${route}: page pans horizontally (scrollWidth ${state.scrollWidth} > viewport ${state.innerWidth})`, | ||
| ) | ||
| .toBeLessThanOrEqual(state.innerWidth + 1); | ||
| } | ||
|
|
||
| function assertNoClippedControls(state: MobileFitState, route: string): void { | ||
| expect.soft(state.clipped, `${route}: header/nav controls clipped at viewport edge`).toEqual([]); | ||
| } | ||
|
|
||
| function assertNoBottomNavCollision( | ||
| state: MobileFitState, | ||
| route: string, | ||
| opts: { expectBottomNav?: boolean } = {}, | ||
| ): void { | ||
| if (opts.expectBottomNav) { | ||
| // Authenticated dashboard surfaces carry a bottom nav at phone widths | ||
| // (docs/MOBILE_DOCTRINE.md). Without this assertion, a missed/renamed | ||
| // bottom nav would silently skip the collision check entirely. | ||
| expect | ||
| .soft(state.bottomNavFound, `${route}: no bottom navigation found at phone width (expected per MOBILE_DOCTRINE)`) | ||
| .toBe(true); | ||
| } | ||
| expect.soft(state.collisions, `${route}: fixed element collides with bottom navigation`).toEqual([]); | ||
| } | ||
|
|
||
| async function expectMobileFit( | ||
| page: Page, | ||
| route: string, | ||
| opts: { expectBottomNav?: boolean } = {}, | ||
| ): Promise<void> { | ||
| await gotoSettled(page, route); | ||
| const state = await collectMobileFitState(page); | ||
| assertNoHorizontalPan(state, route); | ||
| assertNoClippedControls(state, route); | ||
| assertNoBottomNavCollision(state, route, opts); | ||
| } | ||
|
|
||
| for (const viewport of VIEWPORTS) { | ||
| test.describe(`public routes @ ${viewport.width}px`, { tag: '@public' }, () => { | ||
| test.use({ viewport }); | ||
| for (const route of PUBLIC_ROUTES) { | ||
| test(`${route} fits ${viewport.width}px`, async ({ page }) => { | ||
| await expectMobileFit(page, route); | ||
| }); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
| }); | ||
|
|
||
| test.describe(`baseball coach routes @ ${viewport.width}px`, { tag: '@coach' }, () => { | ||
| test.use({ viewport }); | ||
| for (const route of COACH_ROUTES) { | ||
| test(`${route} fits ${viewport.width}px (coach)`, async ({ page }) => { | ||
| await expectMobileFit(page, route, { expectBottomNav: true }); | ||
| // Assert the FINAL pathname, not just "didn't bounce to /login" — a | ||
| // server route guard (src/lib/baseball/server-route-guards.ts) can | ||
| // redirect an authed-but-unauthorized coach to a different dashboard | ||
| // route entirely, which the old /login-only check would miss. | ||
| expect(new URL(page.url()).pathname, `expected ${route} to render`).toBe(route); | ||
| }); | ||
|
njrini99-code marked this conversation as resolved.
|
||
| } | ||
| }); | ||
|
|
||
| test.describe(`baseball player routes @ ${viewport.width}px`, { tag: '@player' }, () => { | ||
| test.use({ viewport }); | ||
| for (const route of PLAYER_ROUTES) { | ||
| test(`${route} fits ${viewport.width}px (player)`, async ({ page }) => { | ||
| await expectMobileFit(page, route, { expectBottomNav: true }); | ||
| // Same rationale as the coach block above: assert the FINAL | ||
| // pathname rather than only rejecting /login. | ||
| expect(new URL(page.url()).pathname, `expected ${route} to render`).toBe(route); | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.