/** * Intelligent Test Pruning. * * Determines which test categories to run or skip based on tool characteristics * and testing history. Reduces test time while maintaining coverage where it matters. */ import type { MCPTool } from '../transport/types.js'; import type { ToolFingerprint, ErrorPattern } from './types.js'; /** * Test category type. */ export type TestCategory = 'happy_path' | 'boundary' | 'enum' | 'optional_combinations' | 'error_handling' | 'security' | 'semantic'; /** * Decision about a test category. */ export interface TestCategoryDecision { /** The test category */ category: TestCategory; /** Whether to run this category */ shouldRun: boolean; /** Reason for the decision */ reason: string; /** Priority if running (higher = more important) */ priority: number; } /** * Complete pruning decision for a tool. */ export interface ToolPruningDecision { /** Tool name */ toolName: string; /** Overall tool priority (0-100) */ priority: number; /** Decisions for each category */ categories: TestCategoryDecision[]; /** Categories that will run */ categoriesToRun: TestCategory[]; /** Categories that will skip */ categoriesToSkip: TestCategory[]; /** Estimated test reduction percentage */ reductionPercent: number; } /** * Tool characteristics for pruning decisions. */ export interface ToolCharacteristics { /** Number of parameters */ parameterCount: number; /** Number of required parameters */ requiredParamCount: number; /** Whether tool has numeric parameters */ hasNumericParams: boolean; /** Whether tool has enum parameters */ hasEnumParams: boolean; /** Whether tool has optional parameters */ hasOptionalParams: boolean; /** Whether tool has string parameters (for security testing) */ hasStringParams: boolean; /** Maximum nesting depth in schema */ maxNestingDepth: number; /** Whether tool has external dependencies */ hasExternalDependency: boolean; /** Error rate from previous testing (0-1) */ errorRate: number; /** Hours since last test (null if never tested) */ hoursSinceLastTest: number | null; /** Consecutive successful runs */ consecutiveSuccesses: number; } /** * Input for making pruning decisions. */ export interface PruningInput { /** Tool definition */ tool: MCPTool; /** Previous baseline fingerprint (if available) */ fingerprint?: ToolFingerprint; /** Error patterns from baseline */ errorPatterns?: ErrorPattern[]; /** All test categories that could run */ availableCategories: TestCategory[]; } /** * Calculate pruning decisions for a set of tools. */ export declare function calculatePruningDecisions(inputs: PruningInput[]): ToolPruningDecision[]; /** * Calculate pruning decision for a single tool. */ export declare function calculateToolPruning(input: PruningInput): ToolPruningDecision; /** * Prioritize tools for testing order. */ export declare function prioritizeTools(decisions: ToolPruningDecision[]): ToolPruningDecision[]; /** * Generate summary of pruning decisions. */ export interface PruningSummary { /** Total tools analyzed */ totalTools: number; /** Total categories that would run without pruning */ totalCategoriesWithoutPruning: number; /** Total categories that will run with pruning */ totalCategoriesWithPruning: number; /** Overall reduction percentage */ overallReduction: number; /** Tools with highest priority */ highPriorityTools: string[]; /** Tools with most categories skipped */ mostPrunedTools: string[]; } /** * Generate pruning summary. */ export declare function generatePruningSummary(decisions: ToolPruningDecision[]): PruningSummary; /** * Generate markdown report for pruning decisions. */ export declare function generatePruningMarkdown(decisions: ToolPruningDecision[], summary: PruningSummary): string; //# sourceMappingURL=test-pruner.d.ts.map