Skip to content

Commit d487d78

Browse files
lpcoxCopilotCopilot
authored
fix: remove unused exports from public API surface (batch 2) (#3265)
* fix: remove unused exports from public API surface - Remove export from AwfFileConfig interface in config-file.ts (#3242) Callers use type inference, no external imports exist. - Remove export from cleanupFirewallNetwork in host-iptables-network.ts (#3244) Only used in tests; exposed via testHelpers object. - Remove export from validateFormat and handlePredownloadAction in subcommands.ts (#3245) — internal helpers, tests already assert these must not be in public API. Closes #3242, closes #3244, closes #3245 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent f8ebc27 commit d487d78

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/commands/subcommands.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import { OutputFormat } from '../types';
99
* @param validFormats - Array of valid format options
1010
* @throws Exits process with error if format is invalid
1111
*/
12-
export function validateFormat(format: string, validFormats: string[]): void {
12+
function validateFormat(format: string, validFormats: string[]): void {
1313
if (!validFormats.includes(format)) {
1414
logger.error(`Invalid format: ${format}. Must be one of: ${validFormats.join(', ')}`);
1515
process.exit(1);
1616
}
1717
}
1818

1919
/**
20-
* Predownload action handler — exported for testing.
20+
* Module-internal action handler for the `predownload` subcommand.
2121
*/
22-
export async function handlePredownloadAction(options: {
22+
async function handlePredownloadAction(options: {
2323
imageRegistry: string;
2424
imageTag: string;
2525
agentImage: string;

src/config-file.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import * as path from 'path';
33
import * as yaml from 'js-yaml';
44
import { validateWithSchema } from './schema-validator';
55

6-
export interface AwfFileConfig {
6+
/** @internal Used only within config-file.ts — not part of public API */
7+
interface AwfFileConfig {
78
$schema?: string;
89
network?: {
910
allowDomains?: string[];

src/host-iptables-network.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { execaResult, mockedExeca, setupHostIptablesTestSuite } from './test-helpers/host-iptables-test-setup';
2-
import { cleanupFirewallNetwork } from './host-iptables-network';
2+
import { testHelpers as networkTestHelpers } from './host-iptables-network';
33
import { ensureFirewallNetwork } from './host-iptables';
44
import { testHelpers } from './host-iptables-shared';
55

6+
const { cleanupFirewallNetwork } = networkTestHelpers;
7+
68
describe('host-iptables (network)', () => {
79
setupHostIptablesTestSuite(testHelpers.resetIpv6State);
810

src/host-iptables-network.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export async function ensureFirewallNetwork(): Promise<{
5151
/**
5252
* Removes the firewall network
5353
*/
54-
export async function cleanupFirewallNetwork(): Promise<void> {
54+
async function cleanupFirewallNetwork(): Promise<void> {
5555
logger.debug(`Removing firewall network '${NETWORK_NAME}'...`);
5656

5757
try {
@@ -62,3 +62,6 @@ export async function cleanupFirewallNetwork(): Promise<void> {
6262
// Don't throw - cleanup should be best-effort
6363
}
6464
}
65+
66+
/** @internal Exposed for testing only */
67+
export const testHelpers = { cleanupFirewallNetwork };

0 commit comments

Comments
 (0)