Skip to content

Split api-proxy auth tests into focused provider-aligned modules#5353

Merged
lpcox merged 3 commits into
mainfrom
copilot/refactor-split-auth-test-modules
Jun 21, 2026
Merged

Split api-proxy auth tests into focused provider-aligned modules#5353
lpcox merged 3 commits into
mainfrom
copilot/refactor-split-auth-test-modules

Conversation

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

containers/api-proxy/server.auth.test.js had grown into a 986-line cross-cutting bundle covering auth helpers, BYOK parsing/injection, Copilot enterprise auth, and Anthropic OIDC behavior. This change breaks that file into smaller modules that map directly to the source areas they exercise.

  • Test module split

    • Moved shared auth utility coverage into server.auth-utils.test.js
    • Moved Copilot auth helper coverage into copilot-auth.test.js
    • Moved BYOK parsing and injection coverage into copilot-byok.test.js
    • Moved Copilot enterprise/Azure OIDC coverage into copilot-adapter-enterprise.test.js
    • Moved Anthropic OIDC auth coverage into anthropic-adapter-auth.test.js
  • Scope preservation

    • Kept the existing assertions and coverage intact; this is a structural refactor of test layout, not a behavior change
    • Removed the original monolithic server.auth.test.js after relocating its describe blocks
  • Resulting layout

    • Tests now follow the same boundaries as the underlying modules, making provider-specific auth behavior easier to find and evolve independently
// before
containers/api-proxy/server.auth.test.js

// after
containers/api-proxy/copilot-auth.test.js
containers/api-proxy/copilot-byok.test.js
containers/api-proxy/copilot-adapter-enterprise.test.js
containers/api-proxy/anthropic-adapter-auth.test.js
containers/api-proxy/server.auth-utils.test.js

Copilot AI changed the title [WIP] Refactor to split server.auth.test.js into focused test modules Split api-proxy auth tests into focused provider-aligned modules Jun 21, 2026
Copilot AI requested a review from lpcox June 21, 2026 16:13
Copilot finished work on behalf of lpcox June 21, 2026 16:13
@lpcox lpcox marked this pull request as ready for review June 21, 2026 17:12
Copilot AI review requested due to automatic review settings June 21, 2026 17:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the api-proxy auth test suite by splitting the former monolithic server.auth.test.js into smaller, provider-aligned test modules to make auth coverage easier to navigate and evolve alongside the corresponding source areas.

Changes:

  • Removed containers/api-proxy/server.auth.test.js after relocating its describe blocks into focused test files.
  • Added provider-aligned Copilot and Anthropic auth test modules (BYOK, enterprise/GHES/GHEC, and OIDC flows).
  • Added a small shared “auth utils” test module for proxy header stripping and Copilot body-transform normalization.
Show a summary per file
File Description
containers/api-proxy/server.auth.test.js Removed the previous monolithic auth test file after splitting coverage into smaller modules.
containers/api-proxy/server.auth-utils.test.js Centralizes shared auth utility tests (header stripping + tool-call type normalization).
containers/api-proxy/copilot-auth.test.js Focused tests for Copilot auth helpers (token resolution, bearer stripping, GHES detection, error message).
containers/api-proxy/copilot-byok.test.js Focused tests for Copilot BYOK parsing and header/body injection behavior.
containers/api-proxy/copilot-adapter-enterprise.test.js Focused tests for Copilot enterprise auth formatting and Azure OIDC behavior.
containers/api-proxy/anthropic-adapter-auth.test.js Focused tests for Anthropic OIDC auth header behavior.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 6/6 changed files
  • Comments generated: 2

const fakeReq = { url: '/v1/chat/completions', method: 'POST', headers: {} };
const fakeModelsReq = { url: '/models', method: 'GET', headers: {} };

it('injects Authorization: ****** for BYOK inference request', () => {
Comment on lines +129 to +133
describe('createCopilotAdapter — Azure OIDC (Entra) getAuthHeaders', () => {
const fakeReq = { url: '/v1/chat/completions', method: 'POST', headers: {} };

it('exposes an Azure OIDC provider when AWF_AUTH_TYPE=github-oidc + AWF_AUTH_PROVIDER=azure', () => {
const adapter = createCopilotAdapter({
@lpcox

lpcox commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

- copilot-byok.test.js: rename test from 'injects Authorization: ******'
  to 'injects Authorization: ****** from BYOK key' so the name
  accurately reflects the concrete ****** the assertion checks
- docs/auth-matrix.md: update Azure OIDC row to point to
  copilot-adapter-enterprise.test.js:129+ (the new home of those tests)
  instead of the deleted server.auth.test.js:749+

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Done in the latest commit:

  • copilot-byok.test.js:136 — renamed the test from 'injects Authorization: ****** for BYOK inference request' to 'injects Authorization: ****** from BYOK key for inference request' so the name accurately describes what the assertion actually checks (the concrete ****** value), rather than implying a redacted placeholder.

  • docs/auth-matrix.md — updated the Copilot Azure OIDC row to point to copilot-adapter-enterprise.test.js:129+ instead of the deleted server.auth.test.js:749+.

Copilot finished work on behalf of lpcox June 21, 2026 17:31
@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit 4e07c51

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed...

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

Testing safeoutputs

@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 97.85% 97.89% 📈 +0.04%
Statements 97.78% 97.82% 📈 +0.04%
Functions 99.50% 99.50% ➡️ +0.00%
Branches 93.55% 93.58% 📈 +0.03%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/workdir-setup.ts 92.7% → 94.5% (+1.82%) 92.7% → 94.5% (+1.82%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Result
API Status ✅ PASS
GH Check ✅ PASS
File Status ✅ PASS

Overall result: PASS

Generated by Smoke Claude for issue #5353 · 36.8 AIC · ⊞ 3.1K ·

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot PAT Auth — PASS ✅

Test Result
GitHub MCP connectivity
GitHub.com HTTP ✅ 200
File write/read

Auth mode: PAT (COPILOT_GITHUB_TOKEN)
PR: Split api-proxy auth tests into focused provider-aligned modules
Author: @Copilot — Assignees: @lpcox, @Copilot

🔑 PAT report filed by Smoke Copilot PAT

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) ✅ PASS

  • ✅ GitHub MCP connectivity
  • ✅ GitHub.com (HTTP 200)
  • ✅ File write/read
  • ✅ BYOK inference (direct mode via api-proxy → api.githubcopilot.com)

Running in direct BYOK mode with COPILOT_PROVIDER_API_KEY forwarded to sidecar.

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Smoke Test Results — PASS

Test Result
GitHub MCP connectivity
GitHub.com HTTP ✅ 200
File write/read

PR: Split api-proxy auth tests into focused provider-aligned modules
Author: @Copilot | Assignees: @lpcox @Copilot

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox

Smoke Test Results:

  • MCP connectivity ✅
  • GitHub.com connectivity ✅
  • File write/read ✅
  • Direct BYOK inference ✅

Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra

Overall: PASS

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test

Merged PRs:

  • perf(security-guard): prioritize security-relevant files in PR diff
  • fix(smoke-claude): raise turn budget to 8 and fix add_comment usage

✅ GitHub page title contains GitHub
✅ temp file written and read back
✅ npm ci && npm run build

Overall: PASS

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Runtime Version Comparison

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3 ❌ NO
Node.js v24.16.0 v22.22.3 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: ❌ Not all versions match — smoke-chroot label not applied.

Go versions are aligned, but Python and Node.js differ between host and chroot environments.

Tested by Smoke Chroot

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Result Notes
Module Loading otel.js loads; exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled + test helpers
Test Suite 59/59 tests pass (otel.test.js + otel-fanout.test.js)
Env Var Forwarding api-proxy-service-config.ts forwards GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID, OTEL_SERVICE_NAME
Token Tracker Integration onUsage callback present in token-tracker-http.js (line 283 destructure, line 324 invocation)
OTEL Diagnostics No live span export (not inside api-proxy container); fallback FileSpanExporter active when no OTLP endpoint set — graceful degradation confirmed

All scenarios pass. OTEL tracing integration is fully functional.

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx 1/1 passed ✅ PASS
Node.js execa 1/1 passed ✅ PASS
Node.js p-limit 1/1 passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #5353 · 89.8 AIC · ⊞ 7.7K ·

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results

Check Result
Redis PING (host.docker.internal:6379) ❌ No response (timeout)
PostgreSQL pg_isready (host.docker.internal:5432) ❌ No response
PostgreSQL SELECT 1 ❌ Not attempted (pg_isready failed)

Overall: FAIL

host.docker.internal resolves to 172.17.0.1 but neither Redis nor PostgreSQL respond on that IP or on 127.0.0.1. The GitHub Actions service containers appear unreachable from this runner environment.

🔌 Service connectivity validated by Smoke Services

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Gemini Engine Validation

  1. GitHub MCP Testing: ❌ (Tools missing from declaration)
  2. GitHub.com Connectivity: ❌ (Status: 000, SSL Error 35)
  3. File Writing Testing: ✅
  4. Bash Tool Testing: ✅

Overall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini

@lpcox lpcox enabled auto-merge (squash) June 21, 2026 17:49
@lpcox lpcox merged commit fed3e1f into main Jun 21, 2026
86 of 90 checks passed
@lpcox lpcox deleted the copilot/refactor-split-auth-test-modules branch June 21, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants