PRININIT / src /eval /types.ts
Rachit-Tw's picture
Upload 50 files
7d9309d verified
Raw
History Blame Contribute Delete
2.87 kB
/**
* PRIX AI Evaluation System - Types
* Complete type definitions for test cases, results, and metrics
*/
export type IssueType =
| 'bug'
| 'security'
| 'performance'
| 'style'
| 'mutation'
| 'none'
export type ConfidenceLevel = 'high' | 'medium' | 'low'
export interface TestSuggestion {
filename: string
startLine: number
endLine: number
suggestion: string
confidence?: ConfidenceLevel
issueType?: IssueType
}
export interface ExpectedResult {
shouldDetectIssue: boolean
issueType?: IssueType
expectedConfidence?: ConfidenceLevel
shouldAutoPR: boolean
maxChangedLines?: number
expectedSuggestions?: TestSuggestion[]
shouldComment: boolean
metadata?: Record<string, any>
}
export interface TestOutput {
detectedIssues: boolean
issueType?: IssueType
confidence?: ConfidenceLevel
autoPRTriggered: boolean
suggestions: TestSuggestion[]
comments: ReviewComment[]
errors: string[]
executionTime: number
changedLines: number
}
export interface ReviewComment {
path: string
line: number
body: string
severity: 'info' | 'warning' | 'error'
}
export interface TestScore {
detection: boolean
classification: boolean
confidence: boolean
autoPR: boolean
overall: boolean
details: {
detectionMatch: boolean
typeMatch: boolean
confidenceMatch: boolean
autoPRMatch: boolean
suggestionCountMatch: boolean
}
}
export interface TestResult {
testName: string
testPath: string
category: string
passed: boolean
score: TestScore
output: TestOutput
expected: ExpectedResult
executionTime: number
timestamp: string
}
export interface MetricsSummary {
totalTests: number
passedTests: number
failedTests: number
accuracy: number
falsePositives: number
falseNegatives: number
autoPRPrecision: number
autoPRRecall: number
avgExecutionTime: number
byCategory: Record<string, CategoryMetrics>
}
export interface CategoryMetrics {
total: number
passed: number
failed: number
accuracy: number
}
export interface BaselineMetrics {
timestamp: string
version: string
summary: MetricsSummary
results: TestResult[]
}
export interface RegressionReport {
hasRegression: boolean
accuracyDelta: number
newFailures: string[]
fixedTests: string[]
details: string[]
}
export interface TestCase {
name: string
path: string
category: string
basePath: string
headPath: string
expected: ExpectedResult
}
export interface DiffFile {
filename: string
baseContent: string
headContent: string
diff: string
}
export interface MockPRContext {
number: number
title: string
body: string
base: {ref: string; sha: string}
head: {ref: string; sha: string}
files: DiffFile[]
}