refactor(types): split config.ts into focused modules and compose WrapperConfig by domain#2899
Conversation
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
✨ New Files (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Refactors src/types/config.ts by splitting the large mixed-responsibility module into focused type/constant modules, while keeping backward-compatible re-exports.
Changes:
- Extracted runtime port constants into
src/types/ports.ts. - Decomposed
WrapperConfiginto domain “slice” types and re-composed it insrc/types/wrapper-config.ts. - Added focused type modules (
log-level,rate-limit,upstream-proxy) and updatedindex.ts, docs, and a compatibility test.
Show a summary per file
| File | Description |
|---|---|
| src/types/wrapper-config.ts | Introduces WrapperConfigBase, domain option slices, and an intersection-composed WrapperConfig. |
| src/types/upstream-proxy.ts | New standalone UpstreamProxyConfig type module. |
| src/types/rate-limit.ts | New standalone RateLimitConfig type module. |
| src/types/ports.ts | New module for API/CLI proxy port constants. |
| src/types/log-level.ts | New standalone LogLevel union type module. |
| src/types/index.ts | Re-exports the new module structure (ports + wrapper-config slices + auxiliary types). |
| src/types/config.ts | Reduces to backward-compatible re-exports from the new modules. |
| src/types/config.test.ts | Adds tests to validate re-exports and WrapperConfig composition. |
| docs/architecture.md | Updates docs to reflect the new type module layout. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 9/9 changed files
- Comments generated: 4
| * - http://api-proxy:10000 - OpenAI API proxy (for Codex) {@link API_PROXY_PORTS.OPENAI} | ||
| * - http://api-proxy:10001 - Anthropic API proxy (for Claude) {@link API_PROXY_PORTS.ANTHROPIC} | ||
| * - http://api-proxy:10002 - GitHub Copilot API proxy {@link API_PROXY_PORTS.COPILOT} | ||
| * - http://api-proxy:10004 - OpenCode API proxy (defaults to Copilot/OpenAI routing) {@link API_PROXY_PORTS.OPENCODE} |
| export type ContainerImageOptions = Pick<WrapperConfigBase, | ||
| | 'imageRegistry' | ||
| | 'imageTag' | ||
| | 'buildLocal' | ||
| | 'skipPull' | ||
| | 'agentImage' | ||
| >; |
| export type WrapperConfig = | ||
| ContainerImageOptions | ||
| & NetworkOptions | ||
| & VolumeOptions | ||
| & SecurityOptions | ||
| & ApiProxyOptions | ||
| & RateLimitOptions | ||
| & RuntimeOptions; |
| enabled: boolean; | ||
| /** Max requests per minute per provider (default: 600 when enabled) */ | ||
| rpm: number; | ||
| /** Max requests per hour per provider (default: 1000) */ | ||
| rph: number; | ||
| /** Max request bytes per minute per provider (default: 52428800 = 50 MB) */ | ||
| bytesPm: number; |
🔬 Smoke Test Results
Overall: FAIL — Pre-computed template variables ( /cc
|
🔥 Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( Overall: PARTIAL — BYOK inference path confirmed working; MCP/pre-step data unavailable due to sandbox constraints.
|
Smoke Test Results
Status: PARTIAL PASS (3/4) — GitHub CLI auth issue needs investigation
|
|
Overall status: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Chroot Smoke Test Results
Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.
|
Smoke Test Results — FAIL
|
✨ Enhancement
src/types/config.tshad grown into a 1,116-line mixed-responsibility module combining runtime port constants, a 61-fieldWrapperConfig, and unrelated auxiliary types. This refactor separates those concerns into focused modules while preserving existing import paths via compatibility re-exports.What does this improve?
src/types/as the codebase evolves.Why is this valuable?
WrapperConfigmaintenance.config.ts/index.tsre-export compatibility.Implementation approach:
API_PROXY_PORTS,API_PROXY_HEALTH_PORT, andCLI_PROXY_PORTtosrc/types/ports.ts.src/types/wrapper-config.tswith domain slices:ContainerImageOptionsNetworkOptionsVolumeOptionsSecurityOptionsApiProxyOptionsRateLimitOptionsRuntimeOptionsWrapperConfigas an intersection of these domain types.src/types/upstream-proxy.ts(UpstreamProxyConfig)src/types/log-level.ts(LogLevel)src/types/rate-limit.ts(RateLimitConfig)src/types/config.tsnow re-exports from new modules.src/types/index.tsupdated to export the new module structure.src/types/config.test.tsfor re-export and composition coverage.