/** * Federation resolver — the deterministic cross-repo primitive. * * Given a symbol published by the home repo, find its *consumers* across the * federated repos in scope. A consumer is a function in another indexed repo that * calls the symbol as an unresolved external reference (the producer doesn't live * in that repo). The match is exact on the symbol-name descriptor of the * producer's content-addressed stable ID — honest that arity is unconfirmed at an * external call site, and that a bare exported-name collision across packages is * possible. Repos that are unindexed / stale / missing are reported as * not-consulted, never guessed. * * No merged graph: each repo's index is loaded lazily, on demand, via the same * `readCachedContext` used for single-repo queries. * * See decisions bf5aff2d (registry) + 67ca60fe (resolution contract). */ import type { SerializedCallGraph } from '../analyzer/call-graph.js'; import type { FederationCoverage, FederationRepoEntry } from './types.js'; /** Default cap on cross-repo consumers returned, to keep conclusions bounded. */ export declare const DEFAULT_MAX_CONSUMERS = 200; /** The federation scope a single query runs against. */ export interface FederationScope { /** True when federation is active for this query. */ active: boolean; /** Registry entries selected for this query (a named subset, or all). */ repos: FederationRepoEntry[]; /** Names requested via federationRepos that aren't in the registry. */ unknownNames: string[]; } /** * Resolve a federation scope from handler args. Federation is opt-in: inactive * unless `federation` is true or `federationRepos` names at least one repo. */ export declare function resolveFederationScope(homeDir: string, opts?: { federation?: boolean; federationRepos?: string[]; }): FederationScope; /** A consuming call site in a federated repo. */ export interface CrossRepoConsumer { /** Federated repo name (from the registry). */ repo: string; repoPath: string; /** The consuming function in that repo. */ caller: { id: string; name: string; file: string; }; /** The published symbol name it references. */ symbol: string; } export interface CrossRepoConsumerResult { symbol: string; consumers: CrossRepoConsumer[]; /** Number of consumers dropped by the cap, if any. */ truncated: number; coverage: FederationCoverage; } /** Result of a multi-symbol cross-repo consumer lookup. */ export interface CrossRepoConsumerBatch { /** symbol name → its consumers across scoped repos. */ bySymbol: Map; truncated: number; coverage: FederationCoverage; } /** * Find consumers for many published symbols at once, loading each scoped repo's * index exactly once. This is the core primitive; the single-symbol form wraps it. */ export declare function findCrossRepoConsumersBatch(scope: FederationScope, symbols: string[], opts?: { maxConsumers?: number; }): Promise; /** * Find consumers of a single published symbol across the scoped repos. Loads each * indexed repo's edge store lazily; skips (and reports) unindexed/stale/missing * repos and repos whose index has no SQLite edge store. */ export declare function findCrossRepoConsumers(scope: FederationScope, symbol: string, opts?: { maxConsumers?: number; }): Promise; /** A scoped repo that defines a symbol of a given name (the producer side). */ export interface SymbolProducer { repo: string; repoPath: string; node: { id: string; name: string; file: string; stableId?: string; }; } /** * Locate which scoped repos *define* a symbol of this exact name (an internal, * non-test node). Used by federated find_path to name the repo that publishes a * `to` endpoint that doesn't live in the home repo. */ export declare function locateSymbolProducers(scope: FederationScope, symbolName: string): Promise<{ producers: SymbolProducer[]; coverage: FederationCoverage; }>; /** * Backward reachability to test nodes within a single loaded repo's call graph: * from a set of seed node IDs, walk callers up to `maxDepth` and collect any test * reached. Two discovery sources, matching the single-repo select_tests handler: * 1. test *nodes* reached by the backward call-walk, and * 2. `tested_by` edges on any reached production node (incl. the seeds) — the * import-based test association the analyzer emits for a real test file, where * the test is NOT a call-graph caller node (e.g. an inline `it(...)` block). * Source 2 is the common real-world case; without it a consumer repo whose tests * are detected by import association selects nothing across the boundary. * * Traverses the in-memory `SerializedCallGraph`, NOT the SQLite edge store: the * store persists only production nodes, so test nodes / tested_by edges exist * *only* in the call graph (the same reason the single-repo handler uses ctx.callGraph). */ export declare function findReachingTests(cg: SerializedCallGraph, seedIds: string[], maxDepth?: number, opts?: { directResolvedOnly?: boolean; }): Array<{ id: string; name: string; file: string; depth: number; }>; /** A test in a federated repo that transitively reaches a cross-repo consumer. */ export interface CrossRepoTest { repo: string; repoPath: string; test: { name: string; file: string; }; /** The published symbol whose consumer (in this repo) the test reaches. */ viaSymbol: string; /** Backward hop distance from the consumer to the test. */ depth: number; } /** * Federated test selection: for published symbols changed in the home repo, find * tests across scoped consumer repos that transitively reach a call site of those * symbols. Each repo's index is loaded once; backward reachability runs locally. */ export declare function findCrossRepoTests(scope: FederationScope, symbols: string[], opts?: { maxDepth?: number; directResolvedOnly?: boolean; }): Promise<{ tests: CrossRepoTest[]; coverage: FederationCoverage; }>; /** An empty/inactive coverage block (federation not requested). */ export declare function inactiveCoverage(): FederationCoverage; //# sourceMappingURL=resolver.d.ts.map