Centralize AWF container IP topology constants and remove duplicated literals#4947
Conversation
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
This PR centralizes the fixed AWF container network topology (subnet + per-container reserved IPs) into shared exports, and updates runtime call sites to use those shared constants to reduce drift risk when network values change.
Changes:
- Added per-container reserved IP constants (
SQUID_IP,AGENT_IP,API_PROXY_IP,DOH_PROXY_IP,CLI_PROXY_IP) tosrc/host-iptables-shared.ts. - Replaced duplicated hard-coded IP/subnet literals in
ensureFirewallNetwork(), config generation, and CLI workflow wiring with shared constants. - Added a focused unit test asserting the exported constants match the expected fixed topology.
Show a summary per file
| File | Description |
|---|---|
| src/host-iptables-shared.ts | Introduces shared exports for reserved container IPs alongside existing network constants. |
| src/host-iptables-shared.test.ts | Adds a unit test to lock down the shared constant contract. |
| src/host-iptables-network.ts | Uses shared constants when returning the reserved IPs from ensureFirewallNetwork(). |
| src/config-writer.ts | Uses shared constants when writing networkConfig for compose/config generation. |
| src/cli-workflow.ts | Uses shared constants for DoH and CLI proxy host-iptables inputs. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 2
| export const NETWORK_SUBNET = '172.30.0.0/24'; | ||
| export const AWF_NETWORK_GATEWAY = '172.30.0.1'; | ||
| export const SQUID_IP = '172.30.0.10'; | ||
| export const AGENT_IP = '172.30.0.20'; | ||
| export const API_PROXY_IP = '172.30.0.30'; |
| expect(NETWORK_SUBNET).toBe('172.30.0.0/24'); | ||
| expect(SQUID_IP).toBe('172.30.0.10'); | ||
| expect(AGENT_IP).toBe('172.30.0.20'); | ||
| expect(API_PROXY_IP).toBe('172.30.0.30'); | ||
| expect(DOH_PROXY_IP).toBe('172.30.0.40'); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
Overall PASS
|
|
|
This comment has been minimized.
This comment has been minimized.
- Import getLocalDockerEnv from docker-host directly instead of the docker-manager barrel to avoid circular dependency - Replace literal IP/subnet strings in host-iptables-network.test.ts with imported constants for single-source-of-truth consistency Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
🔥 Smoke Test ResultsPR: Centralize AWF container IP topology constants and remove duplicated literals
Overall: PASS
|
🔥 Smoke Test: Copilot PAT — PASS
Overall: PASS — Auth mode: PAT (COPILOT_GITHUB_TOKEN) cc
|
Smoke Test: Copilot BYOK (Direct) Mode ✅ PASSTest Results:
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) with credential isolation: sidecar holds real key, agent sees placeholder only.
|
Chroot Smoke Test Results
Overall: ❌ FAILED — Python and Node.js versions differ between host and chroot.
|
|
Centralize AWF container IP topology constants and remove duplicated literals 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: GitHub Actions Services Connectivity
Overall: ❌ FAIL
|
Smoke Test Results: Gemini Engine
Overall Status: PASS 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.
|
The container IP topology (
172.30.0.{10,20,30,40,50}plus subnet) was duplicated across multiple modules, creating drift risk when network values change. This PR consolidates those values into shared exports and updates callers to consume a single source of truth.Shared network topology constants
src/host-iptables-shared.tsalongside existing subnet/gateway constants:SQUID_IP,AGENT_IP,API_PROXY_IP,DOH_PROXY_IP,CLI_PROXY_IPReplaced duplicated literals in runtime code
src/host-iptables-network.ts:ensureFirewallNetwork()now returns IPs from shared constants.src/config-writer.ts:networkConfignow uses shared constants for subnet + all sidecar/container IPs.src/cli-workflow.ts: DoH and CLI proxy host-iptables inputs now useDOH_PROXY_IPandCLI_PROXY_IP.Coverage for constant contract
src/host-iptables-shared.test.ts: added focused assertions that exported network constants match the expected fixed topology.