refactor: extract writeConfigs into dedicated config-writer module#3031
Conversation
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
✨ New Files (1 files)
Coverage comparison generated by |
|
Smoke Test Results: ❌ GitHub MCP: gh CLI not authenticated Overall: FAIL
|
Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( Overall: PASS ✅
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the Docker management layer by extracting the large writeConfigs implementation out of src/container-lifecycle.ts into a dedicated src/config-writer.ts module, keeping container lifecycle logic focused on starting/running/stopping containers while preserving the existing public API via src/docker-manager.ts.
Changes:
- Added
src/config-writer.tscontainingwriteConfigsand its dedicated dependencies (Squid config generation, compose generation, SSL bump setup, seccomp profile handling, directory initialization). - Removed
writeConfigs(and now-unused imports) fromsrc/container-lifecycle.ts, leaving only lifecycle responsibilities. - Updated
src/docker-manager.tsto re-exportwriteConfigsfrom./config-writerwhile continuing to re-export lifecycle functions from./container-lifecycle.
Show a summary per file
| File | Description |
|---|---|
| src/config-writer.ts | New module housing writeConfigs and all config-writing responsibilities previously embedded in container lifecycle. |
| src/container-lifecycle.ts | Removes writeConfigs and related imports to narrow scope to container startup/agent execution logic. |
| src/docker-manager.ts | Maintains backwards-compatible public API by re-exporting writeConfigs from the new module. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
Smoke Test Results
Overall: FAIL PR details could not be retrieved (MCP auth error).
|
|
Smoke Codex: 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.
|
Smoke Test Results
Overall: FAIL —
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Chroot Version Comparison Results
Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.
|
|
@copilot address the review feedback |
The automated review generated 0 comments — no issues were found across the 3 changed files. The PR is ready to merge as-is. |
|
@copilot fix this failing ci check https://github.com/github/gh-aw-firewall/actions/runs/25748550242/job/75619763092?pr=3031 |
This failure is pre-existing and not caused by these changes. The "Protocol & Security Tests" job also failed on The failure pattern ( |
container-lifecycle.tsmixed config-generation with container lifecycle concerns. ThewriteConfigsfunction (284 lines spanning Squid config, Docker Compose YAML, seccomp profiles, SSL cert setup, and directory initialization) was the primary offender, making the file 769 lines with three distinct responsibilities.Changes
src/config-writer.ts(new):writeConfigsand all imports it exclusively owns (js-yaml,generateSquidConfig,generatePolicyManifest,generateSessionCa,initSslDb,parseUrlPatterns,generateDockerCompose,redactDockerComposeSecrets,SslConfig,SQUID_PORT,API_PROXY_PORTS,getSafeHostUid/Gid,getRealUserHome,__AWF_SECCOMP_PROFILE__declare)src/container-lifecycle.ts: Reduced to its core concern —startContainers,runAgentCommand,fastKillAgentContainer, and the external-kill state flagssrc/docker-manager.ts: Re-exportswriteConfigsfrom./config-writerinstead of./container-lifecycle; all callers via this barrel are unaffectedNo logic was changed — this is a pure code movement.