/** * One pure source-filter predicate for every public graph audit read view, plus * the audit source-role matcher (P2 Phase 1.4): a compiled, non-serializable * predicate that reclassifies configured paths as test sources. */ import { type Result } from '@opensip-cli/core'; import type { AuditSourceRolePolicy, GraphSourceFilter } from './query-contracts.js'; import type { GraphReadError } from './types.js'; import type { FunctionOccurrence } from '../types.js'; /** * Max unique normalized project-relative catalog file paths classified against * the audit source-role globs for one `g1:` generation (P2 Phase 1.4). Beyond * this, {@link compileSourceRoleMatcher} fails the read with a typed * resource-limit error rather than silently treating unclassified files as * production. */ export declare const MAX_AUDIT_SOURCE_ROLE_FILES = 250000; /** * Compiled, NON-serializable audit source-role matcher (P2 Phase 1.4). NEVER * placed in a DTO — no function, `Minimatch`, or `RegExp` crosses the read * boundary. `matches` is an O(1) lookup into a matched-path set pre-computed * once at compile time, so the (≤64 globs) × (≤files) classification never runs * per query row. */ export interface SourceRoleMatcher { matches(filePath: string): boolean; } /** Immutable classification limits (production passes {@link MAX_AUDIT_SOURCE_ROLE_FILES}). */ export interface SourceRoleLimits { readonly maxFiles: number; } /** * Compile an {@link AuditSourceRolePolicy} against a generation's unique * normalized project-relative file paths into a {@link SourceRoleMatcher} * (P2 Phase 1.4). Returns the no-op matcher when no globs are configured. * * Fails closed with a typed error when a glob cannot be compiled, or when the * unique file count exceeds `limits.maxFiles` — never silently degrading * unclassified files to production scope. */ export declare function compileSourceRoleMatcher(policy: AuditSourceRolePolicy | undefined, filePaths: Iterable, limits: SourceRoleLimits): Result; /** * The single effective test-source definition (P2 Phase 1.4/1.5): the adapter's * `inTestFile` bit OR an audit source-role glob match. Every source-scope caller * routes through this so a filtered row cannot leak into production summaries. */ export declare function effectiveTestSource(row: Pick, matcher: SourceRoleMatcher): boolean; type FilterableRow = Pick; /** * Whether a catalog occurrence matches the shared graph source filter, applying * the compiled audit source-role matcher to the effective test classification * (P2 Phase 1.4). This is the canonical role-aware predicate; Tasks 1.5-1.6 * migrate every read view / MCP-local projection onto it. */ export declare function matchesGraphSourceFilterWithRoles(row: FilterableRow, filter: GraphSourceFilter, matcher: SourceRoleMatcher): boolean; /** * Segment-aware prefix match: `src/api` matches `src/api` and `src/api/x.ts`, * but not `src/api-old/x.ts`. */ export declare function matchesFilePrefix(filePath: string, filePrefix: string): boolean; /** * Whether a read uses the canonical production/non-generated evidence scope. * Configured audit source-role globs make the read non-canonical (P2 Phase 1.4), * so the cached unfiltered `FeatureTable.edge` shortcut is declined. */ export declare function isCanonicalProductionFilter(filter: GraphSourceFilter): boolean; export {}; //# sourceMappingURL=source-filter.d.ts.map