Skip to content

fix(e2e): mobile-viewport suite bounced by 5-min idle gate, not layout - #939

Closed
njrini99-code wants to merge 1 commit into
mainfrom
fix/e2e-idle-activity-cliff
Closed

fix(e2e): mobile-viewport suite bounced by 5-min idle gate, not layout#939
njrini99-code wants to merge 1 commit into
mainfrom
fix/e2e-idle-activity-cliff

Conversation

@njrini99-code

Copy link
Copy Markdown
Owner

Run 29623264998 on the merge train 'failed' the blocking baseball mobile suite — but every failure was Received: /baseball/login (session bounced), not a layout assertion. The seeded storageState pins sb_last_activity at auth-setup time; middleware's idle gate (SESSION_IDLE_TIMEOUT_MS = 5 min) then bounces every test that starts past setup+5min. Coach tests died at exactly setup+5min (test 29), player at its setup+5min (test 60). The earlier green run (29619371852) simply finished under the cliff.

Fix: gotoSettled refreshes the marker per navigation, the same way real user activity does. Full e2e dispatched on this branch — it also layout-validates #937's calendar-header change at 320px, which the bounced run never got to measure.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MMdviLDsAg2YYJ8adsM6fg

…suite

The seeded storageState pins the idle-activity marker at auth-setup time, so
any test starting >5min (SESSION_IDLE_TIMEOUT_MS) after setup is bounced to
/login by the middleware idle gate before measuring — the blocking suite
passed or failed on runtime proximity to that cliff (train run 29623264998
crossed it at coach test 29 / player test 60; the earlier green run simply
finished under it). An active-viewport test should look like an active user.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMdviLDsAg2YYJ8adsM6fg
@cursor

cursor Bot commented Jul 18, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@vercel

vercel Bot commented Jul 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
helmv3 Ignored Ignored Jul 18, 2026 1:01am

Request Review

@supabase

supabase Bot commented Jul 18, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project qmnssrrolpinvwjjnufo because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • Tests
    • Improved mobile viewport test reliability by preventing idle-session redirects from affecting layout measurements.
    • Ensured viewport checks use a current activity state during navigation.

Walkthrough

The mobile viewport test navigation helper now refreshes the sb_last_activity cookie using the configured Playwright base URL before navigating, preventing idle-gate redirects during viewport measurements.

Changes

Mobile viewport test navigation

Layer / File(s) Summary
Refresh activity cookie before navigation
e2e/mobile-viewports.spec.ts
gotoSettled derives baseURL, sets sb_last_activity to Date.now(), and navigates after updating the page context.

Estimated code review effort: 2 (Simple) | ~5 minutes

🚥 Pre-merge checks | ✅ 10 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Title check ⚠️ Warning The change is related, but the title uses e2e instead of an allowed Conventional Commit scope. Rename it to a Conventional Commit with an allowed scope, e.g. fix(baseball): ... or fix(ci): ....
Conventional Commits ❓ Inconclusive HEAD subject is conventional (fix(e2e): ...), but the PR title itself isn't available in the provided context. Provide the PR title (or metadata exposing it) so both the title and squashed commit subject can be checked against the regex.
✅ Passed checks (10 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly matches the mobile-viewport idle-gate fix in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No Service-Role In Client Bundles ✅ Passed Changed file e2e/mobile-viewports.spec.ts contains no SUPABASE_SERVICE_ROLE_KEY use or service-role Supabase client creation.
Rls Coverage On New Tables ✅ Passed PASS: PR diff only touches e2e/mobile-viewports.spec.ts:46-60; git diff shows no migration files, so the RLS check is not applicable.
Auth Check In Server Actions ✅ Passed PASS: The PR only changes e2e/mobile-viewports.spec.ts; no files under src/app//actions//*.ts were modified, so the server-action auth check is not applicable.
Sport-Prefixed Table Names ✅ Passed Only changed TS file is e2e/mobile-viewports.spec.ts:46-63; it refreshes a cookie and navigates, with no Supabase table queries to inspect.
No Destructive Writes ✅ Passed The only changed code is e2e/mobile-viewports.spec.ts:46-63, which adds a Playwright cookie before navigation; no DELETE/INSERT DB writes exist.
No Edits To Historical Migrations ✅ Passed Diff vs origin/main only changes e2e/mobile-viewports.spec.ts; no files under supabase/migrations/ were modified.
✨ 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 fix/e2e-idle-activity-cliff
  • 🛠️ helm safety pass
  • 🛠️ dashboard ux pass
  • 🛠️ rls test pass

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.44.1)

ast-grep could not parse rule config: /ast-grep-rules/../git/.coderabbit/ast-grep/no-explicit-any.yml


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/mobile-viewports.spec.ts`:
- Around line 50-60: Import the exported SESSION_IDLE_COOKIE constant from the
session-idle shared module and use it as the cookie name in the
page.context().addCookies call, replacing the hardcoded 'sb_last_activity' value
while preserving the existing cookie refresh behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e17448b1-d25a-4508-8bcd-95d1b3764daa

📥 Commits

Reviewing files that changed from the base of the PR and between 6ecede6 and c47f17e.

📒 Files selected for processing (1)
  • e2e/mobile-viewports.spec.ts

Comment on lines +50 to +60
// The seeded storageState pins `sb_last_activity` (SESSION_IDLE_COOKIE in
// src/lib/auth/session-idle-shared.ts) at auth-setup time, so any test that
// starts more than SESSION_IDLE_TIMEOUT_MS (5 min) after setup is bounced
// to /login by the middleware idle gate before it can measure anything —
// the suite passes or fails on how close its runtime sits to that cliff.
// A viewport test simulates an ACTIVE user, so refresh the marker the same
// way real interaction does.
const baseURL = test.info().project.use.baseURL ?? 'http://localhost:3000';
await page.context().addCookies([
{ name: 'sb_last_activity', value: Date.now().toString(), url: baseURL },
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use exported SESSION_IDLE_COOKIE constant.

e2e/mobile-viewports.spec.ts:50-60. The inline comment references SESSION_IDLE_COOKIE in src/lib/auth/session-idle-shared.ts. Import and use the exported constant directly instead of hardcoding 'sb_last_activity' to ensure the test suite automatically tracks any upstream contract changes.

♻️ Proposed refactor

Add the import at the top of the file:

import { SESSION_IDLE_COOKIE } from '`@/lib/auth/session-idle-shared`'; // Adjust alias/path as needed

And update the cookie injection:

  await page.context().addCookies([
-    { name: 'sb_last_activity', value: Date.now().toString(), url: baseURL },
+    { name: SESSION_IDLE_COOKIE, value: Date.now().toString(), url: baseURL },
  ]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// The seeded storageState pins `sb_last_activity` (SESSION_IDLE_COOKIE in
// src/lib/auth/session-idle-shared.ts) at auth-setup time, so any test that
// starts more than SESSION_IDLE_TIMEOUT_MS (5 min) after setup is bounced
// to /login by the middleware idle gate before it can measure anything —
// the suite passes or fails on how close its runtime sits to that cliff.
// A viewport test simulates an ACTIVE user, so refresh the marker the same
// way real interaction does.
const baseURL = test.info().project.use.baseURL ?? 'http://localhost:3000';
await page.context().addCookies([
{ name: 'sb_last_activity', value: Date.now().toString(), url: baseURL },
]);
// The seeded storageState pins `sb_last_activity` (SESSION_IDLE_COOKIE in
// src/lib/auth/session-idle-shared.ts) at auth-setup time, so any test that
// starts more than SESSION_IDLE_TIMEOUT_MS (5 min) after setup is bounced
// to /login by the middleware idle gate before it can measure anything —
// the suite passes or fails on how close its runtime sits to that cliff.
// A viewport test simulates an ACTIVE user, so refresh the marker the same
// way real interaction does.
const baseURL = test.info().project.use.baseURL ?? 'http://localhost:3000';
await page.context().addCookies([
{ name: SESSION_IDLE_COOKIE, value: Date.now().toString(), url: baseURL },
]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/mobile-viewports.spec.ts` around lines 50 - 60, Import the exported
SESSION_IDLE_COOKIE constant from the session-idle shared module and use it as
the cookie name in the page.context().addCookies call, replacing the hardcoded
'sb_last_activity' value while preserving the existing cookie refresh behavior.

@njrini99-code

Copy link
Copy Markdown
Owner Author

Superseded by the bundled PR from fix/hub-subnav-train-clip (same cookie commit cherry-picked, plus the underlying hub-sub-nav truncation fix the forensics identified).

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