Refactor buildConfig by extracting API credential resolution#5759
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors buildConfig by extracting API-proxy credential/env resolution into a dedicated module, reducing buildConfig to mostly field mapping plus a couple of focused sub-builders. It also adds targeted unit tests for credential/env precedence behavior.
Changes:
- Added
src/commands/resolve-credentials.tsto centralize API credential/env + OIDC mapping resolution. - Simplified
src/commands/build-config.tsby delegating credential resolution and extractingchrootIdentity/dindhelpers. - Added
src/commands/resolve-credentials.test.tsto cover precedence and OIDC mapping behavior.
Show a summary per file
| File | Description |
|---|---|
| src/commands/resolve-credentials.ts | New module that resolves API proxy credentials, routing targets, auth headers, and OIDC-related config from options/env. |
| src/commands/resolve-credentials.test.ts | New unit tests validating env/option precedence, OIDC env mappings, and GitHub token precedence. |
| src/commands/build-config.ts | Refactored to delegate credential resolution and extract chrootIdentity / dind construction helpers. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Low
|
@copilot address review feedback |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓 |
|
✅ Contribution Check completed successfully! Contribution check complete for PR #5759: the PR appears to follow the applicable CONTRIBUTING.md guidelines based on the pre-fetched metadata, diff, and CONTRIBUTING.md content. No comment needed. |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
❌ Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed... |
|
🔌 Smoke Services — Service connectivity failed |
|
✅ Build Test Suite completed successfully! |
|
✅ Smoke Claude passed |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
✅ Smoke Gemini completed. All facets verified. 💎 Smoke test finished with FAIL status. |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
🚀 Security Guard has started processing this pull request |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
✨ New Files (1 files)
Coverage comparison generated by |
Fixed in the latest commit. Changed |
🔥 Smoke Test: PAT Auth — PASS
Auth mode: PAT (COPILOT_GITHUB_TOKEN)
|
🔥 Smoke Test ResultsPR: Refactor buildConfig by extracting API credential resolution
Overall: PASS (2/2 verifiable tests passed; file test skipped due to unresolved template variables)
|
Smoke Test: Claude Engine Validation
Overall result: PASS ✅
|
Smoke Test: Copilot BYOK (Direct) Mode✅ GitHub MCP connectivity — Confirmed (listed 2 merged PRs) Result: PASS (all smoke tests passed)
|
🔬 Smoke Test: API Proxy OpenTelemetry Tracing
All 5 scenarios pass. OTEL tracing integration is healthy on this branch.
|
|
fix: sysroot filter should not drop workspace custom mounts ✅
|
Chroot Smoke Test Results
Overall: ❌ FAILED — Python and Node.js versions differ between host and chroot. Go passed.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
|
|
Smoke Test: Gemini Engine Validation
PR Titles Reviewed:
Overall Status: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
|
✅ MCP merged PRs: fix: ensure chmod runs even when chown fails in rootless permission repair; refactor: split 309-line generateDockerCompose into focused phases 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)
|
buildConfighad grown into a 190-line mixed-responsibility function that combined config assembly, API credential/env resolution, and nested sub-object construction. This change separates the credential surface into its own module and trims the main assembly path down to field mapping plus small focused helpers.Extract credential resolution
src/commands/resolve-credentials.tsto centralize all API proxy credential and auth-related env lookup:Simplify
buildConfigsrc/commands/build-config.tsnow delegates:resolveApiCredentials(...)chrootIdentitycreation to a focused helperdindcreation to a focused helperWrapperConfig.Add focused unit coverage
src/commands/resolve-credentials.test.tsfor direct coverage of env/option precedence and OIDC mapping behavior.build-configintegration coverage for end-to-end assembly behavior.