/** * Drift detection and slope-similarity correlation for log10x_investigate. * * Drift cases are structurally different from acute spikes: there is no * inflection to anchor lag analysis on. Instead, we compute the anchor's * slope (rate of change per week) and find co-drifters whose slope most * closely matches the anchor's. The output is a cohort of patterns * growing together, not a causal chain. */ import type { EnvConfig } from './environments.js'; import type { InvestigateThresholds } from './thresholds.js'; export interface DriftResult { anchor: string; anchorSlopePerWeek: number; cohort: CoDrifter[]; metadata: { patternsAnalyzed: number; queriesExecuted: number; wallTimeMs: number; }; } export interface CoDrifter { pattern: string; service: string; severity: string; slopePerWeek: number; slopeSimilarity: number; } export interface DriftOptions { env: EnvConfig; metricsEnv: string; anchor: string; /** Window for slope computation. Typically wider than acute-spike window: "30d" or "90d". */ window: string; depth: 'shallow' | 'normal' | 'deep'; thresholds: InvestigateThresholds; scopeService?: string; anchorSeverity?: string; metricName?: string; } /** * Classify whether an anchor's trajectory is an acute spike, drift, or flat. * Returns the anchor's per-week growth rate for downstream use by the drift * flow, plus a simple shape classification. */ export declare function classifyTrajectory(env: EnvConfig, metricsEnv: string, anchor: string, window: string, thresholds: InvestigateThresholds, severity?: string, metricName?: string, baselineOffset?: string): Promise<{ shape: 'acute' | 'drift' | 'flat'; slopePerWeek: number; rateChange: number; }>; export declare function runDriftCorrelation(opts: DriftOptions): Promise; export declare function driftConfidence(anchorSlope: number, cohort: CoDrifter[], driftFloor: number): { slopeSig: number; cohortCoh: number; combined: number; };