refactor: split squid-config.test.ts (1,964 lines) into 4 domain-focused test files#2556
refactor: split squid-config.test.ts (1,964 lines) into 4 domain-focused test files#2556
Conversation
…t files - squid-config-security.test.ts: injection defense, direct IP bypass, port validation, dangerous ports blocklist (407 lines) - squid-config-domains.test.ts: protocol domain handling, subdomains, wildcards, redundancy, ordering (528 lines) - squid-config-features.test.ts: logging, streaming, blocklist, SSL bump, DLP, empty domain list (687 lines) - squid-config.test.ts: configuration structure, protocol access rules, real-world patterns, generatePolicyManifest (359 lines) All 158 squid-config tests preserved and passing (1747 total).
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR reorganizes the squid-config unit suite by splitting the former large src/squid-config.test.ts file into smaller domain-focused test files. It fits the codebase by keeping the existing generateSquidConfig/generatePolicyManifest coverage while making individual areas of Squid policy behavior easier to locate and audit.
Changes:
- Split security-related
generateSquidConfigtests intosrc/squid-config-security.test.ts. - Split domain/protocol/wildcard behavior into
src/squid-config-domains.test.tsand logging/SSL/DLP/blocklist behavior intosrc/squid-config-features.test.ts. - Reduced
src/squid-config.test.tsto core config-structure, real-world pattern, protocol-order, andgeneratePolicyManifestcoverage.
Show a summary per file
| File | Description |
|---|---|
src/squid-config.test.ts |
Keeps the core Squid config and policy manifest assertions after the split. |
src/squid-config-security.test.ts |
New focused suite for injection defense, direct-IP bypass, and host-port safety tests. |
src/squid-config-features.test.ts |
New focused suite for logging, timeouts, blocklist, SSL bump, DLP, and empty-domain behavior. |
src/squid-config-domains.test.ts |
New focused suite for domain normalization, wildcard handling, ordering, and protocol-specific domain behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 3
|
|
||
| // Pattern constant for the safer domain character class (matches the implementation) | ||
| const DOMAIN_CHAR_PATTERN = '[a-zA-Z0-9.-]*'; | ||
|
|
| // Pattern constant for the safer domain character class (matches the implementation) | ||
| const DOMAIN_CHAR_PATTERN = '[a-zA-Z0-9.-]*'; |
|
|
||
| describe('generateSquidConfig', () => { | ||
| const defaultPort = 3128; | ||
|
|
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.
|
@copilot merge main and address the review feedback |
…d-config-tests Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
…g test docs - Export DOMAIN_CHAR_PATTERN from domain-patterns.ts as the single source of truth - Replace local const definitions in squid-config-domains.test.ts and squid-config-features.test.ts with an import from domain-patterns.ts - Update domain-patterns.test.ts to also import rather than redeclare the constant - Update CLAUDE.md to reference squid-config-features.test.ts for logging tests and use the correct test file name in the run-tests command
Done. In commit
|
|
✅ GitHub MCP: Last 2 merged PRs (#2571, #2538) Overall: PASS
|
🔥 Smoke Test: Copilot BYOK (Offline Mode)
Running in BYOK offline mode ( Author: Overall: PASS ✅
|
🔬 Smoke Test Results
PR: refactor: split squid-config.test.ts (1,964 lines) into 4 domain-focused test files Overall: PARTIAL — MCP ✅, pre-computed test data unavailable (template variables not expanded by workflow)
|
Smoke TestPRs: api-proxy: inject X-Initiator: agent default on all Copilot-bound requests to prevent billing inflation; fix: one-shot-token.so fails to load on musl/Alpine hosts (ARC runners) 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.
|
🔍 Chroot Version Comparison
Result: Not all versions matched —
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test Results — Services Connectivity
Overall: FAIL —
|
src/squid-config.test.tshad grown to 1,964 lines with 18 nesteddescribeblocks across 8 distinct test domains, making it hard to navigate and audit security coverage independently.Split
squid-config-security.test.tssquid-config-domains.test.tssquid-config-features.test.tssquid-config.test.ts(reduced)generatePolicyManifestAll 158 tests preserved with no logic changes. Security-focused tests (
defense-in-depth, direct IP bypass, dangerous ports) are now grouped in one file for easier auditability.