Skip to content

Split Squid configuration generation into focused modules - #12002

Merged
lpcox merged 4 commits into
mainfrom
copilot/refactor-squid-config-generator
Nov 23, 2026
Merged

lpcox merged 4 commits into
mainfrom
copilot/refactor-squid-config-generator

Conversation

@lpcox

@lpcox lpcox commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

The Squid generator mixes logging, proxy exceptions, ACL assembly, and runtime tuning. This refactor separates those responsibilities while preserving byte-identical output and order-sensitive security rules.

  • Section builders: Extract logging, OTLP ACL/access rules, CLI-proxy ACL/access rules, and static timeouts into four dedicated modules.
  • Composition root: Reduce the generator from 242 to 147 lines, retaining validation and existing rule insertion points. Callers remain unchanged.
  • Golden output: Capture pre-refactor snapshots for empty, default, combined-feature, and SSL Bump configurations. Mock the package version to avoid release-related snapshot churn.

@lpcox lpcox changed the title [WIP] Refactor src/squid/config-generator.ts into focused modules Split Squid configuration generation into focused modules Nov 23, 2026
@lpcox
lpcox marked this pull request as ready for review November 23, 2026 16:14
Copilot AI adaptive review requested due to automatic review settings November 23, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An unresolved type-safety nit in buildConfigSections could let a SquidConfig field rename compile unnoticed while the builder silently falls back to defaults.

1 open issue
What changed in this PR

Refactors AWF’s Squid configuration generator into focused modules, keeping callers unchanged and preserving security-rule ordering.

Changes:

  • Extract logging, telemetry collector rules, CLI-proxy rules, and runtime timeouts into four modules.
  • Keep validation and section ordering in the smaller composition root.
  • Add four golden-output snapshots with a fixed package version to guard against output changes.
File Description
src/​squid/​runtime-timeouts.ts Extracts the static timeout and tuning block.
src/​squid/​otlp-acl.ts Builds collector host/port ACLs and access rules.
src/​squid/​log-sections.ts Builds logging directives and privacy exclusions.
src/​squid/​config-generator.ts Composes extracted sections at existing insertion points.
src/​squid/​config-generator.test.ts Adds four golden-output cases with a version mock.
src/​squid/​cli-proxy-acl.ts Builds scoped CLI-proxy artifact access rules.
src/​squid/​__snapshots__/​config-generator.test.ts.snap Stores expected configuration output for regression checks.

Review effort: Max (adaptive)

Comment thread src/squid/config-generator.ts Resolved
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@lpcox
lpcox merged commit 2f6b20f into main Nov 23, 2026
39 of 41 checks passed
@lpcox
lpcox deleted the copilot/refactor-squid-config-generator branch November 23, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactoring] Split src/squid/config-generator.ts into focused modules

3 participants