feat(clerk-js): re-apply touch intent with e2e coverage#8117
feat(clerk-js): re-apply touch intent with e2e coverage#8117nikosdouvlis wants to merge 3 commits intomainfrom
Conversation
This reverts commit ce67184.
Adds an e2e test that triggers session.touch() with intent (sent natively after the revert-of-revert) and asserts last_active_token is present on the session. This would have caught the server-side regression where focus touches skipping client piggybacking also dropped the token from the response.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 3d8dc60 The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds an optional Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@integration/tests/resiliency.test.ts`:
- Around line 389-397: The test currently calls setActive without an explicit
intent so it exercises the selection flow; to cover the previously failing
focus-touch path, change the test to explicitly send a focus intent (either by
calling session.touch({ intent: 'focus' }) or calling setActive with intent:
'focus') so the server-side focus handling and last_active_token logic are
exercised; update the call site around window.Clerk?.setActive / session.touch
to pass intent: 'focus' and assert the session still returns a valid
last_active_token.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 62379cbd-1406-4d0b-82ab-90d01f4ba59a
📒 Files selected for processing (7)
.changeset/warm-touch-intent.mdintegration/tests/resiliency.test.tspackages/clerk-js/src/core/__tests__/clerk.test.tspackages/clerk-js/src/core/clerk.tspackages/clerk-js/src/core/resources/Session.tspackages/clerk-js/src/core/resources/__tests__/Session.test.tspackages/shared/src/types/session.ts
The server skips client piggybacking only for focus touches, so the
test needs to call session.touch({ intent: 'focus' }) directly instead
of setActive (which sends select_session).
Why
We reverted the touch intent feature (ce67184) because the server wasn't populating
last_active_tokenwhen it skipped client piggybacking for focus touches. That's now fixed server-side (clerk/clerk_go#17644). Re-applying the feature with an e2e test so this gap doesn't happen again.What changed
intentparameter tosession.touch()intent: 'focus', setActive sendsselect_sessionorselect_orglastActiveTokenis present after a touch with intentSummary by CodeRabbit
New Features
Tests