From 0705ef6cbf44bb5d3a412f3369aa1bbc0c11cdd4 Mon Sep 17 00:00:00 2001 From: Sanchit Mehta Date: Wed, 22 Jul 2026 16:31:12 +0530 Subject: [PATCH] fix(swift): accept webAuth(clientId:domain:) in async/await grader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The L5 async/await grader regex required `webAuth()` with empty parens, so the explicit-credentials factory `webAuth(clientId:domain:)` never matched and valid solutions failed the grader. Both `Auth0.webAuth()` (reads Auth0.plist) and `Auth0.webAuth(clientId:domain:)` are valid public Auth0.swift factories. Widen the parens to `webAuth\([^)]*\)` to accept arguments while keeping `.start()` empty — the empty call is what distinguishes async/await usage from the completion-handler form (`.start { result in ... }`) this grader is meant to reject. --- .../src/evals/quickstarts/swift/graders.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/auth0-evals/src/evals/quickstarts/swift/graders.ts b/apps/auth0-evals/src/evals/quickstarts/swift/graders.ts index 6c435313..ccd417e4 100644 --- a/apps/auth0-evals/src/evals/quickstarts/swift/graders.ts +++ b/apps/auth0-evals/src/evals/quickstarts/swift/graders.ts @@ -36,11 +36,14 @@ export function defineGraders() { ), // ── L5: Version-specific API correctness ────────────────────────────────── - // Allow chained builder calls (e.g. `.scope(...)`, `.useEphemeralSession()`) - // and newlines between webAuth() and .start() — the idiomatic fluent form - // `Auth0.webAuth().scope("...").start()` is correct async/await usage. + // Accept both `webAuth()` (reads Auth0.plist) and the explicit-credentials + // form `webAuth(clientId:domain:)` — both are valid public factories. Allow + // chained builder calls (e.g. `.scope(...)`, `.useEphemeralSession()`) and + // newlines between the factory and `.start()`. The empty `.start()` is what + // distinguishes async/await usage from the completion-handler form + // (`.start { result in ... }`), which this L5 grader is meant to reject. matches( - String.raw`webAuth\(\)(?:\s*\.\w+\([^)]*\))*\s*\.start\(\)`, + String.raw`webAuth\([^)]*\)(?:\s*\.\w+\([^)]*\))*\s*\.start\(\)`, 'Uses async/await webAuth().start() syntax (not completion handlers)', GraderLevel.L5, ),