-
Notifications
You must be signed in to change notification settings - Fork 381
chore(repo): Group related machine auth tests #6524
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
Conversation
🦋 Changeset detectedLatest commit: aa7b09b 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 Git ↗︎
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
📝 WalkthroughWalkthroughAdded a new metadata file .changeset/eighty-plums-listen.md containing only YAML front-matter delimiters. Modified integration/presets/longRunningApps.ts: removed the long-running app entry id 'next.appRouter.withAPIKeys', added a machine-auth app entry id 'withMachine.next.appRouter' using config next.appRouter and envs.withAPIKeys, and removed an inline TODO comment. Updated test metadata/labels: integration/tests/machine-auth/api-keys.test.ts changed tag '@nextjs' → '@machine'; integration/tests/machine-auth/component.test.ts updated the test description to "api keys component @machine" and adjusted testAgainstRunningApps invocation to include withPattern: ['withMachine.next.appRouter']. Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
integration/tests/machine-auth/api-keys.test.ts (1)
10-10
: Good: re-tagging suite with '@machine' improves grouping consistencyNo functional changes; label update improves discoverability when running subsets by tag.
For full consistency across machine-auth tests, consider also tagging the second describe block with '@machine' (in addition to '@nextjs') so both suites are included when filtering by '@machine'. For example:
test.describe('Next.js API key auth within routes @machine @nextjs', () => { // ... });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.changeset/eighty-plums-listen.md
(1 hunks)integration/presets/longRunningApps.ts
(1 hunks)integration/tests/machine-auth/api-keys.test.ts
(1 hunks)integration/tests/machine-auth/component.test.ts
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{js,jsx,ts,tsx}
: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels
Files:
integration/tests/machine-auth/api-keys.test.ts
integration/tests/machine-auth/component.test.ts
integration/presets/longRunningApps.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
integration/tests/machine-auth/api-keys.test.ts
integration/tests/machine-auth/component.test.ts
integration/presets/longRunningApps.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
**/*.{ts,tsx}
: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertions
for literal types:as const
Usesatisfies
operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
integration/tests/machine-auth/api-keys.test.ts
integration/tests/machine-auth/component.test.ts
integration/presets/longRunningApps.ts
integration/**
📄 CodeRabbit Inference Engine (.cursor/rules/global.mdc)
Framework integration templates and E2E tests should be placed under the integration/ directory
Files:
integration/tests/machine-auth/api-keys.test.ts
integration/tests/machine-auth/component.test.ts
integration/presets/longRunningApps.ts
integration/**/*
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
End-to-end tests and integration templates must be located in the 'integration/' directory.
Files:
integration/tests/machine-auth/api-keys.test.ts
integration/tests/machine-auth/component.test.ts
integration/presets/longRunningApps.ts
integration/**/*.{test,spec}.{js,ts}
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Integration tests should use Playwright.
Files:
integration/tests/machine-auth/api-keys.test.ts
integration/tests/machine-auth/component.test.ts
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.
Files:
integration/tests/machine-auth/api-keys.test.ts
integration/tests/machine-auth/component.test.ts
integration/presets/longRunningApps.ts
**/*
⚙️ CodeRabbit Configuration File
If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.
Files:
integration/tests/machine-auth/api-keys.test.ts
integration/tests/machine-auth/component.test.ts
integration/presets/longRunningApps.ts
.changeset/**
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Automated releases must use Changesets.
Files:
.changeset/eighty-plums-listen.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Integration Tests (machine, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
🔇 Additional comments (2)
integration/presets/longRunningApps.ts (1)
52-54
: No stale references to ‘next.appRouter.withAPIKeys’ remain
- integration/presets/longRunningApps.ts:53 defines the only instance of the new id
withMachine.next.appRouter
- Searches return zero occurrences of the old id
next.appRouter.withAPIKeys
- All pattern-based selectors and tests reference env configs or other patterns (e.g.
next.appRouter.withEmailCodes
) and are unaffectedNo further changes are needed.
integration/tests/machine-auth/component.test.ts (1)
7-7
: Confirm @machine tag will be picked up by test runnerI checked integration/playwright.config.ts and found no built-in
grep
/grepInvert
filters—tag selection happens via the CLI (e.g.npx playwright test --grep @machine
). Since your test title now includes@machine
, it will be grouped and run as expected. No further changes are needed.
--- | ||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Empty Changeset is likely non-actionable and may confuse/impact the release workflow
This file only contains YAML front matter delimiters with no package bumps or summary. Depending on your Changesets setup, this can either be ignored or cause CI confusion. For test-only/grouping changes, prefer either removing the changeset entirely or adding a proper bump if a release is intended.
- If no release is intended: remove this file.
- If a release is intended: specify the packages and bump type, plus a short summary.
Run the following to inspect repo configs and references to the Changesets workflow to ensure an empty changeset is acceptable here:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "List changeset files:"
fd -a '^.+\.md$' .changeset || true
echo -e "\nShow Changesets config (if present):"
if [ -f ".changeset/config.json" ]; then
cat .changeset/config.json
else
echo "No .changeset/config.json found"
fi
echo -e "\nLook for GH Actions using changesets:"
fd -a ".github/workflows" | xargs -I{} rg -n "changeset|Changesets" {} || true
echo -e "\nSearch for Danger/CI rules that mandate changesets:"
rg -n "changeset|Changesets|require-changeset|no-changeset" -S . || true
echo -e "\nIf CI requires a changeset for every PR, confirm if an 'empty' changeset is allowed or if a special label should be used instead."
Length of output: 14405
Clarify Intent for This Empty Changeset
This file is an intentionally empty changeset (just the ---
front-matter) created by pnpm changeset:empty
. Per our CONTRIBUTING guide, empty changesets are supported as an “escape hatch” for internal refactors or test-only PRs and will not generate any changelog entries.
• If you intended not to produce a release or changelog entry, no further action is needed.
• If you do want to publish changes, update this file’s front-matter to list the affected package(s), bump type (patch/minor/major), and add a brief summary.
🤖 Prompt for AI Agents
In .changeset/eighty-plums-listen.md around lines 1 to 2, the changeset contains
only empty front-matter (---) so you must either leave it as-is if this PR is
intentionally test/internal and shouldn't produce a release, or update the
front-matter to declare the affected package(s), bump type, and a short summary;
to fix it, replace the front-matter with a YAML block listing the package names
and their release types (patch/minor/major) and add a one-line summary
describing the change so the changeset will generate a changelog/release for
those packages.
📝 WalkthroughWalkthrough
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.changeset/eighty-plums-listen.md
(1 hunks)integration/presets/longRunningApps.ts
(1 hunks)integration/tests/machine-auth/api-keys.test.ts
(1 hunks)integration/tests/machine-auth/component.test.ts
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{js,jsx,ts,tsx}
: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels
Files:
integration/tests/machine-auth/component.test.ts
integration/tests/machine-auth/api-keys.test.ts
integration/presets/longRunningApps.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
integration/tests/machine-auth/component.test.ts
integration/tests/machine-auth/api-keys.test.ts
integration/presets/longRunningApps.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
**/*.{ts,tsx}
: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertions
for literal types:as const
Usesatisfies
operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
integration/tests/machine-auth/component.test.ts
integration/tests/machine-auth/api-keys.test.ts
integration/presets/longRunningApps.ts
integration/**
📄 CodeRabbit Inference Engine (.cursor/rules/global.mdc)
Framework integration templates and E2E tests should be placed under the integration/ directory
Files:
integration/tests/machine-auth/component.test.ts
integration/tests/machine-auth/api-keys.test.ts
integration/presets/longRunningApps.ts
integration/**/*
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
End-to-end tests and integration templates must be located in the 'integration/' directory.
Files:
integration/tests/machine-auth/component.test.ts
integration/tests/machine-auth/api-keys.test.ts
integration/presets/longRunningApps.ts
integration/**/*.{test,spec}.{js,ts}
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Integration tests should use Playwright.
Files:
integration/tests/machine-auth/component.test.ts
integration/tests/machine-auth/api-keys.test.ts
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.
Files:
integration/tests/machine-auth/component.test.ts
integration/tests/machine-auth/api-keys.test.ts
integration/presets/longRunningApps.ts
**/*
⚙️ CodeRabbit Configuration File
If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.
Files:
integration/tests/machine-auth/component.test.ts
integration/tests/machine-auth/api-keys.test.ts
integration/presets/longRunningApps.ts
.changeset/**
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Automated releases must use Changesets.
Files:
.changeset/eighty-plums-listen.md
🧬 Code Graph Analysis (2)
integration/tests/machine-auth/component.test.ts (2)
integration/testUtils/index.ts (1)
testAgainstRunningApps
(88-88)integration/presets/index.ts (1)
appConfigs
(14-30)
integration/presets/longRunningApps.ts (2)
integration/presets/next.ts (1)
next
(48-54)integration/presets/envs.ts (1)
envs
(179-205)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Integration Tests (nextjs, chrome, 14)
- GitHub Check: Integration Tests (machine, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
🔇 Additional comments (2)
integration/tests/machine-auth/component.test.ts (1)
7-7
: Tag @machine – Verified no external referencesI’ve searched CI workflows (
.github/workflows
), local scripts,docs/
(and found none), and all integration tests. The only occurrences of@machine
(and remaining@generic
) are within the test files themselves and the updated long-running app preset (integration/presets/longRunningApps.ts
). No CI filters, scripts, or documentation reference the old or new tag. No further action needed.integration/presets/longRunningApps.ts (1)
53-53
: Verified unique id and no stale references in integration/presets/longRunningApps.tsAll checks passed:
- No duplicate
id
values in integration/presets/longRunningApps.ts (30 unique entries).- No remaining references to the old
next.appRouter.withAPIKeys
identifier.- The new
withMachine.next.appRouter
id only appears in the intended location.
--- | ||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid/empty Changeset frontmatter will break the Changesets pipeline
The file only contains an empty frontmatter block (---
… ---
) without any package release entries or summary. This typically causes the Changesets step to fail parsing.
Action:
- Either remove the changeset if your repo allows test-only PRs without a changeset, or
- Populate it with valid entries (use
none
for all relevant packages if you do not intend to publish), and add a short summary line.
Example template (replace PACKAGE_NAME with actual workspace package names):
---
'PACKAGE_NAME': none
---
chore(repo): Group related machine auth tests
I can help enumerate workspace package names to fill this properly if needed.
🤖 Prompt for AI Agents
.changeset/eighty-plums-listen.md lines 1-2: the changeset contains only an
empty frontmatter block which breaks the Changesets pipeline; either delete the
file if this PR shouldn't include a changeset, or replace the empty frontmatter
with valid frontmatter listing workspace package names and release types (use
'none' for packages you don't intend to publish) and add a short summary body
line beneath the frontmatter (e.g. three lines: frontmatter mapping, closing
dashes, and a one-line summary).
@@ -7,7 +7,7 @@ import { appConfigs } from '../../presets'; | |||
import type { FakeAPIKey, FakeUser } from '../../testUtils'; | |||
import { createTestUtils } from '../../testUtils'; | |||
|
|||
test.describe('Next.js API key auth within clerkMiddleware() @nextjs', () => { | |||
test.describe('Next.js API key auth within clerkMiddleware() @machine', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Switched tag to @machine — ensure tag-based runners are updated
The suite label now ends with "@machine". If your CI or dev tooling filters by tags (e.g., to shard or selectively run tests), update those filters accordingly. Consider tagging related suites consistently for easier targeting (e.g., also tagging Next.js-specific cases with @machine if they belong to the same group).
Run this to audit tag usage patterns in this file and related tests:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Tags in this file:"
rg -n --hidden -S "@[a-zA-Z0-9_-]+" integration/tests/machine-auth/api-keys.test.ts
echo
echo "All '@machine' test labels across machine-auth tests:"
rg -n --hidden -S "@machine" integration/tests/machine-auth
Length of output: 1249
Align test suite tagging for consistent filtering
There are two suites in integration/tests/machine-auth/api-keys.test.ts
:
- Line 10: tagged
@machine
- Line 100: tagged
@nextjs
only
If you want Next.js–specific machine-auth tests to run when filtering by @machine
, add the @machine
tag to the second suite. Otherwise, update your CI/dev-tool filters to account for @nextjs
-only suites.
• File: integration/tests/machine-auth/api-keys.test.ts
– Line 100: include @machine
alongside @nextjs
Suggested diff:
-test.describe('Next.js API key auth within routes @nextjs', () => {
+test.describe('Next.js API key auth within routes @nextjs @machine', () => {
📝 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.
test.describe('Next.js API key auth within clerkMiddleware() @machine', () => { | |
test.describe('Next.js API key auth within routes @nextjs @machine', () => { |
🤖 Prompt for AI Agents
In integration/tests/machine-auth/api-keys.test.ts around lines 10 and 100, the
second test suite at line 100 is tagged only with @nextjs while the first suite
is tagged @machine; update the second suite to include @machine alongside
@nextjs (e.g., add " @machine" to the suite's tag list) so filtering by @machine
includes both suites, or alternatively adjust CI/test filters if you intend to
keep it @nextjs-only.
Description
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Summary by CodeRabbit
Chores
Tests