/** * Cache invalidation per §6.2. * * v3: the catalog is content-keyed via three signals: * 1. language — adapter id; mismatch invalidates immediately. * 2. cacheKey — opaque per-adapter invalidation key; mismatch * invalidates (e.g. TS upgrade or tsconfig change). * 3. filesFingerprint — per-file mtime + ctime + size agreement; any source * file change re-runs stages 1+2. * * Per-file fingerprinting uses nanosecond mtime + ctime + size to keep the cost * low while detecting same-size rewrites whose mtime was restored. * * Wave 4 layered an "incremental" verdict on top: when language + * cacheKey agree but some files have changed metadata, the orchestrator * can re-walk only the changed files (plus their transitive edge- * dependents) instead of rebuilding everything. See `classifyCatalog` * and the orchestrator's incremental path. */ import type { Catalog } from '../types.js'; /** * The current-run signals a cached {@link Catalog} is validated against: * the active adapter language, its opaque per-adapter cache key, and the current * source file set. {@link classifyCatalog} compares these against the cached * catalog to decide valid / incremental / invalid. */ export interface ValidationContext { readonly currentLanguage: string; readonly currentCacheKey: string; readonly currentFiles: readonly string[]; /** Optional caller-captured snapshot used to bind cache classification to * the build that follows it. */ readonly currentFilesFingerprint?: string; } /** * Wave 4 verdict — three states: * - 'valid': cached catalog matches current file set on every axis; * orchestrator returns it untouched. * - 'incremental': language + cacheKey agree, but some files changed. * `changedFiles` lists the absolute paths whose cached entries * must be re-walked. Orchestrator builds the program over all * current files and only walks/resolves the changed set. * - 'invalid': structural mismatch (language, cacheKey, missing * fingerprint). Orchestrator does a full rebuild. */ export type CatalogVerdict = { readonly kind: 'valid'; } | { readonly kind: 'incremental'; readonly changedFiles: readonly string[]; } | { readonly kind: 'invalid'; readonly reason: string; }; /** * Classify a cached catalog against the current run ({@link ValidationContext}) * into a {@link CatalogVerdict}: `valid` (reuse as-is), `incremental` (reuse but * re-walk the listed changed files), or `invalid` (full rebuild). Language and * cache-key mismatches force `invalid`; otherwise the per-file fingerprint * decides between `valid` and `incremental`. */ export declare function classifyCatalog(cached: Catalog, ctx: ValidationContext): CatalogVerdict; /** * Compute a fingerprint over the project's source files. Uses nanosecond mtime, * ctime, and size per file plus the file count; cheap to compute and stable for * unchanged trees. */ export declare function computeFilesFingerprint(files: readonly string[]): string; /** * Diff two fingerprints (computed by `computeFilesFingerprint`) and * return the absolute file paths that differ. A file appears in the * result if it was added, removed, or had its mtime/ctime/size change. The * leading file-count line is ignored. Used by the incremental * rebuild path. */ export declare function diffFingerprints(cachedFingerprint: string, currentFingerprint: string): readonly string[]; /** Parse a files fingerprint into its absolute-path to stat-mark entries. */ export declare function parseFilesFingerprint(fingerprint: string): ReadonlyMap; //# sourceMappingURL=invalidate.d.ts.map