Narrow Squid module exports by internalizing helper functions#3961
Conversation
There was a problem hiding this comment.
Pull request overview
Narrows the public surface of src/squid/ modules by converting low-level helpers (generateProtocolRules, generateDenyRule, generateAccessRulesSection, generateDomainAcls, generateBlockedDomainAcls, generateConfigSections) into module-internal functions and exposing only higher-level facades (generateAccessRules, generateAclSections, buildConfigSections). config-generator.ts is updated to use the new facades, and a guard test asserts the internal helpers stay unexported.
Changes:
- Internalize helper functions in
access-rules.ts,acl-generator.ts, andconfig-sections.ts, exposing only new facade APIs. - Update
config-generator.tsto consume the new facades. - Add
internal-exports.test.tsto lock the reduced export surface.
Show a summary per file
| File | Description |
|---|---|
| src/squid/access-rules.ts | Drops export from three helpers and adds generateAccessRules facade. |
| src/squid/acl-generator.ts | Drops export from two helpers and adds generateAclSections facade. |
| src/squid/config-sections.ts | Makes generateConfigSections module-private, re-exports as buildConfigSections. |
| src/squid/config-generator.ts | Switches imports/usages to the new facade functions. |
| src/squid/internal-exports.test.ts | New guard test asserting the helper exports are not present. |
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: 0
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
Coverage comparison generated by |
Smoke Test: Claude Engine
Total: PASS
|
🔬 Smoke Test Results
PR: "Narrow Squid module exports by internalizing helper functions" — author: Overall: PARTIAL — MCP works; pre-computed test data was not injected into the agent prompt (raw
|
🔥 Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( Author: Overall: PASS (core BYOK path verified ✅)
|
|
Smoke test results: FAIL. Tool mcpscripts missing, Connectivity failed. 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.
|
Smoke Test Results — FAIL
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.
|
This comment has been minimized.
This comment has been minimized.
|
[Test Coverage] Cover uncovered branches in cli-workflow runMainWorkflow ✅
|
This change tightens the
src/squid/API surface by removing accidental exports of internal helpers that are only used byconfig-generator.ts. The exposed interface is reduced to higher-level composition functions while preserving existing config generation behavior.API surface reduction (targeted helpers)
src/squid/access-rules.ts: internalizedgenerateProtocolRulesgenerateDenyRulegenerateAccessRulesSectionsrc/squid/acl-generator.ts: internalizedgenerateDomainAclsgenerateBlockedDomainAclssrc/squid/config-sections.ts: internalizedgenerateConfigSectionsModule-level facade exports (replacement entry points)
generateAccessRules(...)inaccess-rules.tsto return:accessRulesSectiondenyRulegenerateAclSections(...)inacl-generator.tsto return:aclLinesblockedDomainConfigbuildConfigSectionsas the external entry point fromconfig-sections.ts.Call-site update
src/squid/config-generator.tsnow imports and uses only the new facades (generateAclSections,generateAccessRules,buildConfigSections) instead of helper-level functions.Export contract guard
src/squid/internal-exports.test.tsto assert that the helper symbols above are not exported and only the intended facade functions are exposed.