import { z } from "zod"; import { type AnalyzeHangsResult } from "./analyzeHangs.js"; import { type AnalyzeAnimationHitchesResult } from "./analyzeAnimationHitches.js"; import { type AnalyzeAppLaunchResult } from "./analyzeAppLaunch.js"; import type { NextCallSuggestion } from "../types.js"; /** * Trace-side counterpart to `verifyFix` (which works on `.memgraph`). * Compares before/after `.trace` bundles for a specific perf category * (hangs, animation-hitches, app-launch) and returns a per-category * PASS/PARTIAL/FAIL verdict + numerical deltas. * * Designed for CI gating: a build script can run a hangs-fix PR's * before/after traces through this tool and fail the merge if the * regression target isn't met. * * Composes with the underlying analyzers — same data shape, just * surfaced as a diff. */ export declare const compareTracesByPatternSchema: z.ZodObject<{ before: z.ZodString; after: z.ZodString; category: z.ZodEnum<["hangs", "animation-hitches", "app-launch"]>; thresholds: z.ZodDefault; hitchesMaxLongestMs: z.ZodOptional; appLaunchMaxTotalMs: z.ZodOptional; }, "strip", z.ZodTypeAny, { hangsMaxLongestMs?: number | undefined; hitchesMaxLongestMs?: number | undefined; appLaunchMaxTotalMs?: number | undefined; }, { hangsMaxLongestMs?: number | undefined; hitchesMaxLongestMs?: number | undefined; appLaunchMaxTotalMs?: number | undefined; }>>>; hangsMinDurationMs: z.ZodDefault; hitchesMinDurationMs: z.ZodDefault; }, "strip", z.ZodTypeAny, { after: string; before: string; category: "animation-hitches" | "app-launch" | "hangs"; thresholds: { hangsMaxLongestMs?: number | undefined; hitchesMaxLongestMs?: number | undefined; appLaunchMaxTotalMs?: number | undefined; }; hangsMinDurationMs: number; hitchesMinDurationMs: number; }, { after: string; before: string; category: "animation-hitches" | "app-launch" | "hangs"; thresholds?: { hangsMaxLongestMs?: number | undefined; hitchesMaxLongestMs?: number | undefined; appLaunchMaxTotalMs?: number | undefined; } | undefined; hangsMinDurationMs?: number | undefined; hitchesMinDurationMs?: number | undefined; }>; export type CompareTracesByPatternInput = z.infer; export type Verdict = "PASS" | "PARTIAL" | "FAIL"; export interface CategoryComparison { count: number; longestMs: number; averageMs: number; totalMs: number; } export interface CompareTracesByPatternResult { ok: boolean; before: string; after: string; category: "hangs" | "animation-hitches" | "app-launch"; verdict: Verdict; beforeStats: CategoryComparison; afterStats: CategoryComparison; delta: { count: number; longestMs: number; averageMs: number; totalMs: number; }; thresholdApplied: { field: string; value: number; }; diagnosis: string; suggestedNextCalls?: NextCallSuggestion[]; } /** Pure: build the comparison from two analyzer results. */ export declare function compareHangs(before: AnalyzeHangsResult, after: AnalyzeHangsResult, thresholdLongestMs: number): { beforeStats: CategoryComparison; afterStats: CategoryComparison; delta: CompareTracesByPatternResult["delta"]; verdict: Verdict; }; /** Pure: same shape as `compareHangs` for animation-hitches. */ export declare function compareAnimationHitches(before: AnalyzeAnimationHitchesResult, after: AnalyzeAnimationHitchesResult, thresholdLongestMs: number): { beforeStats: CategoryComparison; afterStats: CategoryComparison; delta: CompareTracesByPatternResult["delta"]; verdict: Verdict; }; /** Pure: app-launch comparison. The "count" field reflects launch-event count * (typically 1 per trace); the meaningful number is `totalMs`. */ export declare function compareAppLaunch(before: AnalyzeAppLaunchResult, after: AnalyzeAppLaunchResult, thresholdTotalMs: number): { beforeStats: CategoryComparison; afterStats: CategoryComparison; delta: CompareTracesByPatternResult["delta"]; verdict: Verdict; }; export declare function compareTracesByPattern(input: CompareTracesByPatternInput): Promise;