Skip to content

fix(swift): accept webAuth(clientId:domain:) in async/await grader#144

Merged
sanchitmehtagit merged 1 commit into
mainfrom
fix/swift-webauth-grader-explicit-credentials
Jul 23, 2026
Merged

fix(swift): accept webAuth(clientId:domain:) in async/await grader#144
sanchitmehtagit merged 1 commit into
mainfrom
fix/swift-webauth-grader-explicit-credentials

Conversation

@sanchitmehtagit

@sanchitmehtagit sanchitmehtagit commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

The Swift quickstart L5 async/await grader regex required webAuth() with empty parens:

webAuth\(\)(?:\s*\.\w+\([^)]*\))*\s*\.start\(\)

So the explicit-credentials factory webAuth(clientId:domain:) never matched, and valid solutions failed the grader. Both forms are valid public Auth0.swift factories (verified against SDK source + README):

  • public func webAuth(session:bundle:) -> WebAuth — reads from Auth0.plist
  • public func webAuth(clientId:domain:session:) -> WebAuth — explicit credentials

This grader for hardcoding credentials should fail however webauth structural l5 grader should pass

Change

Widen the factory parens to webAuth\([^)]*\) so arguments are accepted, while keeping .start() empty — the empty call is what distinguishes async/await usage from the completion-handler form (.start { result in ... }) that this L5 grader is designed to reject.

Eval signal

From swift_quickstart / agent-mcp-skills in eval run 29835398213, 5 of 8 models failed this grader despite writing correct async/await code:

Model Grade async grader
claude-opus-4-8 A (94.5) FAIL — NOT matched
gpt-5.6-sol A (92.9) FAIL
gpt-5.6-luna / terra, gemini-3.5-flash B FAIL
claude-sonnet-5 A (97.2) PASS (used webAuth())
gemini-3.1-pro-preview A (98.2) PASS (used webAuth())

Opus scored an A (94.5) with correct code but still failed the version grader purely because it used the webAuth(clientId:domain:) form — a false negative this change fixes.

Test plan

Validated the new regex against positive and negative cases:

  • webAuth().start() -> match
  • Auth0.webAuth(clientId: "...", domain: "...").start() -> match
  • Auth0.webAuth(clientId: "...", domain: "...").useHTTPS().start() -> match
  • webAuth().scope("openid").start() -> match
  • multi-line webAuth(clientId:domain:)\n.start() -> match
  • webAuth().start { result in } -> no match (completion handler still rejected)
  • webAuth(clientId:domain:).start { result in } -> no match
  • npm run build + npm run lint pass

Context

Part of the eval flywheel. The grader should accept any valid API form; the companion skill fix (auth0/agent-skills#155) separately stops the skill from teaching the hardcoded-credentials variant that made lower-tier models trip the L3 security graders.

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.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The Swift L5 grader regex now accepts both parameterless and parameterized webAuth calls while continuing to require optional fluent builder chains and an empty .start() invocation.

Changes

Swift L5 grader

Layer / File(s) Summary
Broaden webAuth matching
apps/auth0-evals/src/evals/quickstarts/swift/graders.ts
The L5 pattern accepts webAuth() and webAuth(<args>) while preserving chained calls and the empty .start() requirement.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: frederikprijck

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: expanding the Swift async/await grader to accept explicit webAuth(clientId:domain:) syntax.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/swift-webauth-grader-explicit-credentials

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/auth0-evals/src/evals/quickstarts/swift/graders.ts`:
- Around line 45-46: Replace the broad webAuth matcher in the Swift grader with
validation that requires the supported named arguments and accepts nested
expressions such as function calls within argument values, while rejecting
unsupported forms like webAuth(foo).start(). Add regression coverage for both
accepted and rejected invocation shapes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 127a4fb4-9f3e-4018-a1fe-3004ed32ba03

📥 Commits

Reviewing files that changed from the base of the PR and between 13094f2 and 0705ef6.

📒 Files selected for processing (1)
  • apps/auth0-evals/src/evals/quickstarts/swift/graders.ts

Comment thread apps/auth0-evals/src/evals/quickstarts/swift/graders.ts
@sanchitmehtagit
sanchitmehtagit merged commit b3c29ca into main Jul 23, 2026
6 checks passed
@sanchitmehtagit
sanchitmehtagit deleted the fix/swift-webauth-grader-explicit-credentials branch July 23, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants