Skip to content

fix: remove unused exports from public API surface#2509

Merged
lpcox merged 2 commits into
mainfrom
fix/export-audit-unused-exports
May 4, 2026
Merged

fix: remove unused exports from public API surface#2509
lpcox merged 2 commits into
mainfrom
fix/export-audit-unused-exports

Conversation

@lpcox

@lpcox lpcox commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Remove export keywords from symbols that are never imported externally, reducing the public API surface and preventing unintended coupling across 11 files.

Symbols un-exported (18 total)

Symbol File
LogsCommandOptions src/commands/logs.ts
StreamOptions src/logs/log-streamer.ts + re-export in src/logs/index.ts
ParsedDomainList src/domain-patterns.ts
DomainProtocol, ParsedDomain src/domain-patterns.ts
Rule src/rules.ts
ImageDigestKey, ParsedImageTag src/image-tag.ts
AgentImageResult, ApiProxyValidationResult, FlagValidationResult, LocalhostProcessingResult src/cli.ts
StatsFormat src/commands/logs-stats.ts
SummaryFormat src/commands/logs-summary.ts
LoggingOptions, loadLogsWithErrorHandling src/commands/logs-command-helpers.ts
LogFormatterOptions src/logs/log-formatter.ts + re-export in src/logs/index.ts

Skipped (verified as imported externally)

Verification

  • npm run build
  • npm test ✅ (6 pre-existing failures, no new failures)

Closes #2488, closes #2492, closes #2499, closes #2500, closes #2502, closes #2504, closes #2505

Remove export keywords from symbols that are never imported
externally, reducing the public API surface and preventing
unintended coupling.

Symbols un-exported across 11 files:
- LogsCommandOptions, StreamOptions (logs modules)
- ParsedDomainList, DomainProtocol, ParsedDomain
- Rule, ImageDigestKey, ParsedImageTag
- AgentImageResult, ApiProxyValidationResult,
  FlagValidationResult, LocalhostProcessingResult
- StatsFormat, SummaryFormat, LoggingOptions,
  loadLogsWithErrorHandling, LogFormatterOptions

Skipped symbols that ARE imported externally:
- SslConfig, DockerService, DockerNetwork
- pid-tracker helpers (used in tests)
- discoverAndSelectSource, findPolicyManifestForSource

Closes #2488, closes #2492, closes #2499, closes #2500,
closes #2502, closes #2504, closes #2505

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 4, 2026 16:56
@lpcox lpcox requested a review from Mossaka as a code owner May 4, 2026 16:56
@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 github-actions Bot mentioned this pull request May 4, 2026

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.

Pull request overview

This PR reduces the TypeScript public API surface by un-exporting internal-only types/interfaces across the logs, domain parsing, image tag parsing, and rules subsystems, and by trimming a couple of barrel/CLI re-exports.

Changes:

  • Removed export from several internal option/result/types (Rule, StreamOptions, LogFormatterOptions, DomainProtocol/ParsedDomain/ParsedDomainList, ImageDigestKey/ParsedImageTag, LogsCommandOptions, StatsFormat/SummaryFormat, LoggingOptions, loadLogsWithErrorHandling).
  • Updated src/logs/index.ts to stop re-exporting LogFormatterOptions and StreamOptions.
  • Updated src/cli.ts to stop re-exporting several result types from other modules.
Show a summary per file
File Description
src/rules.ts Makes Rule interface module-private to reduce exported surface.
src/logs/log-streamer.ts Makes StreamOptions module-private.
src/logs/log-formatter.ts Makes LogFormatterOptions module-private.
src/logs/index.ts Removes barrel re-exports of LogFormatterOptions and StreamOptions.
src/image-tag.ts Makes ImageDigestKey/ParsedImageTag module-private.
src/domain-patterns.ts Makes DomainProtocol/ParsedDomain/ParsedDomainList module-private.
src/commands/logs.ts Makes LogsCommandOptions module-private.
src/commands/logs-summary.ts Makes SummaryFormat module-private.
src/commands/logs-stats.ts Makes StatsFormat module-private.
src/commands/logs-command-helpers.ts Makes LoggingOptions and loadLogsWithErrorHandling module-private.
src/cli.ts Removes several type re-exports to reduce CLI module’s exported surface.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (2)

src/cli.ts:64

  • Similar to AgentImageResult: this change removes the ApiProxyValidationResult type re-export from src/cli.ts, but ApiProxyValidationResult remains exported from src/api-proxy-config.ts. Without an exports map, it remains part of the package’s public API via subpath imports; consider also making the interface non-exported (or restricting subpaths) if the goal is to shrink the overall API surface.
  extractGhecDomainsFromServerUrl,
  extractGhesDomainsFromEngineApiTarget,
  resolveApiTargetsToAllowedDomains,
} from './api-proxy-config';

src/cli.ts:90

  • This removes FlagValidationResult/LocalhostProcessingResult from src/cli.ts re-exports, but both interfaces are still exported from src/option-parsers.ts. Because the package allows subpath imports, these types remain publicly importable unless the source declarations are also made non-exported (or subpath exports are restricted).
  escapeShellArg,
  joinShellArgs,
  parseEnvironmentVariables,
  parseVolumeMounts,
  formatItem,
} from './option-parsers';

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

Comment thread src/cli.ts
Comment on lines 47 to 51
DEFAULT_GEMINI_API_TARGET,
DEFAULT_COPILOT_API_TARGET,
} from './domain-utils';
export type { AgentImageResult } from './domain-utils';


@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@lpcox

lpcox commented May 4, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address the review feedback

…internal types

Remove export keyword from AgentImageResult, ApiProxyValidationResult,
FlagValidationResult, and LocalhostProcessingResult at their declaration
sites (not just the re-exports in cli.ts), so they are no longer part
of the public API surface even via subpath imports.

Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/3faeefa6-3921-40ef-97e4-26da8b105338

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented May 4, 2026

Copy link
Copy Markdown
Contributor

@copilot address the review feedback

Done in 5ad83f7. Removed the export keyword from the interface declarations themselves in their source files:

  • AgentImageResult in src/domain-utils.ts
  • ApiProxyValidationResult in src/api-proxy-config.ts
  • FlagValidationResult and LocalhostProcessingResult in src/option-parsers.ts

These types are used only within their own files, so no other imports were affected. TypeScript type-check and lint pass cleanly.

Copilot finished work on behalf of lpcox May 4, 2026 22:38
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🔥 Smoke Test: Copilot BYOK — PASS

Test Result
GitHub MCP connectivity
GitHub.com HTTP (200)
File write/read
BYOK inference (this response)

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

PR by @lpcox · reviewer @Mossaka · Overall: PASS

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Smoke Tests:
✅ GitHub MCP - Last 2 merged PRs:

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Smoke Test

Titles: "refactor: split docker-manager.ts into focused modules"; "refactor: split cli.ts into focused modules"
GitHub MCP
Safe Inputs GH
Playwright
Tavily
File/Bash
Discussion
Build
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

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results

Test Result
GitHub MCP connectivity
GitHub.com HTTP connectivity ❌ (template vars not expanded)
File write/read ❌ (template vars not expanded)

Overall: FAIL — pre-step template variables ($\{\{ steps.smoke-data.outputs.* }}) were not resolved at runtime.

PR: fix: remove unused exports from public API surface — author @lpcox, reviewer @Mossaka

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🏗️ 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 passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit 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 #2509 · ● 522.9K ·

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

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

Overall: ❌ Not all versions match. Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: GitHub Actions Services Connectivity

Check Result
Redis PING ❌ timeout/no response
PostgreSQL pg_isready ❌ no response
PostgreSQL SELECT 1 ❌ no response (pg_isready failed)

Overall: FAILhost.docker.internal is not reachable from this runner environment. Service containers may not be configured or the host alias is not resolvable.

🔌 Service connectivity validated by Smoke Services

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment