test(shared): pin createPathMatcher contract surface#8416
Conversation
🦋 Changeset detectedLatest commit: 8c2cd34 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@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: |
📝 WalkthroughWalkthroughA new changeset file is added with empty YAML front-matter to document changes. The test suite for Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Summary
Adds regression-proofing tests for
createPathMatcher/normalizePath/MalformedURLError. This is a pure test-coverage hardening, no functional code changes.The matcher is security-load-bearing (powers
clerkMiddleware's public/protected route checks) and several of its current behaviors are easy to flip silently in a refactor. Pinning them with explicit tests makes any future change to the contract deliberate.What's pinned
createPathMatcherdoes not resolve... Callers (frameworks built on the WHATWG URL parser) handle this upstream.decodeURIis called exactly once.%2561dmindecodes to%61dmin, notadmin.%5Cdecodes to\, not/. Aliasing is the URL parser's job.MalformedURLErrorshape —name,statusCode,cause,instanceof Error.isMalformedURLErrorcontract — name-based detection for cross-bundle compatibility, with negative cases.Test plan
pnpm test pathMatcher— 34/34 pass (was 25, +9)