Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/evals/graders/nextjs.grader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ export class NextjsGrader implements Grader {
const sdkImportChecks = await this.fileGrader.checkFileContains(middlewareFile, ['@workos-inc/authkit-nextjs']);
checks.push(...sdkImportChecks);

// Check for authkit integration: authkitMiddleware OR (authkit + handleAuthkitHeaders)
// Check for authkit integration: authkitMiddleware OR (authkit + handleAuthkitProxy, or its deprecated alias handleAuthkitHeaders)
const middlewareChecks = await this.fileGrader.checkFileContains(middlewareFile, ['authkitMiddleware']);
const composableChecks = await this.fileGrader.checkFileContains(middlewareFile, [
'authkit(',
'handleAuthkitHeaders',
/handleAuthkit(Proxy|Headers)\(/,
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
]);

const usesAuthkitMiddleware = middlewareChecks.every((c) => c.passed);
Expand All @@ -129,7 +129,7 @@ export class NextjsGrader implements Grader {
message: usesAuthkitMiddleware
? 'Uses authkitMiddleware'
: usesComposable
? 'Uses authkit() composable with handleAuthkitHeaders'
? 'Uses authkit() composable with handleAuthkitProxy'
: 'Missing authkitMiddleware or authkit() composable integration',
};
checks.push(authkitCheck);
Expand Down
11 changes: 5 additions & 6 deletions tests/evals/graders/react.grader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ export class ReactGrader implements Grader {
async grade(): Promise<GradeResult> {
const checks: GradeCheck[] = [];

// Check AuthKitProvider wrapper exists in entry file
// Can be main.tsx (Vite) or index.tsx (CRA)
// AuthKitProvider may live in the entry file or an app-owned provider module
checks.push(
await this.fileGrader.checkFileWithPattern(
'src/{main,index}.tsx',
'src/**/*.tsx',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Unused provider passes grading

If src/auth/Providers.tsx imports and renders AuthKitProvider and reads the environment config, this search accepts it even when the entry file never mounts it. A component using useAuth and a successful build can satisfy the remaining checks, so an app without the provider can receive a passing grade. Check that the matched provider is connected to the entry file.

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/evals/graders/react.grader.ts
Line: 32

Comment:
**Unused provider passes grading**

If `src/auth/Providers.tsx` imports and renders `AuthKitProvider` and reads the environment config, this search accepts it even when the entry file never mounts it. A component using `useAuth` and a successful build can satisfy the remaining checks, so an app without the provider can receive a passing grade. Check that the matched provider is connected to the entry file.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

['AuthKitProvider', '@workos-inc/authkit-react'],
'AuthKitProvider configured with correct SDK',
),
Expand All @@ -46,12 +45,12 @@ export class ReactGrader implements Grader {
),
);

// Check environment config in entry file
// Env config is read where AuthKitProvider is configured
// Supports both Vite (import.meta.env) and CRA (process.env)
checks.push(
await this.fileGrader.checkFileWithPattern(
'src/{main,index}.tsx',
[/VITE_WORKOS_CLIENT_ID|REACT_APP_WORKOS_CLIENT_ID|import\.meta\.env|process\.env/],
'src/**/*.tsx',
['AuthKitProvider', /VITE_WORKOS_CLIENT_ID|REACT_APP_WORKOS_CLIENT_ID|import\.meta\.env|process\.env/],
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
'Environment variable configuration',
),
);
Expand Down
Loading