@oneuptime/common 11.5.3 → 11.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/AIAgentTaskPullRequest.ts +56 -45
- package/Models/DatabaseModels/AIInsight.ts +748 -0
- package/Models/DatabaseModels/AIRun.ts +262 -0
- package/Models/DatabaseModels/CodeRepository.ts +42 -0
- package/Models/DatabaseModels/Dashboard.ts +3 -3
- package/Models/DatabaseModels/GlobalConfig.ts +105 -0
- package/Models/DatabaseModels/Index.ts +4 -8
- package/Models/DatabaseModels/InstanceHealthLog.ts +277 -0
- package/Models/DatabaseModels/LlmLog.ts +33 -0
- package/Models/DatabaseModels/Project.ts +123 -6
- package/Models/DatabaseModels/Runbook.ts +1 -1
- package/Server/API/AIAgentDataAPI.ts +802 -140
- package/Server/API/AIAgentTaskAPI.ts +132 -69
- package/Server/API/AIAgentTaskLogAPI.ts +65 -41
- package/Server/API/AIAgentTaskPullRequestAPI.ts +41 -0
- package/Server/API/AIInsightAPI.ts +220 -0
- package/Server/API/AIInvestigationAPI.ts +363 -1
- package/Server/API/CodeFixRunAPI.ts +251 -0
- package/Server/API/GitHubAPI.ts +246 -3
- package/Server/API/TelemetryExceptionAPI.ts +193 -48
- package/Server/EnvironmentConfig.ts +1 -1
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783943300000-DropServiceCodeRepository.ts +26 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783947444597-CodeFixRunsOnAIRun.ts +73 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783950962813-AddCodeFixTaskType.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783954040984-AddInstrumentationFixTasksFlag.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783957160597-MigrationName.ts +51 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783958542237-AddTaskContextToAIRun.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783965945957-AddInvestigationVerdictAndGrade.ts +47 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783970619301-AddFixGuardrailColumns.ts +53 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783970619302-DropLegacyAIAgentTaskTables.ts +31 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783977781677-AddCiStatusToFixPullRequests.ts +37 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783990000000-AddCompletionTokensToLlmLog.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784010274993-AddSentinelInsight.ts +75 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784010274994-AddSentinelInsightFlags.ts +37 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784030612266-RenameSentinelToAI.ts +203 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784033837629-MigrationName.ts +163 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +30 -0
- package/Server/Infrastructure/Queue.ts +82 -4
- package/Server/Infrastructure/Semaphore.ts +62 -1
- package/Server/Services/AIAgentService.ts +32 -0
- package/Server/Services/AIAgentTaskPullRequestService.ts +117 -0
- package/Server/Services/AIInsightService.ts +174 -0
- package/Server/Services/AIRunEventService.ts +63 -0
- package/Server/Services/AIRunService.ts +259 -1
- package/Server/Services/AIService.ts +249 -7
- package/Server/Services/AlertService.ts +4 -4
- package/Server/Services/CodeRepositoryService.ts +209 -0
- package/Server/Services/DashboardService.ts +11 -2
- package/Server/Services/GlobalConfigService.ts +148 -0
- package/Server/Services/IncidentService.ts +183 -38
- package/Server/Services/IncidentStateTimelineService.ts +24 -4
- package/Server/Services/Index.ts +4 -4
- package/Server/Services/{AIAgentTaskLogService.ts → InstanceHealthLogService.ts} +1 -1
- package/Server/Services/LlmLogService.ts +27 -0
- package/Server/Services/LlmProviderService.ts +108 -0
- package/Server/Services/MetricBaselineService.ts +123 -0
- package/Server/Services/MonitorService.ts +15 -0
- package/Server/Services/TelemetryExceptionService.ts +323 -116
- package/Server/Services/TraceAggregationService.ts +176 -0
- package/Server/Types/Workflow/ComponentCode.ts +6 -0
- package/Server/Types/Workflow/Components/AI/GenerateText.ts +326 -0
- package/Server/Types/Workflow/Components/Index.ts +2 -0
- package/Server/Utils/AI/Chat/ObservabilityAssistant.ts +1 -1
- package/Server/Utils/AI/CodeFix/CodeAgentWorkspaceGuard.ts +71 -0
- package/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.ts +243 -0
- package/Server/Utils/AI/CodeFix/CodeFixRunQueue.ts +131 -0
- package/Server/Utils/AI/CodeFix/FixRunBudget.ts +148 -0
- package/Server/Utils/AI/CodeFix/OpenPullRequestCap.ts +117 -0
- package/Server/Utils/AI/Eval/EvalCorpus.ts +369 -0
- package/Server/Utils/AI/Eval/EvalScores.ts +172 -0
- package/Server/Utils/AI/Eval/ReplayInvestigation.ts +87 -0
- package/Server/Utils/AI/PerfEvidence/SpanTreeAnalyzer.ts +676 -0
- package/Server/Utils/AI/{Sentinel/SentinelInvestigationEngine.ts → SRE/AIInvestigationEngine.ts} +58 -37
- package/Server/Utils/AI/{Sentinel/SentinelMemory.ts → SRE/AIMemory.ts} +3 -3
- package/Server/Utils/AI/{Sentinel → SRE}/AlertInvestigationRunner.ts +50 -20
- package/Server/Utils/AI/SRE/ConfidenceSignal.ts +293 -0
- package/Server/Utils/AI/SRE/FixFromIncidentTaskTrigger.ts +115 -0
- package/Server/Utils/AI/SRE/FixPerformanceTaskTrigger.ts +223 -0
- package/Server/Utils/AI/{Sentinel → SRE}/IncidentInvestigationRunner.ts +71 -21
- package/Server/Utils/AI/{Sentinel → SRE}/IncidentPostmortemRunner.ts +8 -8
- package/Server/Utils/AI/SRE/Insights/Detectors/ErrorLogSpikeDetector.ts +364 -0
- package/Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.ts +317 -0
- package/Server/Utils/AI/SRE/Insights/Detectors/Index.ts +27 -0
- package/Server/Utils/AI/SRE/Insights/Detectors/MetricDriftDetector.ts +221 -0
- package/Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.ts +238 -0
- package/Server/Utils/AI/SRE/Insights/Detectors/TraceLatencyRegressionDetector.ts +521 -0
- package/Server/Utils/AI/SRE/Insights/FixRouting.ts +242 -0
- package/Server/Utils/AI/SRE/Insights/InsightScanner.ts +290 -0
- package/Server/Utils/AI/SRE/Insights/InsightStore.ts +283 -0
- package/Server/Utils/AI/SRE/Insights/InsightTriageRunner.ts +242 -0
- package/Server/Utils/AI/SRE/Insights/Triage.ts +162 -0
- package/Server/Utils/AI/SRE/Insights/Types.ts +49 -0
- package/Server/Utils/AI/SRE/InstrumentationTaskTrigger.ts +212 -0
- package/Server/Utils/AI/SRE/InvestigationGrader.ts +282 -0
- package/Server/Utils/AI/{Sentinel → SRE}/InvestigationQueue.ts +114 -19
- package/Server/Utils/AI/{Sentinel → SRE}/README.md +4 -4
- package/Server/Utils/AI/SRE/SubjectCodeFixRun.ts +172 -0
- package/Server/Utils/AI/Toolbox/{SentinelActionTools.ts → AIActionTools.ts} +22 -1
- package/Server/Utils/AI/Toolbox/Index.ts +2 -2
- package/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.ts +526 -0
- package/Server/Utils/CodeRepository/GitHub/GitHub.ts +319 -1
- package/Server/Utils/CodeRepository/ServiceRepoLinkSuggester.ts +221 -0
- package/Server/Utils/CodeRepository/StackTraceRepoResolver.ts +571 -0
- package/Server/Utils/Execute.ts +34 -13
- package/Server/Utils/LLM/LLMService.ts +160 -30
- package/Server/Utils/Monitor/Criteria/SqlMonitorCriteria.ts +152 -0
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +29 -0
- package/Tests/Server/API/DashboardMasterPasswordAPI.test.ts +225 -0
- package/Tests/Server/Infrastructure/Queue.test.ts +227 -0
- package/Tests/Server/Infrastructure/SemaphorePermit.test.ts +159 -0
- package/Tests/Server/Services/AIAgentTaskPullRequestOutcomeStats.test.ts +154 -0
- package/Tests/Server/Services/AIInsightService.test.ts +324 -0
- package/Tests/Server/Services/AIRunCodeFixClaim.test.ts +401 -0
- package/Tests/Server/Services/AIRunHumanVerdict.test.ts +161 -0
- package/Tests/Server/Services/AIServiceDailyBudget.test.ts +95 -5
- package/Tests/Server/Services/AIServiceProjectAccess.test.ts +259 -0
- package/Tests/Server/Services/FixFromIncidentTaskTrigger.test.ts +249 -0
- package/Tests/Server/Services/FixPerformanceTaskTrigger.test.ts +274 -0
- package/Tests/Server/Services/GlobalConfigService.test.ts +80 -0
- package/Tests/Server/Services/IncidentInternalNoteAnnouncement.test.ts +1 -1
- package/Tests/Server/Services/InstrumentationTaskTrigger.test.ts +313 -0
- package/Tests/Server/Services/LlmProviderProjectOwned.test.ts +132 -0
- package/Tests/Server/Services/TelemetryExceptionAIFixReadiness.test.ts +405 -0
- package/Tests/Server/Services/TelemetryExceptionCodeFixRun.test.ts +322 -0
- package/Tests/Server/Services/TraceServiceLatencyProfile.test.ts +278 -0
- package/Tests/Server/Types/Workflow/Components/AIGenerateText.test.ts +722 -0
- package/Tests/Server/Utils/AI/{SentinelAlertGating.test.ts → AIAlertGating.test.ts} +19 -19
- package/Tests/Server/Utils/AI/AIConfidenceSignal.test.ts +362 -0
- package/Tests/Server/Utils/AI/{SentinelInvestigationQueue.test.ts → AIInvestigationQueue.test.ts} +19 -19
- package/Tests/Server/Utils/AI/CodeAgentWorkspaceGuard.test.ts +138 -0
- package/Tests/Server/Utils/AI/CodeFixAgentCompletion.test.ts +335 -0
- package/Tests/Server/Utils/AI/CodeFixRunQueue.test.ts +134 -0
- package/Tests/Server/Utils/AI/EvalCorpus.test.ts +209 -0
- package/Tests/Server/Utils/AI/EvalScores.test.ts +343 -0
- package/Tests/Server/Utils/AI/FixRunBudget.test.ts +218 -0
- package/Tests/Server/Utils/AI/Insights/ErrorLogSpikeDetector.test.ts +437 -0
- package/Tests/Server/Utils/AI/Insights/ExceptionSpikeDetector.test.ts +287 -0
- package/Tests/Server/Utils/AI/Insights/InsightDetectorsIndex.test.ts +34 -0
- package/Tests/Server/Utils/AI/Insights/InsightFixRouting.test.ts +572 -0
- package/Tests/Server/Utils/AI/Insights/InsightNeverThrowsHardening.test.ts +344 -0
- package/Tests/Server/Utils/AI/Insights/InsightScanner.test.ts +720 -0
- package/Tests/Server/Utils/AI/Insights/InsightStore.test.ts +467 -0
- package/Tests/Server/Utils/AI/Insights/InsightStoreHardening.test.ts +370 -0
- package/Tests/Server/Utils/AI/Insights/InsightTriage.test.ts +210 -0
- package/Tests/Server/Utils/AI/Insights/InsightTriageRunner.test.ts +221 -0
- package/Tests/Server/Utils/AI/Insights/InvestigationQueueInsightSubject.test.ts +328 -0
- package/Tests/Server/Utils/AI/Insights/MetricBaselineDrift.test.ts +182 -0
- package/Tests/Server/Utils/AI/Insights/MetricDriftDetector.test.ts +280 -0
- package/Tests/Server/Utils/AI/Insights/NewExceptionDetector.test.ts +259 -0
- package/Tests/Server/Utils/AI/Insights/TraceLatencyRegressionDetector.test.ts +770 -0
- package/Tests/Server/Utils/AI/InvestigationGrader.test.ts +343 -0
- package/Tests/Server/Utils/AI/LLMServiceRequestPolicy.test.ts +307 -0
- package/Tests/Server/Utils/AI/OpenPullRequestCap.test.ts +170 -0
- package/Tests/Server/Utils/AI/SpanTreeAnalyzer.test.ts +559 -0
- package/Tests/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.test.ts +158 -0
- package/Tests/Server/Utils/GitHubCheckRunsConclusion.test.ts +100 -0
- package/Tests/Server/Utils/GitHubPullRequestStateMapping.test.ts +50 -0
- package/Tests/Server/Utils/Monitor/Criteria/SqlMonitorCriteria.test.ts +266 -0
- package/Tests/Server/Utils/ServiceRepoLinkSuggester.test.ts +167 -0
- package/Tests/Server/Utils/StackTraceRepoResolver.test.ts +527 -0
- package/Tests/Types/AI/AIChatPermissionMode.test.ts +112 -0
- package/Tests/Types/AI/CodeFixTaskType.test.ts +152 -0
- package/Tests/Types/AI/FixPullRequestCiStatus.test.ts +181 -0
- package/Tests/Types/Monitor/MonitorStepSqlMonitor.test.ts +110 -0
- package/Tests/Types/Monitor/SqlDatabaseType.test.ts +55 -0
- package/Tests/Types/Workflow/AIGenerateTextMetadata.test.ts +180 -0
- package/Tests/UI/Components/TableBulkCsvExport.test.tsx +168 -0
- package/Tests/UI/Utils/TableColumnsToCsv.test.ts +523 -0
- package/Types/AI/AIChatTypes.ts +8 -0
- package/Types/AI/AIInsightEvidence.ts +77 -0
- package/Types/AI/AIInsightHumanVerdict.ts +15 -0
- package/Types/AI/AIInsightSeverity.ts +13 -0
- package/Types/AI/AIInsightStatus.ts +38 -0
- package/Types/AI/AIInsightType.ts +41 -0
- package/Types/AI/AIRunAutoGrade.ts +18 -0
- package/Types/AI/AIRunEventType.ts +5 -0
- package/Types/AI/AIRunHumanVerdict.ts +17 -0
- package/Types/AI/AIRunType.ts +6 -0
- package/Types/AI/CodeFixTaskContext.ts +88 -0
- package/Types/AI/CodeFixTaskType.ts +132 -0
- package/Types/AI/FixPullRequestCiStatus.ts +132 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.ts +67 -0
- package/Types/Incident/IncidentMetricType.ts +7 -0
- package/Types/Monitor/CriteriaFilter.ts +8 -0
- package/Types/Monitor/MonitorCriteriaInstance.ts +67 -0
- package/Types/Monitor/MonitorStep.ts +38 -0
- package/Types/Monitor/MonitorStepSqlMonitor.ts +141 -0
- package/Types/Monitor/MonitorType.ts +17 -0
- package/Types/Monitor/SqlDatabaseType.ts +49 -0
- package/Types/Monitor/SqlMonitor/SqlMonitorResponse.ts +28 -0
- package/Types/Permission.ts +11 -95
- package/Types/Probe/ProbeMonitorResponse.ts +2 -0
- package/Types/Runbook/RunbookStep.ts +26 -2
- package/Types/Runbook/RunbookStepType.ts +1 -0
- package/Types/Workflow/Component.ts +13 -0
- package/Types/Workflow/ComponentID.ts +1 -0
- package/Types/Workflow/Components/AI.ts +148 -0
- package/Types/Workflow/Components.ts +8 -0
- package/UI/Components/AI/GenerateFromAIModal.tsx +1 -1
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +11 -0
- package/UI/Components/MoreMenu/MoreMenu.tsx +1 -1
- package/UI/Components/Table/Table.tsx +38 -2
- package/UI/Utils/TableColumnsToCsv.ts +385 -0
- package/Utils/Monitor/MonitorMetricType.ts +1 -0
- package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js +59 -45
- package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AIInsight.js +795 -0
- package/build/dist/Models/DatabaseModels/AIInsight.js.map +1 -0
- package/build/dist/Models/DatabaseModels/AIRun.js +274 -0
- package/build/dist/Models/DatabaseModels/AIRun.js.map +1 -1
- package/build/dist/Models/DatabaseModels/CodeRepository.js +43 -0
- package/build/dist/Models/DatabaseModels/CodeRepository.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Dashboard.js +3 -3
- package/build/dist/Models/DatabaseModels/Dashboard.js.map +1 -1
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +110 -0
- package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +4 -8
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/InstanceHealthLog.js +304 -0
- package/build/dist/Models/DatabaseModels/InstanceHealthLog.js.map +1 -0
- package/build/dist/Models/DatabaseModels/LlmLog.js +35 -0
- package/build/dist/Models/DatabaseModels/LlmLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +127 -6
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Runbook.js +1 -1
- package/build/dist/Models/DatabaseModels/Runbook.js.map +1 -1
- package/build/dist/Server/API/AIAgentDataAPI.js +568 -85
- package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskAPI.js +100 -44
- package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskLogAPI.js +49 -25
- package/build/dist/Server/API/AIAgentTaskLogAPI.js.map +1 -1
- package/build/dist/Server/API/AIAgentTaskPullRequestAPI.js +27 -0
- package/build/dist/Server/API/AIAgentTaskPullRequestAPI.js.map +1 -1
- package/build/dist/Server/API/AIInsightAPI.js +140 -0
- package/build/dist/Server/API/AIInsightAPI.js.map +1 -0
- package/build/dist/Server/API/AIInvestigationAPI.js +257 -1
- package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
- package/build/dist/Server/API/CodeFixRunAPI.js +181 -0
- package/build/dist/Server/API/CodeFixRunAPI.js.map +1 -0
- package/build/dist/Server/API/GitHubAPI.js +164 -2
- package/build/dist/Server/API/GitHubAPI.js.map +1 -1
- package/build/dist/Server/API/TelemetryExceptionAPI.js +148 -43
- package/build/dist/Server/API/TelemetryExceptionAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +1 -1
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783943300000-DropServiceCodeRepository.js +23 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783943300000-DropServiceCodeRepository.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783947444597-CodeFixRunsOnAIRun.js +32 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783947444597-CodeFixRunsOnAIRun.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783950962813-AddCodeFixTaskType.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783950962813-AddCodeFixTaskType.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783954040984-AddInstrumentationFixTasksFlag.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783954040984-AddInstrumentationFixTasksFlag.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783957160597-MigrationName.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783957160597-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783958542237-AddTaskContextToAIRun.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783958542237-AddTaskContextToAIRun.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783965945957-AddInvestigationVerdictAndGrade.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783965945957-AddInvestigationVerdictAndGrade.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783970619301-AddFixGuardrailColumns.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783970619301-AddFixGuardrailColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783970619302-DropLegacyAIAgentTaskTables.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783970619302-DropLegacyAIAgentTaskTables.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783977781677-AddCiStatusToFixPullRequests.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783977781677-AddCiStatusToFixPullRequests.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783990000000-AddCompletionTokensToLlmLog.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783990000000-AddCompletionTokensToLlmLog.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784010274993-AddSentinelInsight.js +32 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784010274993-AddSentinelInsight.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784010274994-AddSentinelInsightFlags.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784010274994-AddSentinelInsightFlags.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784030612266-RenameSentinelToAI.js +125 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784030612266-RenameSentinelToAI.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784033837629-MigrationName.js +62 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784033837629-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +30 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Queue.js +73 -3
- package/build/dist/Server/Infrastructure/Queue.js.map +1 -1
- package/build/dist/Server/Infrastructure/Semaphore.js +44 -1
- package/build/dist/Server/Infrastructure/Semaphore.js.map +1 -1
- package/build/dist/Server/Services/AIAgentService.js +29 -0
- package/build/dist/Server/Services/AIAgentService.js.map +1 -1
- package/build/dist/Server/Services/AIAgentTaskPullRequestService.js +78 -0
- package/build/dist/Server/Services/AIAgentTaskPullRequestService.js.map +1 -1
- package/build/dist/Server/Services/AIInsightService.js +164 -0
- package/build/dist/Server/Services/AIInsightService.js.map +1 -0
- package/build/dist/Server/Services/AIRunEventService.js +49 -0
- package/build/dist/Server/Services/AIRunEventService.js.map +1 -1
- package/build/dist/Server/Services/AIRunService.js +221 -0
- package/build/dist/Server/Services/AIRunService.js.map +1 -1
- package/build/dist/Server/Services/AIService.js +198 -11
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/AlertService.js +4 -4
- package/build/dist/Server/Services/AlertService.js.map +1 -1
- package/build/dist/Server/Services/CodeRepositoryService.js +180 -0
- package/build/dist/Server/Services/CodeRepositoryService.js.map +1 -1
- package/build/dist/Server/Services/DashboardService.js +8 -2
- package/build/dist/Server/Services/DashboardService.js.map +1 -1
- package/build/dist/Server/Services/GlobalConfigService.js +84 -0
- package/build/dist/Server/Services/GlobalConfigService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +149 -37
- package/build/dist/Server/Services/IncidentService.js.map +1 -1
- package/build/dist/Server/Services/IncidentStateTimelineService.js +24 -4
- package/build/dist/Server/Services/IncidentStateTimelineService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +4 -4
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/{AIAgentTaskLogService.js → InstanceHealthLogService.js} +2 -2
- package/build/dist/Server/Services/InstanceHealthLogService.js.map +1 -0
- package/build/dist/Server/Services/LlmLogService.js +23 -0
- package/build/dist/Server/Services/LlmLogService.js.map +1 -1
- package/build/dist/Server/Services/LlmProviderService.js +96 -0
- package/build/dist/Server/Services/LlmProviderService.js.map +1 -1
- package/build/dist/Server/Services/MetricBaselineService.js +65 -0
- package/build/dist/Server/Services/MetricBaselineService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +9 -1
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryExceptionService.js +243 -82
- package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -1
- package/build/dist/Server/Services/TraceAggregationService.js +124 -0
- package/build/dist/Server/Services/TraceAggregationService.js.map +1 -1
- package/build/dist/Server/Types/Workflow/ComponentCode.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/AI/GenerateText.js +240 -0
- package/build/dist/Server/Types/Workflow/Components/AI/GenerateText.js.map +1 -0
- package/build/dist/Server/Types/Workflow/Components/Index.js +2 -0
- package/build/dist/Server/Types/Workflow/Components/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/CodeFix/CodeAgentWorkspaceGuard.js +48 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeAgentWorkspaceGuard.js.map +1 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.js +174 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixAgentCompletion.js.map +1 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixRunQueue.js +126 -0
- package/build/dist/Server/Utils/AI/CodeFix/CodeFixRunQueue.js.map +1 -0
- package/build/dist/Server/Utils/AI/CodeFix/FixRunBudget.js +131 -0
- package/build/dist/Server/Utils/AI/CodeFix/FixRunBudget.js.map +1 -0
- package/build/dist/Server/Utils/AI/CodeFix/OpenPullRequestCap.js +99 -0
- package/build/dist/Server/Utils/AI/CodeFix/OpenPullRequestCap.js.map +1 -0
- package/build/dist/Server/Utils/AI/Eval/EvalCorpus.js +245 -0
- package/build/dist/Server/Utils/AI/Eval/EvalCorpus.js.map +1 -0
- package/build/dist/Server/Utils/AI/Eval/EvalScores.js +83 -0
- package/build/dist/Server/Utils/AI/Eval/EvalScores.js.map +1 -0
- package/build/dist/Server/Utils/AI/Eval/ReplayInvestigation.js +12 -0
- package/build/dist/Server/Utils/AI/Eval/ReplayInvestigation.js.map +1 -0
- package/build/dist/Server/Utils/AI/PerfEvidence/SpanTreeAnalyzer.js +439 -0
- package/build/dist/Server/Utils/AI/PerfEvidence/SpanTreeAnalyzer.js.map +1 -0
- package/build/dist/Server/Utils/AI/{Sentinel/SentinelInvestigationEngine.js → SRE/AIInvestigationEngine.js} +47 -31
- package/build/dist/Server/Utils/AI/SRE/AIInvestigationEngine.js.map +1 -0
- package/build/dist/Server/Utils/AI/{Sentinel/SentinelMemory.js → SRE/AIMemory.js} +5 -5
- package/build/dist/Server/Utils/AI/SRE/AIMemory.js.map +1 -0
- package/build/dist/Server/Utils/AI/{Sentinel → SRE}/AlertInvestigationRunner.js +42 -19
- package/build/dist/Server/Utils/AI/SRE/AlertInvestigationRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/ConfidenceSignal.js +226 -0
- package/build/dist/Server/Utils/AI/SRE/ConfidenceSignal.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/FixFromIncidentTaskTrigger.js +100 -0
- package/build/dist/Server/Utils/AI/SRE/FixFromIncidentTaskTrigger.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/FixPerformanceTaskTrigger.js +174 -0
- package/build/dist/Server/Utils/AI/SRE/FixPerformanceTaskTrigger.js.map +1 -0
- package/build/dist/Server/Utils/AI/{Sentinel → SRE}/IncidentInvestigationRunner.js +60 -22
- package/build/dist/Server/Utils/AI/SRE/IncidentInvestigationRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/{Sentinel → SRE}/IncidentPostmortemRunner.js +9 -9
- package/build/dist/Server/Utils/AI/SRE/IncidentPostmortemRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/ErrorLogSpikeDetector.js +268 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/ErrorLogSpikeDetector.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.js +226 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/Index.js +26 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/Index.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/MetricDriftDetector.js +159 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/MetricDriftDetector.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.js +177 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/TraceLatencyRegressionDetector.js +384 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/TraceLatencyRegressionDetector.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/FixRouting.js +180 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/FixRouting.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightScanner.js +269 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightScanner.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightStore.js +231 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightStore.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightTriageRunner.js +206 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightTriageRunner.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Triage.js +121 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Triage.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Types.js +2 -0
- package/build/dist/Server/Utils/AI/SRE/Insights/Types.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/InstrumentationTaskTrigger.js +148 -0
- package/build/dist/Server/Utils/AI/SRE/InstrumentationTaskTrigger.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/InvestigationGrader.js +231 -0
- package/build/dist/Server/Utils/AI/SRE/InvestigationGrader.js.map +1 -0
- package/build/dist/Server/Utils/AI/{Sentinel → SRE}/InvestigationQueue.js +102 -23
- package/build/dist/Server/Utils/AI/SRE/InvestigationQueue.js.map +1 -0
- package/build/dist/Server/Utils/AI/SRE/SubjectCodeFixRun.js +167 -0
- package/build/dist/Server/Utils/AI/SRE/SubjectCodeFixRun.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/{SentinelActionTools.js → AIActionTools.js} +18 -2
- package/build/dist/Server/Utils/AI/Toolbox/AIActionTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +2 -2
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.js +301 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/ClickhouseCapacity.js.map +1 -0
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js +240 -2
- package/build/dist/Server/Utils/CodeRepository/GitHub/GitHub.js.map +1 -1
- package/build/dist/Server/Utils/CodeRepository/ServiceRepoLinkSuggester.js +127 -0
- package/build/dist/Server/Utils/CodeRepository/ServiceRepoLinkSuggester.js.map +1 -0
- package/build/dist/Server/Utils/CodeRepository/StackTraceRepoResolver.js +336 -0
- package/build/dist/Server/Utils/CodeRepository/StackTraceRepoResolver.js.map +1 -0
- package/build/dist/Server/Utils/Execute.js +21 -11
- package/build/dist/Server/Utils/Execute.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +125 -25
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/SqlMonitorCriteria.js +120 -0
- package/build/dist/Server/Utils/Monitor/Criteria/SqlMonitorCriteria.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +21 -0
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Types/AI/AIInsightEvidence.js +2 -0
- package/build/dist/Types/AI/AIInsightEvidence.js.map +1 -0
- package/build/dist/Types/AI/AIInsightHumanVerdict.js +16 -0
- package/build/dist/Types/AI/AIInsightHumanVerdict.js.map +1 -0
- package/build/dist/Types/AI/AIInsightSeverity.js +14 -0
- package/build/dist/Types/AI/AIInsightSeverity.js.map +1 -0
- package/build/dist/Types/AI/AIInsightStatus.js +36 -0
- package/build/dist/Types/AI/AIInsightStatus.js.map +1 -0
- package/build/dist/Types/AI/AIInsightType.js +42 -0
- package/build/dist/Types/AI/AIInsightType.js.map +1 -0
- package/build/dist/Types/AI/AIRunAutoGrade.js +19 -0
- package/build/dist/Types/AI/AIRunAutoGrade.js.map +1 -0
- package/build/dist/Types/AI/AIRunEventType.js +5 -0
- package/build/dist/Types/AI/AIRunEventType.js.map +1 -1
- package/build/dist/Types/AI/AIRunHumanVerdict.js +18 -0
- package/build/dist/Types/AI/AIRunHumanVerdict.js.map +1 -0
- package/build/dist/Types/AI/AIRunType.js +6 -0
- package/build/dist/Types/AI/AIRunType.js.map +1 -1
- package/build/dist/Types/AI/CodeFixTaskContext.js +29 -0
- package/build/dist/Types/AI/CodeFixTaskContext.js.map +1 -0
- package/build/dist/Types/AI/CodeFixTaskType.js +122 -0
- package/build/dist/Types/AI/CodeFixTaskType.js.map +1 -0
- package/build/dist/Types/AI/FixPullRequestCiStatus.js +102 -0
- package/build/dist/Types/AI/FixPullRequestCiStatus.js.map +1 -0
- package/build/dist/Types/BaseDatabase/AggregationIntervalUtil.js +55 -0
- package/build/dist/Types/BaseDatabase/AggregationIntervalUtil.js.map +1 -1
- package/build/dist/Types/Incident/IncidentMetricType.js +7 -0
- package/build/dist/Types/Incident/IncidentMetricType.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +7 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js +62 -0
- package/build/dist/Types/Monitor/MonitorCriteriaInstance.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStep.js +28 -0
- package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorStepSqlMonitor.js +93 -0
- package/build/dist/Types/Monitor/MonitorStepSqlMonitor.js.map +1 -0
- package/build/dist/Types/Monitor/MonitorType.js +15 -0
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/Monitor/SqlDatabaseType.js +47 -0
- package/build/dist/Types/Monitor/SqlDatabaseType.js.map +1 -0
- package/build/dist/Types/Monitor/SqlMonitor/SqlMonitorResponse.js +2 -0
- package/build/dist/Types/Monitor/SqlMonitor/SqlMonitorResponse.js.map +1 -0
- package/build/dist/Types/Permission.js +10 -84
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Runbook/RunbookStepType.js +1 -0
- package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
- package/build/dist/Types/Workflow/ComponentID.js +1 -0
- package/build/dist/Types/Workflow/ComponentID.js.map +1 -1
- package/build/dist/Types/Workflow/Components/AI.js +135 -0
- package/build/dist/Types/Workflow/Components/AI.js.map +1 -0
- package/build/dist/Types/Workflow/Components.js +7 -0
- package/build/dist/Types/Workflow/Components.js.map +1 -1
- package/build/dist/UI/Components/AI/GenerateFromAIModal.js +1 -1
- package/build/dist/UI/Components/AI/GenerateFromAIModal.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +9 -0
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/MoreMenu/MoreMenu.js +1 -1
- package/build/dist/UI/Components/Table/Table.js +28 -2
- package/build/dist/UI/Components/Table/Table.js.map +1 -1
- package/build/dist/UI/Utils/TableColumnsToCsv.js +291 -0
- package/build/dist/UI/Utils/TableColumnsToCsv.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitorMetricType.js +1 -0
- package/build/dist/Utils/Monitor/MonitorMetricType.js.map +1 -1
- package/package.json +1 -1
- package/Models/DatabaseModels/AIAgentTask.ts +0 -660
- package/Models/DatabaseModels/AIAgentTaskLog.ts +0 -426
- package/Models/DatabaseModels/AIAgentTaskTelemetryException.ts +0 -399
- package/Models/DatabaseModels/ServiceCodeRepository.ts +0 -647
- package/Server/Services/AIAgentTaskService.ts +0 -240
- package/Server/Services/AIAgentTaskTelemetryExceptionService.ts +0 -39
- package/Server/Services/ServiceCodeRepositoryService.ts +0 -55
- package/Tests/Server/Services/AIAgentTaskServiceClaim.test.ts +0 -146
- package/Types/AI/AIAgentTaskMetadata.ts +0 -25
- package/Types/AI/AIAgentTaskType.ts +0 -40
- package/build/dist/Models/DatabaseModels/AIAgentTask.js +0 -691
- package/build/dist/Models/DatabaseModels/AIAgentTask.js.map +0 -1
- package/build/dist/Models/DatabaseModels/AIAgentTaskLog.js +0 -447
- package/build/dist/Models/DatabaseModels/AIAgentTaskLog.js.map +0 -1
- package/build/dist/Models/DatabaseModels/AIAgentTaskTelemetryException.js +0 -415
- package/build/dist/Models/DatabaseModels/AIAgentTaskTelemetryException.js.map +0 -1
- package/build/dist/Models/DatabaseModels/ServiceCodeRepository.js +0 -665
- package/build/dist/Models/DatabaseModels/ServiceCodeRepository.js.map +0 -1
- package/build/dist/Server/Services/AIAgentTaskLogService.js.map +0 -1
- package/build/dist/Server/Services/AIAgentTaskService.js +0 -217
- package/build/dist/Server/Services/AIAgentTaskService.js.map +0 -1
- package/build/dist/Server/Services/AIAgentTaskTelemetryExceptionService.js +0 -36
- package/build/dist/Server/Services/AIAgentTaskTelemetryExceptionService.js.map +0 -1
- package/build/dist/Server/Services/ServiceCodeRepositoryService.js +0 -54
- package/build/dist/Server/Services/ServiceCodeRepositoryService.js.map +0 -1
- package/build/dist/Server/Utils/AI/Sentinel/AlertInvestigationRunner.js.map +0 -1
- package/build/dist/Server/Utils/AI/Sentinel/IncidentInvestigationRunner.js.map +0 -1
- package/build/dist/Server/Utils/AI/Sentinel/IncidentPostmortemRunner.js.map +0 -1
- package/build/dist/Server/Utils/AI/Sentinel/InvestigationQueue.js.map +0 -1
- package/build/dist/Server/Utils/AI/Sentinel/SentinelInvestigationEngine.js.map +0 -1
- package/build/dist/Server/Utils/AI/Sentinel/SentinelMemory.js.map +0 -1
- package/build/dist/Server/Utils/AI/Toolbox/SentinelActionTools.js.map +0 -1
- package/build/dist/Types/AI/AIAgentTaskMetadata.js +0 -6
- package/build/dist/Types/AI/AIAgentTaskMetadata.js.map +0 -1
- package/build/dist/Types/AI/AIAgentTaskType.js +0 -29
- package/build/dist/Types/AI/AIAgentTaskType.js.map +0 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import CodeFixTaskType, {
|
|
2
|
+
CodeFixContextKind,
|
|
3
|
+
CodeFixTaskTypeHelper,
|
|
4
|
+
} from "../../../Types/AI/CodeFixTaskType";
|
|
5
|
+
|
|
6
|
+
describe("CodeFixTaskTypeHelper", () => {
|
|
7
|
+
describe("getUserTriggerableTaskTypes", () => {
|
|
8
|
+
test("only exception-page recipes are user triggerable", () => {
|
|
9
|
+
expect(CodeFixTaskTypeHelper.getUserTriggerableTaskTypes()).toEqual([
|
|
10
|
+
CodeFixTaskType.FixException,
|
|
11
|
+
CodeFixTaskType.WriteRegressionTest,
|
|
12
|
+
]);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe("isUserTriggerable", () => {
|
|
17
|
+
test.each([
|
|
18
|
+
CodeFixTaskType.FixException,
|
|
19
|
+
CodeFixTaskType.WriteRegressionTest,
|
|
20
|
+
])("returns true for %s", (taskType: CodeFixTaskType) => {
|
|
21
|
+
expect(CodeFixTaskTypeHelper.isUserTriggerable(taskType)).toBe(true);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test.each([
|
|
25
|
+
CodeFixTaskType.ImproveInstrumentation,
|
|
26
|
+
CodeFixTaskType.FixPerformance,
|
|
27
|
+
CodeFixTaskType.FixFromIncident,
|
|
28
|
+
])(
|
|
29
|
+
"returns false for %s (not exception-page triggered)",
|
|
30
|
+
(taskType: CodeFixTaskType) => {
|
|
31
|
+
expect(CodeFixTaskTypeHelper.isUserTriggerable(taskType)).toBe(false);
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe("getContextKind", () => {
|
|
37
|
+
test.each([
|
|
38
|
+
[CodeFixTaskType.FixException, CodeFixContextKind.TelemetryException],
|
|
39
|
+
[
|
|
40
|
+
CodeFixTaskType.WriteRegressionTest,
|
|
41
|
+
CodeFixContextKind.TelemetryException,
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
CodeFixTaskType.ImproveInstrumentation,
|
|
45
|
+
CodeFixContextKind.IncidentOrAlertSubject,
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
CodeFixTaskType.FixFromIncident,
|
|
49
|
+
CodeFixContextKind.IncidentOrAlertSubject,
|
|
50
|
+
],
|
|
51
|
+
[CodeFixTaskType.FixPerformance, CodeFixContextKind.TaskContext],
|
|
52
|
+
])(
|
|
53
|
+
"maps %s to %s",
|
|
54
|
+
(taskType: CodeFixTaskType, expected: CodeFixContextKind) => {
|
|
55
|
+
expect(CodeFixTaskTypeHelper.getContextKind(taskType)).toBe(expected);
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
test("every task type resolves to a known context kind", () => {
|
|
60
|
+
for (const taskType of Object.values(CodeFixTaskType)) {
|
|
61
|
+
expect(Object.values(CodeFixContextKind)).toContain(
|
|
62
|
+
CodeFixTaskTypeHelper.getContextKind(taskType),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
describe("requiresTelemetryException", () => {
|
|
69
|
+
test.each([
|
|
70
|
+
CodeFixTaskType.FixException,
|
|
71
|
+
CodeFixTaskType.WriteRegressionTest,
|
|
72
|
+
])("returns true for %s", (taskType: CodeFixTaskType) => {
|
|
73
|
+
expect(CodeFixTaskTypeHelper.requiresTelemetryException(taskType)).toBe(
|
|
74
|
+
true,
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test.each([
|
|
79
|
+
CodeFixTaskType.ImproveInstrumentation,
|
|
80
|
+
CodeFixTaskType.FixPerformance,
|
|
81
|
+
CodeFixTaskType.FixFromIncident,
|
|
82
|
+
])("returns false for %s", (taskType: CodeFixTaskType) => {
|
|
83
|
+
expect(CodeFixTaskTypeHelper.requiresTelemetryException(taskType)).toBe(
|
|
84
|
+
false,
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("stays in sync with getContextKind", () => {
|
|
89
|
+
for (const taskType of Object.values(CodeFixTaskType)) {
|
|
90
|
+
expect(CodeFixTaskTypeHelper.requiresTelemetryException(taskType)).toBe(
|
|
91
|
+
CodeFixTaskTypeHelper.getContextKind(taskType) ===
|
|
92
|
+
CodeFixContextKind.TelemetryException,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("every user-triggerable recipe is exception-based", () => {
|
|
98
|
+
for (const taskType of CodeFixTaskTypeHelper.getUserTriggerableTaskTypes()) {
|
|
99
|
+
expect(CodeFixTaskTypeHelper.requiresTelemetryException(taskType)).toBe(
|
|
100
|
+
true,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe("isValidTaskType", () => {
|
|
107
|
+
test("accepts every enum value", () => {
|
|
108
|
+
for (const taskType of Object.values(CodeFixTaskType)) {
|
|
109
|
+
expect(CodeFixTaskTypeHelper.isValidTaskType(taskType)).toBe(true);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test.each(["", "NotATaskType", "fixexception"])(
|
|
114
|
+
"rejects %p",
|
|
115
|
+
(value: string) => {
|
|
116
|
+
expect(CodeFixTaskTypeHelper.isValidTaskType(value)).toBe(false);
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe("fromDatabaseValue", () => {
|
|
122
|
+
test("normalizes a legacy null/undefined column to FixException", () => {
|
|
123
|
+
expect(CodeFixTaskTypeHelper.fromDatabaseValue(null)).toBe(
|
|
124
|
+
CodeFixTaskType.FixException,
|
|
125
|
+
);
|
|
126
|
+
expect(CodeFixTaskTypeHelper.fromDatabaseValue(undefined)).toBe(
|
|
127
|
+
CodeFixTaskType.FixException,
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test.each(["", "NotATaskType"])(
|
|
132
|
+
"falls back to FixException for the unrecognized value %p",
|
|
133
|
+
(value: string) => {
|
|
134
|
+
expect(CodeFixTaskTypeHelper.fromDatabaseValue(value)).toBe(
|
|
135
|
+
CodeFixTaskType.FixException,
|
|
136
|
+
);
|
|
137
|
+
},
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
test("round-trips every valid task type", () => {
|
|
141
|
+
for (const taskType of Object.values(CodeFixTaskType)) {
|
|
142
|
+
expect(CodeFixTaskTypeHelper.fromDatabaseValue(taskType)).toBe(
|
|
143
|
+
taskType,
|
|
144
|
+
);
|
|
145
|
+
// Also accepts the raw wire string.
|
|
146
|
+
expect(
|
|
147
|
+
CodeFixTaskTypeHelper.fromDatabaseValue(taskType.toString()),
|
|
148
|
+
).toBe(taskType);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
});
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import FixPullRequestCiStatus, {
|
|
2
|
+
FixPullRequestCiStatusHelper,
|
|
3
|
+
} from "../../../Types/AI/FixPullRequestCiStatus";
|
|
4
|
+
import CodeFixTaskType, {
|
|
5
|
+
CodeFixTaskTypeHelper,
|
|
6
|
+
} from "../../../Types/AI/CodeFixTaskType";
|
|
7
|
+
import { describe, expect, test } from "@jest/globals";
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* B4 Tier 1: the CI-conclusion roll-up and the SHOULD-FAIL rule. These pin
|
|
11
|
+
* the honesty contract: a repo without CI is NoCiConfigured (unverified,
|
|
12
|
+
* never verified — G9), conclusions are only final once every check
|
|
13
|
+
* completed, and a RED conclusion on a should-fail regression-test PR is the
|
|
14
|
+
* desired signal.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
describe("FixPullRequestCiStatusHelper.rollUpConclusion", () => {
|
|
18
|
+
test("zero check runs means NoCiConfigured — never Green", () => {
|
|
19
|
+
expect(
|
|
20
|
+
FixPullRequestCiStatusHelper.rollUpConclusion({
|
|
21
|
+
total: 0,
|
|
22
|
+
completed: 0,
|
|
23
|
+
failed: 0,
|
|
24
|
+
pending: 0,
|
|
25
|
+
}),
|
|
26
|
+
).toBe(FixPullRequestCiStatus.NoCiConfigured);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("any pending run means Pending", () => {
|
|
30
|
+
expect(
|
|
31
|
+
FixPullRequestCiStatusHelper.rollUpConclusion({
|
|
32
|
+
total: 3,
|
|
33
|
+
completed: 2,
|
|
34
|
+
failed: 0,
|
|
35
|
+
pending: 1,
|
|
36
|
+
}),
|
|
37
|
+
).toBe(FixPullRequestCiStatus.Pending);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("pending wins over failed — a conclusion is only final once every check completed", () => {
|
|
41
|
+
expect(
|
|
42
|
+
FixPullRequestCiStatusHelper.rollUpConclusion({
|
|
43
|
+
total: 3,
|
|
44
|
+
completed: 1,
|
|
45
|
+
failed: 1,
|
|
46
|
+
pending: 2,
|
|
47
|
+
}),
|
|
48
|
+
).toBe(FixPullRequestCiStatus.Pending);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("any failed run (all completed) means Red", () => {
|
|
52
|
+
expect(
|
|
53
|
+
FixPullRequestCiStatusHelper.rollUpConclusion({
|
|
54
|
+
total: 4,
|
|
55
|
+
completed: 4,
|
|
56
|
+
failed: 1,
|
|
57
|
+
pending: 0,
|
|
58
|
+
}),
|
|
59
|
+
).toBe(FixPullRequestCiStatus.Red);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("all completed and none failed means Green", () => {
|
|
63
|
+
expect(
|
|
64
|
+
FixPullRequestCiStatusHelper.rollUpConclusion({
|
|
65
|
+
total: 4,
|
|
66
|
+
completed: 4,
|
|
67
|
+
failed: 0,
|
|
68
|
+
pending: 0,
|
|
69
|
+
}),
|
|
70
|
+
).toBe(FixPullRequestCiStatus.Green);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("FixPullRequestCiStatusHelper.applyTaskType (the SHOULD-FAIL rule)", () => {
|
|
75
|
+
test("WriteRegressionTest + Red maps to ExpectedFailureObserved", () => {
|
|
76
|
+
expect(
|
|
77
|
+
FixPullRequestCiStatusHelper.applyTaskType({
|
|
78
|
+
conclusion: FixPullRequestCiStatus.Red,
|
|
79
|
+
taskType: CodeFixTaskType.WriteRegressionTest,
|
|
80
|
+
}),
|
|
81
|
+
).toBe(FixPullRequestCiStatus.ExpectedFailureObserved);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test("fix-type recipes keep Red as Red", () => {
|
|
85
|
+
for (const taskType of [
|
|
86
|
+
CodeFixTaskType.FixException,
|
|
87
|
+
CodeFixTaskType.ImproveInstrumentation,
|
|
88
|
+
CodeFixTaskType.FixPerformance,
|
|
89
|
+
CodeFixTaskType.FixFromIncident,
|
|
90
|
+
]) {
|
|
91
|
+
expect(
|
|
92
|
+
FixPullRequestCiStatusHelper.applyTaskType({
|
|
93
|
+
conclusion: FixPullRequestCiStatus.Red,
|
|
94
|
+
taskType,
|
|
95
|
+
}),
|
|
96
|
+
).toBe(FixPullRequestCiStatus.Red);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("legacy null task type normalizes to FixException, so Red stays Red", () => {
|
|
101
|
+
expect(
|
|
102
|
+
FixPullRequestCiStatusHelper.applyTaskType({
|
|
103
|
+
conclusion: FixPullRequestCiStatus.Red,
|
|
104
|
+
taskType: CodeFixTaskTypeHelper.fromDatabaseValue(null),
|
|
105
|
+
}),
|
|
106
|
+
).toBe(FixPullRequestCiStatus.Red);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test("non-Red conclusions pass through unchanged even for WriteRegressionTest", () => {
|
|
110
|
+
for (const conclusion of [
|
|
111
|
+
FixPullRequestCiStatus.Green,
|
|
112
|
+
FixPullRequestCiStatus.Pending,
|
|
113
|
+
FixPullRequestCiStatus.NoCiConfigured,
|
|
114
|
+
]) {
|
|
115
|
+
expect(
|
|
116
|
+
FixPullRequestCiStatusHelper.applyTaskType({
|
|
117
|
+
conclusion,
|
|
118
|
+
taskType: CodeFixTaskType.WriteRegressionTest,
|
|
119
|
+
}),
|
|
120
|
+
).toBe(conclusion);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
describe("FixPullRequestCiStatusHelper.isVerified (the G9 predicate)", () => {
|
|
126
|
+
test("only Green and ExpectedFailureObserved are verified", () => {
|
|
127
|
+
expect(
|
|
128
|
+
FixPullRequestCiStatusHelper.isVerified(FixPullRequestCiStatus.Green),
|
|
129
|
+
).toBe(true);
|
|
130
|
+
expect(
|
|
131
|
+
FixPullRequestCiStatusHelper.isVerified(
|
|
132
|
+
FixPullRequestCiStatus.ExpectedFailureObserved,
|
|
133
|
+
),
|
|
134
|
+
).toBe(true);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test("absence of CI is NEVER verified — nor is pending, red, or unpolled null", () => {
|
|
138
|
+
expect(
|
|
139
|
+
FixPullRequestCiStatusHelper.isVerified(
|
|
140
|
+
FixPullRequestCiStatus.NoCiConfigured,
|
|
141
|
+
),
|
|
142
|
+
).toBe(false);
|
|
143
|
+
expect(
|
|
144
|
+
FixPullRequestCiStatusHelper.isVerified(FixPullRequestCiStatus.Pending),
|
|
145
|
+
).toBe(false);
|
|
146
|
+
expect(
|
|
147
|
+
FixPullRequestCiStatusHelper.isVerified(FixPullRequestCiStatus.Red),
|
|
148
|
+
).toBe(false);
|
|
149
|
+
expect(FixPullRequestCiStatusHelper.isVerified(null)).toBe(false);
|
|
150
|
+
expect(FixPullRequestCiStatusHelper.isVerified(undefined)).toBe(false);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
describe("FixPullRequestCiStatusHelper.describeForProgressLog", () => {
|
|
155
|
+
test("green line carries the check counts", () => {
|
|
156
|
+
expect(
|
|
157
|
+
FixPullRequestCiStatusHelper.describeForProgressLog({
|
|
158
|
+
ciStatus: FixPullRequestCiStatus.Green,
|
|
159
|
+
counts: { total: 4, completed: 4, failed: 0, pending: 0 },
|
|
160
|
+
}),
|
|
161
|
+
).toBe("CI on the fix PR: Green (4/4 checks passed)");
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test("expected-failure line says the failure is the desired signal", () => {
|
|
165
|
+
expect(
|
|
166
|
+
FixPullRequestCiStatusHelper.describeForProgressLog({
|
|
167
|
+
ciStatus: FixPullRequestCiStatus.ExpectedFailureObserved,
|
|
168
|
+
counts: { total: 3, completed: 3, failed: 1, pending: 0 },
|
|
169
|
+
}),
|
|
170
|
+
).toContain("expected failure observed");
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test("no-CI line says the fix is unverified", () => {
|
|
174
|
+
expect(
|
|
175
|
+
FixPullRequestCiStatusHelper.describeForProgressLog({
|
|
176
|
+
ciStatus: FixPullRequestCiStatus.NoCiConfigured,
|
|
177
|
+
counts: { total: 0, completed: 0, failed: 0, pending: 0 },
|
|
178
|
+
}),
|
|
179
|
+
).toContain("unverified");
|
|
180
|
+
});
|
|
181
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import MonitorStepSqlMonitor, {
|
|
2
|
+
MonitorStepSqlMonitorUtil,
|
|
3
|
+
clampSqlConnectionTimeoutInMs,
|
|
4
|
+
clampSqlMaxRows,
|
|
5
|
+
clampSqlStatementTimeoutInMs,
|
|
6
|
+
DEFAULT_SQL_CONNECTION_TIMEOUT_IN_MS,
|
|
7
|
+
DEFAULT_SQL_MAX_ROWS,
|
|
8
|
+
DEFAULT_SQL_STATEMENT_TIMEOUT_IN_MS,
|
|
9
|
+
MAX_SQL_CONNECTION_TIMEOUT_IN_MS,
|
|
10
|
+
MAX_SQL_MAX_ROWS,
|
|
11
|
+
MAX_SQL_STATEMENT_TIMEOUT_IN_MS,
|
|
12
|
+
} from "../../../Types/Monitor/MonitorStepSqlMonitor";
|
|
13
|
+
import SqlDatabaseType from "../../../Types/Monitor/SqlDatabaseType";
|
|
14
|
+
import { JSONObject } from "../../../Types/JSON";
|
|
15
|
+
|
|
16
|
+
describe("MonitorStepSqlMonitorUtil", () => {
|
|
17
|
+
describe("getDefault", () => {
|
|
18
|
+
test("returns a PostgreSQL default with safe caps", () => {
|
|
19
|
+
const def: MonitorStepSqlMonitor = MonitorStepSqlMonitorUtil.getDefault();
|
|
20
|
+
expect(def.databaseType).toBe(SqlDatabaseType.PostgreSQL);
|
|
21
|
+
expect(def.port).toBe(5432);
|
|
22
|
+
expect(def.useSsl).toBe(false);
|
|
23
|
+
expect(def.rejectUnauthorizedSsl).toBe(true);
|
|
24
|
+
expect(def.statementTimeoutInMs).toBe(
|
|
25
|
+
DEFAULT_SQL_STATEMENT_TIMEOUT_IN_MS,
|
|
26
|
+
);
|
|
27
|
+
expect(def.connectionTimeoutInMs).toBe(
|
|
28
|
+
DEFAULT_SQL_CONNECTION_TIMEOUT_IN_MS,
|
|
29
|
+
);
|
|
30
|
+
expect(def.maxRows).toBe(DEFAULT_SQL_MAX_ROWS);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe("clamps", () => {
|
|
35
|
+
test("statement timeout is clamped to the max and defaulted when invalid", () => {
|
|
36
|
+
expect(clampSqlStatementTimeoutInMs(999999)).toBe(
|
|
37
|
+
MAX_SQL_STATEMENT_TIMEOUT_IN_MS,
|
|
38
|
+
);
|
|
39
|
+
expect(clampSqlStatementTimeoutInMs(0)).toBe(
|
|
40
|
+
DEFAULT_SQL_STATEMENT_TIMEOUT_IN_MS,
|
|
41
|
+
);
|
|
42
|
+
expect(clampSqlStatementTimeoutInMs(-5)).toBe(
|
|
43
|
+
DEFAULT_SQL_STATEMENT_TIMEOUT_IN_MS,
|
|
44
|
+
);
|
|
45
|
+
expect(clampSqlStatementTimeoutInMs(8000)).toBe(8000);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("connection timeout is clamped to the max", () => {
|
|
49
|
+
expect(clampSqlConnectionTimeoutInMs(999999)).toBe(
|
|
50
|
+
MAX_SQL_CONNECTION_TIMEOUT_IN_MS,
|
|
51
|
+
);
|
|
52
|
+
expect(clampSqlConnectionTimeoutInMs(5000)).toBe(5000);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("maxRows is clamped, floored, and defaulted", () => {
|
|
56
|
+
expect(clampSqlMaxRows(999999)).toBe(MAX_SQL_MAX_ROWS);
|
|
57
|
+
expect(clampSqlMaxRows(0)).toBe(DEFAULT_SQL_MAX_ROWS);
|
|
58
|
+
expect(clampSqlMaxRows(12.9)).toBe(12);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe("fromJSON/toJSON round-trip", () => {
|
|
63
|
+
test("preserves values and clamps out-of-range inputs", () => {
|
|
64
|
+
const json: JSONObject = {
|
|
65
|
+
databaseType: SqlDatabaseType.PostgreSQL,
|
|
66
|
+
host: "db.internal",
|
|
67
|
+
port: 5433,
|
|
68
|
+
databaseName: "orders",
|
|
69
|
+
username: "readonly",
|
|
70
|
+
password: "{{monitorSecrets.dbPass}}",
|
|
71
|
+
useSsl: true,
|
|
72
|
+
rejectUnauthorizedSsl: false,
|
|
73
|
+
query: "SELECT COUNT(*) FROM orders",
|
|
74
|
+
connectionTimeoutInMs: 999999,
|
|
75
|
+
statementTimeoutInMs: 20000,
|
|
76
|
+
maxRows: 999999,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const parsed: MonitorStepSqlMonitor =
|
|
80
|
+
MonitorStepSqlMonitorUtil.fromJSON(json);
|
|
81
|
+
|
|
82
|
+
expect(parsed.host).toBe("db.internal");
|
|
83
|
+
expect(parsed.port).toBe(5433);
|
|
84
|
+
expect(parsed.password).toBe("{{monitorSecrets.dbPass}}");
|
|
85
|
+
expect(parsed.useSsl).toBe(true);
|
|
86
|
+
expect(parsed.rejectUnauthorizedSsl).toBe(false);
|
|
87
|
+
// clamped
|
|
88
|
+
expect(parsed.connectionTimeoutInMs).toBe(
|
|
89
|
+
MAX_SQL_CONNECTION_TIMEOUT_IN_MS,
|
|
90
|
+
);
|
|
91
|
+
expect(parsed.maxRows).toBe(MAX_SQL_MAX_ROWS);
|
|
92
|
+
|
|
93
|
+
const roundTripped: MonitorStepSqlMonitor =
|
|
94
|
+
MonitorStepSqlMonitorUtil.fromJSON(
|
|
95
|
+
MonitorStepSqlMonitorUtil.toJSON(parsed),
|
|
96
|
+
);
|
|
97
|
+
expect(roundTripped).toEqual(parsed);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("defaults rejectUnauthorizedSsl to true when absent", () => {
|
|
101
|
+
const parsed: MonitorStepSqlMonitor = MonitorStepSqlMonitorUtil.fromJSON({
|
|
102
|
+
host: "h",
|
|
103
|
+
databaseName: "d",
|
|
104
|
+
query: "SELECT 1",
|
|
105
|
+
});
|
|
106
|
+
expect(parsed.rejectUnauthorizedSsl).toBe(true);
|
|
107
|
+
expect(parsed.useSsl).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import SqlDatabaseType, {
|
|
2
|
+
SqlDatabaseTypeUtil,
|
|
3
|
+
} from "../../../Types/Monitor/SqlDatabaseType";
|
|
4
|
+
|
|
5
|
+
describe("SqlDatabaseTypeUtil", () => {
|
|
6
|
+
describe("getSupportedDatabaseTypes", () => {
|
|
7
|
+
test("supports PostgreSQL, MySQL, and Microsoft SQL Server", () => {
|
|
8
|
+
const supported: Array<SqlDatabaseType> =
|
|
9
|
+
SqlDatabaseTypeUtil.getSupportedDatabaseTypes();
|
|
10
|
+
|
|
11
|
+
expect(supported).toContain(SqlDatabaseType.PostgreSQL);
|
|
12
|
+
expect(supported).toContain(SqlDatabaseType.MySQL);
|
|
13
|
+
expect(supported).toContain(SqlDatabaseType.MicrosoftSqlServer);
|
|
14
|
+
expect(supported).toHaveLength(3);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe("isSupported", () => {
|
|
19
|
+
test("returns true for every enum member (all engines ship an executor)", () => {
|
|
20
|
+
expect(SqlDatabaseTypeUtil.isSupported(SqlDatabaseType.PostgreSQL)).toBe(
|
|
21
|
+
true,
|
|
22
|
+
);
|
|
23
|
+
expect(SqlDatabaseTypeUtil.isSupported(SqlDatabaseType.MySQL)).toBe(true);
|
|
24
|
+
expect(
|
|
25
|
+
SqlDatabaseTypeUtil.isSupported(SqlDatabaseType.MicrosoftSqlServer),
|
|
26
|
+
).toBe(true);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("returns false for an engine that is not in the enum", () => {
|
|
30
|
+
expect(
|
|
31
|
+
SqlDatabaseTypeUtil.isSupported("OracleDatabase" as SqlDatabaseType),
|
|
32
|
+
).toBe(false);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe("getDefaultPort", () => {
|
|
37
|
+
test("returns the well-known default port per engine", () => {
|
|
38
|
+
expect(
|
|
39
|
+
SqlDatabaseTypeUtil.getDefaultPort(SqlDatabaseType.PostgreSQL),
|
|
40
|
+
).toBe(5432);
|
|
41
|
+
expect(SqlDatabaseTypeUtil.getDefaultPort(SqlDatabaseType.MySQL)).toBe(
|
|
42
|
+
3306,
|
|
43
|
+
);
|
|
44
|
+
expect(
|
|
45
|
+
SqlDatabaseTypeUtil.getDefaultPort(SqlDatabaseType.MicrosoftSqlServer),
|
|
46
|
+
).toBe(1433);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("falls back to the PostgreSQL port for an unknown engine", () => {
|
|
50
|
+
expect(
|
|
51
|
+
SqlDatabaseTypeUtil.getDefaultPort("OracleDatabase" as SqlDatabaseType),
|
|
52
|
+
).toBe(5432);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import Components, { Categories } from "../../../Types/Workflow/Components";
|
|
2
|
+
import AIComponents from "../../../Types/Workflow/Components/AI";
|
|
3
|
+
import ComponentID from "../../../Types/Workflow/ComponentID";
|
|
4
|
+
import ComponentMetadata, {
|
|
5
|
+
Argument,
|
|
6
|
+
ComponentCategory,
|
|
7
|
+
ComponentInputType,
|
|
8
|
+
ComponentType,
|
|
9
|
+
Port,
|
|
10
|
+
ReturnValue,
|
|
11
|
+
} from "../../../Types/Workflow/Component";
|
|
12
|
+
import { describe, expect, test } from "@jest/globals";
|
|
13
|
+
|
|
14
|
+
function byId<T extends { id: string }>(items: Array<T>, id: string): T {
|
|
15
|
+
const item: T | undefined = items.find((candidate: T) => {
|
|
16
|
+
return candidate.id === id;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (!item) {
|
|
20
|
+
throw new Error(`Expected item with id ${id}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return item;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe("Generate Text with AI workflow metadata", () => {
|
|
27
|
+
const metadata: ComponentMetadata = byId(
|
|
28
|
+
AIComponents,
|
|
29
|
+
ComponentID.AIGenerateText,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
test("uses the stable persisted component id", () => {
|
|
33
|
+
expect(ComponentID.AIGenerateText).toBe("ai-generate-text");
|
|
34
|
+
expect(metadata.id).toBe("ai-generate-text");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("is a discoverable AI component", () => {
|
|
38
|
+
expect(metadata.title).toBe("Generate Text with AI");
|
|
39
|
+
expect(metadata.category).toBe("AI");
|
|
40
|
+
expect(metadata.componentType).toBe(ComponentType.Component);
|
|
41
|
+
expect(metadata.description).toMatch(/AI|LLM/i);
|
|
42
|
+
expect(metadata.iconProp).toBeDefined();
|
|
43
|
+
|
|
44
|
+
expect(
|
|
45
|
+
Components.filter((component: ComponentMetadata) => {
|
|
46
|
+
return component.id === ComponentID.AIGenerateText;
|
|
47
|
+
}),
|
|
48
|
+
).toHaveLength(1);
|
|
49
|
+
expect(
|
|
50
|
+
Categories.some((category: ComponentCategory) => {
|
|
51
|
+
return category.name === "AI";
|
|
52
|
+
}),
|
|
53
|
+
).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("publishes the complete, stable argument contract", () => {
|
|
57
|
+
expect(
|
|
58
|
+
metadata.arguments.map((argument: Argument) => {
|
|
59
|
+
return argument.id;
|
|
60
|
+
}),
|
|
61
|
+
).toEqual([
|
|
62
|
+
"system-prompt",
|
|
63
|
+
"prompt",
|
|
64
|
+
"context",
|
|
65
|
+
"temperature",
|
|
66
|
+
"max-output-tokens",
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
expect(byId(metadata.arguments, "prompt")).toMatchObject({
|
|
70
|
+
required: true,
|
|
71
|
+
type: ComponentInputType.Markdown,
|
|
72
|
+
});
|
|
73
|
+
expect(byId(metadata.arguments, "system-prompt")).toMatchObject({
|
|
74
|
+
required: false,
|
|
75
|
+
type: ComponentInputType.LongText,
|
|
76
|
+
});
|
|
77
|
+
expect(byId(metadata.arguments, "context")).toMatchObject({
|
|
78
|
+
required: false,
|
|
79
|
+
type: ComponentInputType.JSON,
|
|
80
|
+
});
|
|
81
|
+
expect(byId(metadata.arguments, "temperature")).toMatchObject({
|
|
82
|
+
required: false,
|
|
83
|
+
type: ComponentInputType.Decimal,
|
|
84
|
+
});
|
|
85
|
+
expect(byId(metadata.arguments, "max-output-tokens")).toMatchObject({
|
|
86
|
+
required: false,
|
|
87
|
+
type: ComponentInputType.Number,
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("does not expose provider credentials or arbitrary endpoints as inputs", () => {
|
|
92
|
+
const argumentIds: Array<string> = metadata.arguments.map(
|
|
93
|
+
(argument: Argument) => {
|
|
94
|
+
return argument.id.toLowerCase();
|
|
95
|
+
},
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
expect(argumentIds).not.toContain("api-key");
|
|
99
|
+
expect(argumentIds).not.toContain("provider");
|
|
100
|
+
expect(argumentIds).not.toContain("provider-id");
|
|
101
|
+
expect(argumentIds).not.toContain("model");
|
|
102
|
+
expect(argumentIds).not.toContain("base-url");
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test("marks prompt-bearing inputs as sensitive workflow-log data", () => {
|
|
106
|
+
for (const id of ["prompt", "system-prompt", "context"]) {
|
|
107
|
+
expect(byId(metadata.arguments, id).isSensitive).toBe(true);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
expect(byId(metadata.arguments, "temperature").isSensitive).not.toBe(true);
|
|
111
|
+
expect(byId(metadata.arguments, "max-output-tokens").isSensitive).not.toBe(
|
|
112
|
+
true,
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test("publishes typed usage and diagnostic return values", () => {
|
|
117
|
+
expect(
|
|
118
|
+
metadata.returnValues.map((returnValue: ReturnValue) => {
|
|
119
|
+
return returnValue.id;
|
|
120
|
+
}),
|
|
121
|
+
).toEqual([
|
|
122
|
+
"response",
|
|
123
|
+
"provider",
|
|
124
|
+
"model",
|
|
125
|
+
"total-tokens",
|
|
126
|
+
"completion-tokens",
|
|
127
|
+
"llm-log-id",
|
|
128
|
+
"error",
|
|
129
|
+
]);
|
|
130
|
+
|
|
131
|
+
expect(byId(metadata.returnValues, "response").type).toBe(
|
|
132
|
+
ComponentInputType.LongText,
|
|
133
|
+
);
|
|
134
|
+
expect(byId(metadata.returnValues, "provider").type).toBe(
|
|
135
|
+
ComponentInputType.Text,
|
|
136
|
+
);
|
|
137
|
+
expect(byId(metadata.returnValues, "model").type).toBe(
|
|
138
|
+
ComponentInputType.Text,
|
|
139
|
+
);
|
|
140
|
+
expect(byId(metadata.returnValues, "total-tokens").type).toBe(
|
|
141
|
+
ComponentInputType.Number,
|
|
142
|
+
);
|
|
143
|
+
expect(byId(metadata.returnValues, "completion-tokens").type).toBe(
|
|
144
|
+
ComponentInputType.Number,
|
|
145
|
+
);
|
|
146
|
+
expect(byId(metadata.returnValues, "llm-log-id").type).toBe(
|
|
147
|
+
ComponentInputType.Text,
|
|
148
|
+
);
|
|
149
|
+
expect(byId(metadata.returnValues, "error").type).toBe(
|
|
150
|
+
ComponentInputType.Text,
|
|
151
|
+
);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("redacts model-generated content while leaving usage metadata loggable", () => {
|
|
155
|
+
expect(byId(metadata.returnValues, "response").isSensitive).toBe(true);
|
|
156
|
+
|
|
157
|
+
for (const id of [
|
|
158
|
+
"provider",
|
|
159
|
+
"model",
|
|
160
|
+
"total-tokens",
|
|
161
|
+
"completion-tokens",
|
|
162
|
+
"llm-log-id",
|
|
163
|
+
]) {
|
|
164
|
+
expect(byId(metadata.returnValues, id).isSensitive).not.toBe(true);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test("has one input port and explicit success and error branches", () => {
|
|
169
|
+
expect(
|
|
170
|
+
metadata.inPorts.map((port: Port) => {
|
|
171
|
+
return port.id;
|
|
172
|
+
}),
|
|
173
|
+
).toEqual(["in"]);
|
|
174
|
+
expect(
|
|
175
|
+
metadata.outPorts.map((port: Port) => {
|
|
176
|
+
return port.id;
|
|
177
|
+
}),
|
|
178
|
+
).toEqual(["success", "error"]);
|
|
179
|
+
});
|
|
180
|
+
});
|