Skip to content

feat(cte): Custom Token Exchange tenant-config eval (CLI)#84

Open
sanchitmehtagit wants to merge 5 commits into
plumbingfrom
cte-legs
Open

feat(cte): Custom Token Exchange tenant-config eval (CLI)#84
sanchitmehtagit wants to merge 5 commits into
plumbingfrom
cte-legs

Conversation

@sanchitmehtagit

@sanchitmehtagit sanchitmehtagit commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Stacked on #82 (plumbing). Review/merge #82 first; this PR targets plumbing and will be retargeted to main once it lands. The diff shown here is CTE-only.

What this adds

Enterprise-leg eval for Custom Token Exchange (RFC 8693) tenant setup, mirroring the MFA Leg 2 architecture. Framework-agnostic, tenant-config only (no client SDK eval), and CLI-only — the Terraform axis was dropped from scope. Companion to the skill in auth0/agent-skills#132.

Eval Method Graders
cte_tenant_cli Auth0 CLI ranCommand(actions, custom-token-exchange) + ranCommand(actions, deploy) + ranCommand(token-exchange-profiles) + ranCommandsInOrder([actions, deploy, token-exchange-profiles]) + trace-aware holistic judge

Why the ordered CLI grader matters

A token-exchange-profile references an action_id, so the Action must be created and deployed before the profile that points at it — a genuine 3-step dependency ranCommandsInOrder enforces.

Co-located mock routes

The token-exchange mock surface lives with its eval, not in the shared mocks/ dir: src/evals/custom-token-exchange/tenant-cli/routes/ holds token-exchange.routes.json + fixtures/token-exchange/ + handlers.js (stateful POST actions, actions/<id>/deploy, POST token-exchange-profiles, and reads that reflect them). The dispatcher picks it up via the existing EVAL_MOCK_ROUTES_DIRS wiring — no engine change.

Shared CLI platform context (no scaffold)

cte_tenant_cli declares no scaffold:. Because it ships a routes/ dir, the loader auto-attaches the shared src/evals/contexts/cli-platform/AGENTS.md (added on #82). The old per-feature scaffold (which embedded the exact actions/token-exchange-profiles commands the graders check) is deleted — the eval now tests whether the agent knows the flow, not copy-paste. Platform context is guidance shared across all CLI evals, not per-eval starter code.

Removed

  • The cte_tenant_terraform eval and the scaffolds/terraform/cte scaffold — CLI is the only tenant-config axis now.

Testing

npm run build, npm run lint, npm test pass. token-exchange-route.test.ts exercises the co-located manifest via EVAL_MOCK_ROUTES_DIRS (6/6 green), including create → deploy → profile read-after-write.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 34d1a81c-8a3f-432a-8453-c26971671d2e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cte-legs

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.

@sanchitmehtagit
sanchitmehtagit force-pushed the cte-legs branch 6 times, most recently from bb4663b to e6ac213 Compare July 7, 2026 09:16
sanchitmehtagit and others added 2 commits July 7, 2026 14:51
Enterprise-leg evals for Custom Token Exchange (RFC 8693) tenant setup, mirroring
the MFA Leg 2 architecture. Framework-agnostic, tenant-config only (no client SDK
eval). Builds on the plumbing branch.

- cte_tenant_cli — create a custom-token-exchange validator Action, deploy it,
  then create a token-exchange-profile that references it, via the Auth0 CLI.
  Event graders (ranCommand for actions/custom-token-exchange, deploy,
  token-exchange-profiles) + ranCommandsInOrder (action → deploy → profile,
  since the profile references the deployed action) + a trace-aware holistic
  judge (includeCommandTrace).
- cte_tenant_terraform — declare an auth0_action (custom-token-exchange trigger)
  + auth0_token_exchange_profile in main.tf. matches / notContains / wroteFile
  + a file-based judge.

Mock: ships mocks/routes/token-exchange.sh — the actions + token-exchange-profiles
API surface as a self-contained route file loaded by the plumbing dispatcher,
with create → deploy → profile read-after-write state namespaced cte_*. Route
test included.

Scaffolds: cli/cte (platform-context) and terraform/cte (main.tf with provider
+ client/resource-server stubs but no action/profile, so a match is the agent's
work).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sanchitmehtagit and others added 2 commits July 8, 2026 15:19
…CLI scaffold

- Move the token-exchange surface (token-exchange.routes.json +
  fixtures/token-exchange/ + handlers.js) out of the shared apps/auth0-evals/mocks/
  into the consuming eval's own dir: custom-token-exchange/tenant-cli/routes/.
  Picked up via the existing EVAL_MOCK_ROUTES_DIRS wiring — no engine change.
- Delete the Terraform tenant-config eval (custom-token-exchange/tenant-terraform)
  and the terraform scaffold — CLI is the only tenant-config axis now.
- Repoint cte_tenant_cli at the shared generic scaffolds/cli/platform-context
  and delete the leaky per-feature scaffolds/cli/cte.
- token-exchange-route.test.ts now sets EVAL_MOCK_ROUTES_DIRS to the co-located dir.

Committed with --no-verify (same pre-existing lint-staged/eslint-config hook
limitation noted on mfa-legs); npm run lint + prettier pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The per-eval routes paragraph + layout diagram described the old central
mocks/routes/*.sh shell layout. Update to show manifests co-locating in each
eval's routes/ dir (guardian → mfa/tenant-cli, token-exchange → cte tenant-cli),
matching the reworded mocks/routes/README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sanchitmehtagit sanchitmehtagit changed the title feat(cte): Custom Token Exchange tenant-config evals (CLI & Terraform) feat(cte): Custom Token Exchange tenant-config eval (CLI) Jul 8, 2026
…text

The cte_tenant_cli eval no longer declares a scaffold. Its routes/ dir triggers
auto-injection of the shared src/evals/contexts/cli-platform/AGENTS.md (platform
context shared across all CLI-config evals, not per-eval starter code). Removes
the leaky per-feature scaffolds/cli/platform-context.

Depends on the loader convention landing on plumbing (#82).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant