[Test Coverage] squid-log-reader.ts: 100% coverage#5378
Conversation
Cover previously untested branches in squid-log-reader.ts: - Line 36 (continue): lines containing 'TCP_DENIED' that fail regex match - Lines 48-49 (catch): fs.readFileSync throws EISDIR when path is a directory - Lines 64-66 (normalizeTarget URL branch): URLs with '://' including port - Line 66 / 75: URL with no port → hostname-only → parseTarget no-colon path - Lines 67-68 (normalizeTarget catch): malformed URL triggers URL parse error - Line 81 (parseTarget): non-numeric port segment → domain-only BlockedTarget - proxyLogsDir option correctly overrides default squid-logs path Raises squid-log-reader.ts statement/branch/line/function coverage from ~80% to 100%. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
✨ New Files (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
Adds a dedicated Jest test suite to fully exercise previously uncovered branches in src/squid-log-reader.ts (Squid access.log denial scanning), bringing the file’s coverage up to 100% across statements/branches/functions/lines.
Changes:
- Add
src/squid-log-reader-coverage.test.tswith targeted cases for malformedTCP_DENIEDlines,readFileSyncerror handling, URL normalization branches, andparseTargetedge cases. - Add coverage for
proxyLogsDirbehavior by readingaccess.logfrom a custom directory.
Show a summary per file
| File | Description |
|---|---|
src/squid-log-reader-coverage.test.ts |
Adds focused branch-coverage tests for denial detection and target parsing in squid-log-reader.ts. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 2
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
✅ Copilot review passed with no inline comments. @github-actions[bot] Add the |
|
🔌 Smoke Services — All services reachable! ✅ |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
❌ Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed... |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
✅ Smoke Claude passed |
|
✅ Build Test Suite completed successfully! |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
✅ Smoke Gemini completed. All facets verified. 💎 Verifying safeoutputs |
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓 |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
🤖 Smoke Test Results
PR: [Test Coverage] squid-log-reader.ts: 100% coverage 🟢 Overall: PASS
|
Smoke Test: Claude Engine Validation
Overall result: PASS
|
|
✅ Smoke Test: Copilot BYOK (Direct Mode) — PASS
Running in direct BYOK mode via
|
|
Smoke Test: Copilot PAT Auth — PASS
PR: [Test Coverage] squid-log-reader.ts: 100% coverage by
|
|
Smoke test results:
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 Smoke Test Results
Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.
|
Smoke Test: Services Connectivity
Overall: FAIL —
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test Results
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.
|
|
[Test Coverage] squid-log-reader.ts: 100% coverage Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
|
🔍 Smoke Test: API Proxy OpenTelemetry Tracing
Summary: OTEL tracing is fully implemented and functional. Scenario 3's workflow check produces a false negative — the grep targets
|
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
What
Adds
src/squid-log-reader-coverage.test.ts— 10 new tests that cover every previously untested branch insrc/squid-log-reader.ts, raising it from ~80% to 100% across all four coverage metrics (statements, branches, functions, lines).Why
squid-log-reader.tsis a security-critical component: it scans Squid proxy logs to detect blocked domain attempts. Incomplete coverage left several error-handling paths untested, including the EISDIR catch block and edge cases in domain-target parsing.Covered lines / branches
continue)TCP_DENIEDbut failing the log-format regex were silently ignored without a testfs.readFileSyncerror path never exercisedEISDIRnormalizeTargetURL branch)://were never tested(example.com/redacted)as the URL fieldparseTargetno-colon)parseTargetcolonIndex = -1 branch(noport.example.com/redacted)as the URLnormalizeTargetcatch)new URL()→ catch fallback(redacted) which throwsTypeError: Invalid URL`parseTargetnon-digit port)notaportnever hit the!/^\d+$/guardexample.com:notaportas the targetVerification
All 10 new tests pass. Pre-existing tests remain green. Lint clean (
--max-warnings=0on the new file).