Skip to content

feat: add E2E test for Claude OAuth token flow#53

Merged
Keith-CY merged 1 commit intodevelopfrom
feat/e2e-oauth-token
Mar 3, 2026
Merged

feat: add E2E test for Claude OAuth token flow#53
Keith-CY merged 1 commit intodevelopfrom
feat/e2e-oauth-token

Conversation

@dev01lay2
Copy link
Copy Markdown
Collaborator

Summary

Add E2E test coverage for the Claude OAuth token authentication path.

Changes

  1. clawpal-core/tests/oauth_e2e.rs — New E2E test that:

    • Creates a profile with an OAuth token (from claude setup-token)
    • Persists via upsert_profile / list_profiles
    • Probes Anthropic API using Authorization: Bearer header
    • Auto-skips when CLAUDE_OAUTH_TOKEN is not set
  2. src-tauri/src/commands/mod.rs — Fix run_provider_probe to auto-detect OAuth tokens (sk-ant-oat* / oauth_* prefix) and use Bearer auth instead of always using x-api-key header for Anthropic

  3. .github/workflows/e2e.yml — Add OAuth test step with CLAUDE_OAUTH_TOKEN secret

CI Configuration Required

In Settings → Environments → development (and optionally production):

Secret How to get it
ANTHROPIC_API_KEY console.anthropic.com/settings/keys
CLAUDE_OAUTH_TOKEN Run claude setup-token (Claude CLI) — token starts with sk-ant-oat

Both tests auto-skip when their respective secret is absent.

- New oauth_e2e.rs: creates profile with OAuth token, persists, and
  probes Anthropic API using Authorization: Bearer header
- Fix run_provider_probe to auto-detect OAuth tokens (sk-ant-oat* prefix)
  and use Bearer auth instead of x-api-key header
- Update e2e.yml workflow to run both API key and OAuth token tests
- Requires CLAUDE_OAUTH_TOKEN secret in GitHub environment
- Test auto-skips when token is absent (safe for local cargo test)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 3, 2026

📊 Test Coverage Report

Metric Base (develop) PR (feat/e2e-oauth-token) Delta
Lines 63.10% (3941/6246) 63.10% (3941/6246) ⚪ ±0.00%
Functions 57.81% (455/787) 57.81% (455/787) ⚪ ±0.00%
Regions 63.25% (6371/10073) 63.25% (6371/10073) ⚪ ±0.00%

Coverage measured by cargo llvm-cov (clawpal-core + clawpal-cli).

Copy link
Copy Markdown
Collaborator

@Keith-CY Keith-CY left a comment

Choose a reason for hiding this comment

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

Reviewed PR #53. No functional blockers found in the OAuth token E2E and probe/auth-header changes. Changes are consistent with existing profile_e2e patterns, and bearer-vs-x-api-key selection is correctly constrained to Anthropic token shape.

@Keith-CY Keith-CY merged commit 28b895c into develop Mar 3, 2026
4 checks passed
@Keith-CY Keith-CY deleted the feat/e2e-oauth-token branch March 5, 2026 08:36
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