/** * Equivalence-divergence diagnostic builder (pure). * * When `graph-equivalence-check` reports production decline, phantom, or * conflict divergences, this turns each divergence into a fully-described * record — owner occurrence, resolved target occurrences, and the actual call * edge on BOTH engines (plus the same-call-site edge whatever its resolution) — * so a maintainer can see exactly how exact and sharded disagreed at a call * site, not just the bodyHash deltas. * * It is the structured form of the throwaway instrumentation that originally * root-caused the 118-decline asymmetry (exact resolves workspace deps via * symlinked `packages/X/dist`, sharded via pnpm's injected `.pnpm/...@file+...`). * Keeping it as a maintained, env-gated artifact makes the NEXT equivalence * regression debuggable in minutes instead of hours. * * This module is PURE — no `fs`, no `process`, no `Date`. The host command * (`equivalence-check-command.ts`) owns the env gate + file/stdout effects, so * the analysis is unit-testable in isolation. */ import type { Catalog, CallEdge, FunctionOccurrence } from '../types.js'; import type { EdgeDifference } from './orchestrate/cross-shard-resolve.js'; /** Compact occurrence projection for the diagnostic JSON. */ export interface OccurrenceSummary { readonly simpleName: string; readonly qualifiedName: string; readonly filePath: string; readonly line: number; readonly column: number; readonly kind: FunctionOccurrence['kind']; readonly visibility: FunctionOccurrence['visibility']; readonly package: string | undefined; } /** Compact call-edge projection for the diagnostic JSON. */ export interface EdgeSummary { readonly to: readonly string[]; readonly line: number; readonly column: number; readonly resolution: CallEdge['resolution']; readonly confidence: CallEdge['confidence']; readonly text: string; readonly crossShard: boolean; readonly discarded: boolean; } /** One resolved target bodyHash and every occurrence that shares it. */ export interface TargetSummary { readonly hash: string; readonly occurrences: readonly OccurrenceSummary[]; } /** A single divergence, described symmetrically across both engines. */ export interface DiffDiagnostic { readonly owner: { readonly hash: string; readonly filePath: string; readonly line: number; readonly column: number; readonly exact: OccurrenceSummary | null; readonly sharded: OccurrenceSummary | null; }; readonly exactTo: readonly TargetSummary[]; readonly shardedTo: readonly TargetSummary[]; /** The edge whose target set exactly matches this divergence's recorded `to`. */ readonly exactEdge: EdgeSummary | null; readonly shardedEdge: EdgeSummary | null; /** The edge at the same call site regardless of its resolved target set. */ readonly exactSameSite: EdgeSummary | null; readonly shardedSameSite: EdgeSummary | null; } export interface EquivalenceDiagnostic { readonly counts: { readonly productionDecline: number; readonly productionPhantom: number; readonly productionConflict: number; }; readonly shards: readonly { readonly id: string; readonly rootDir: string; readonly fileCount: number; }[]; /** Histogram: `:` of the exact edge for each decline. */ readonly declineByExactResolution: Record; /** Histogram: `:` of the sharded edge for each phantom. */ readonly phantomByShardedResolution: Record; /** Histogram of `->` for each conflict. */ readonly conflictByResolutionPair: Record; readonly decline: readonly DiffDiagnostic[]; readonly phantom: readonly DiffDiagnostic[]; readonly conflict: readonly DiffDiagnostic[]; } export interface BuildEquivalenceDiagnosticInput { readonly report: { readonly productionDecline: readonly EdgeDifference[]; readonly productionPhantom: readonly EdgeDifference[]; readonly productionConflict: readonly EdgeDifference[]; }; readonly exact: Catalog; readonly sharded: Catalog; readonly shards: readonly { readonly id: string; readonly rootDir: string; readonly files: readonly string[]; }[]; } /** Build the structured equivalence diagnostic. Pure: no I/O, no clock. */ export declare function buildEquivalenceDiagnostic(input: BuildEquivalenceDiagnosticInput): EquivalenceDiagnostic; //# sourceMappingURL=equivalence-diagnostic.d.ts.map