Skip to content

refactor: split types.ts into domain-scoped modules#2497

Merged
lpcox merged 2 commits intomainfrom
refactor/split-types-into-modules
May 4, 2026
Merged

refactor: split types.ts into domain-scoped modules#2497
lpcox merged 2 commits intomainfrom
refactor/split-types-into-modules

Conversation

@lpcox
Copy link
Copy Markdown
Collaborator

@lpcox lpcox commented May 4, 2026

Summary

Split the 1,810-line monolithic src/types.ts into domain-scoped type modules under src/types/.

File Content
src/types/config.ts WrapperConfig (~943 lines), RateLimitConfig, UpstreamProxyConfig, LogLevel, port constants
src/types/docker.ts SquidConfig, DockerComposeConfig, DockerService, DockerNetwork, DockerVolume
src/types/policy.ts PolicyRule, PolicyManifest
src/types/logging.ts ParsedLogEntry, EnhancedLogEntry, BlockedTarget, LogSource, OutputFormat, LogStatsFormat
src/types/pid.ts PidTrackResult
src/types/index.ts Barrel re-export for full backwards compatibility

Backwards compatibility

All existing import { ... } from './types' statements work unchanged via the barrel re-export.

Testing

  • TypeScript build succeeds
  • All 1,725 tests pass (4 pre-existing failures unrelated)

Closes #2475

Move types from the monolithic src/types.ts into focused
modules under src/types/: config, docker, policy, logging,
and pid. A barrel index.ts re-exports everything for full
backwards compatibility.

Closes #2475

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 4, 2026 15:14
@lpcox lpcox requested a review from Mossaka as a code owner May 4, 2026 15:14
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the codebase’s TypeScript type definitions by replacing the former monolithic src/types.ts with domain-scoped modules under src/types/, while preserving existing import paths via a barrel src/types/index.ts.

Changes:

  • Added domain modules for policy, logging, PID tracking, and Docker-related types under src/types/.
  • Removed non-config type definitions from src/types/config.ts (leaving config-focused types/constants there).
  • Introduced src/types/index.ts to re-export all public types/constants for backward-compatible ./types / ../types imports.
Show a summary per file
File Description
src/types/config.ts Removes non-config types so this module focuses on wrapper/config-related types and constants.
src/types/docker.ts Introduces Docker Compose and Squid-related configuration types (plus docs) in a dedicated module.
src/types/index.ts Adds a barrel re-export to keep existing import paths stable.
src/types/logging.ts Moves log-related types into a dedicated module.
src/types/pid.ts Moves PID tracking result type into a dedicated module.
src/types/policy.ts Moves policy rule/manifest types into a dedicated module.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

Comment thread src/types/docker.ts
Comment on lines +188 to +190
volumes?: {
[key: string]: Record<string, unknown>;
};
@lpcox
Copy link
Copy Markdown
Collaborator Author

lpcox commented May 4, 2026

@copilot address the review feedback

Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

@copilot address the review feedback

Added a DockerVolume interface to src/types/docker.ts (commit 1ca12a7) that mirrors the Docker Compose volume spec (optional driver, driver_opts, external, name, labels). DockerComposeConfig.volumes now uses { [key: string]: DockerVolume } instead of the generic Record<string, unknown>, and DockerVolume is re-exported from the barrel src/types/index.ts.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3
Node.js v24.14.1 v20.20.2
Go go1.22.12 go1.22.12

Result: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

refactor: extract runWithSignalHandling helper
[Test Coverage] Add tests for parseDifcProxyHost and preserveIptablesAudit
GitHub MCP review: ❌
safeinputs-gh PR query: ❌
Playwright GitHub title: ✅
Tavily search: ❌
File write/read + bash cat: ✅
Discussion comment: ✅
Build AWF: ✅
Overall: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx All passed ✅ PASS
Node.js execa All passed ✅ PASS
Node.js p-limit All passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #2497 · ● 619.3K ·

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Smoke Test Results

Check Result
Redis PING ❌ Timeout (no response)
PostgreSQL pg_isready ❌ No response
PostgreSQL SELECT 1 ❌ Not reached

Overall: FAILhost.docker.internal is not reachable from this environment (connections timed out). Service containers may not be running or the hostname is not resolvable.

🔌 Service connectivity validated by Smoke Services

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

🤖 Smoke Test Results

Test Result
GitHub MCP connectivity
GitHub.com HTTP connectivity ⚠️ (pre-step data unavailable — template vars unsubstituted)
File write/read (smoke-test-copilot-25327720457.txt)

PR: refactor: split types.ts into domain-scoped modules
Author: @lpcox | Reviewer: @Mossaka

Overall: PASS (MCP and file I/O verified; HTTP step skipped due to missing pre-step data)

📰 BREAKING: Report filed by Smoke Copilot

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Smoke Test: Copilot BYOK (Offline) Mode

  1. ✅ GitHub MCP — PR listed successfully (PR refactor: extract runWithSignalHandling helper #2495: "refactor: extract runWithSignalHandling helper")
  2. ⚠️ GitHub.com connectivity — pre-step template vars not substituted; skipped
  3. ⚠️ File write/read — template vars not substituted; file not found at expected path
  4. ✅ BYOK inference — responding now confirms agent → api-proxy → api.githubcopilot.com path works

Running in BYOK offline mode (COPILOT_OFFLINE=true) via api-proxy → api.githubcopilot.com

Overall: PASS (core BYOK path functional; pre-step data unavailable due to unsubstituted template vars)

PR by @lpcox · Reviewer: @Mossaka

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Smoke Test Results — All tests passed ✅

Status: PASS

💥 [THE END] — Illustrated by Smoke Claude

@lpcox lpcox merged commit 0770abb into main May 4, 2026
76 of 85 checks passed
@lpcox lpcox deleted the refactor/split-types-into-modules branch May 4, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactoring] Split src/types.ts into domain-scoped type modules

3 participants