/** * WorkGraph structural validation checks. * * Produces typed, paginated diagnostics for whole-graph integrity audits: parent * cycles, orphaned parent references, maximum containment depth, parent fanout, * and missing Wave 0 bootstrap coverage. * * @task T10583 * @saga T10538 */ import type { TaskType, WorkGraphPageInfo } from '@cleocode/contracts'; import { E_WORKGRAPH_CONTAINMENT_CYCLE, E_WORKGRAPH_MAX_DEPTH_EXCEEDED } from './reparent-preflight.js'; /** Stable error code for nodes whose parent_id points at a missing task. */ export declare const E_WORKGRAPH_ORPHANED_NODE = "E_WORKGRAPH_ORPHANED_NODE"; /** Stable error code for parents with too many direct children. */ export declare const E_WORKGRAPH_FANOUT_EXCEEDED = "E_WORKGRAPH_FANOUT_EXCEEDED"; /** Stable error code for wave-partitioned scopes with no Wave 0 row. */ export declare const E_WORKGRAPH_MISSING_WAVE_ZERO = "E_WORKGRAPH_MISSING_WAVE_ZERO"; /** Minimal task row accepted by structural WorkGraph validation. */ export interface WorkGraphStructureInputNode { /** Stable task, saga, epic, or subtask identifier. */ readonly id: string; /** Canonical hierarchy discriminator for the node. */ readonly type: TaskType; /** Direct containment parent; absent/null means root. */ readonly parentId?: string | null; /** Optional orchestration wave number copied from task metadata/projections. */ readonly wave?: number | null; } /** Cycle diagnostic returned by structural WorkGraph validation. */ export interface WorkGraphStructureCycleFinding { readonly code: typeof E_WORKGRAPH_CONTAINMENT_CYCLE; readonly taskId: string; /** Containment path showing the cycle, starting and ending at `taskId`. */ readonly path: readonly string[]; readonly message: string; } /** Orphan diagnostic returned by structural WorkGraph validation. */ export interface WorkGraphStructureOrphanFinding { readonly code: typeof E_WORKGRAPH_ORPHANED_NODE; readonly taskId: string; readonly parentId: string; readonly message: string; } /** Depth diagnostic returned by structural WorkGraph validation. */ export interface WorkGraphStructureDepthFinding { readonly code: typeof E_WORKGRAPH_MAX_DEPTH_EXCEEDED; readonly taskId: string; /** Containment depth measured as edges from hierarchy root to task. */ readonly depth: number; readonly maxDepth: number; /** Root-to-task containment path. */ readonly path: readonly string[]; readonly message: string; } /** Fanout diagnostic returned by structural WorkGraph validation. */ export interface WorkGraphStructureFanoutFinding { readonly code: typeof E_WORKGRAPH_FANOUT_EXCEEDED; readonly parentId: string; readonly fanout: number; readonly maxFanout: number; /** Direct child IDs in stable input order. */ readonly childIds: readonly string[]; readonly message: string; } /** Missing Wave 0 diagnostic returned by structural WorkGraph validation. */ export interface WorkGraphStructureMissingWaveZeroFinding { readonly code: typeof E_WORKGRAPH_MISSING_WAVE_ZERO; readonly scopeId?: string; /** Distinct waves present in the validated scope. */ readonly waves: readonly number[]; readonly message: string; } /** Typed diagnostic returned by structural WorkGraph validation. */ export type WorkGraphStructureFinding = WorkGraphStructureCycleFinding | WorkGraphStructureOrphanFinding | WorkGraphStructureDepthFinding | WorkGraphStructureFanoutFinding | WorkGraphStructureMissingWaveZeroFinding; /** Options for structural WorkGraph validation. */ export interface WorkGraphStructureValidationOptions { /** Scope ID to echo on scope-wide findings such as missing Wave 0. */ readonly scopeId?: string; /** Maximum allowed containment depth. Defaults to CLEO's epic→task→subtask depth (2). */ readonly maxDepth?: number; /** Maximum allowed direct children per parent. Defaults to unlimited. */ readonly maxFanout?: number; /** Opaque finding cursor returned by the previous page. */ readonly cursor?: string; /** Maximum findings to return. Defaults to 100 and clamps to 500. */ readonly limit?: number; } /** Result returned by structural WorkGraph validation. */ export interface WorkGraphStructureValidationResult { readonly valid: boolean; readonly findings: readonly WorkGraphStructureFinding[]; /** Total findings before pagination is applied. */ readonly totalFindings: number; /** Page metadata for follow-up reads over large finding sets. */ readonly pageInfo: WorkGraphPageInfo; } /** * Validate a WorkGraph snapshot for structural integrity. * * Findings are computed in deterministic groups (cycles, orphans, depth, fanout, * scope-wide wave diagnostics) and then paginated so large graph audits can be * consumed incrementally without changing the total diagnostic count. */ export declare function validateWorkGraphStructure(nodes: readonly WorkGraphStructureInputNode[], options?: WorkGraphStructureValidationOptions): WorkGraphStructureValidationResult; //# sourceMappingURL=structure-validation.d.ts.map