/** * certify_service_contract — API schemas checked against the code that serves and calls them * (change: add-service-contract-certification, OpenAPI phase). * * Without a base ref: the contract surface of every OpenAPI / Swagger document in the repository, * and two-way parity against the indexed route handlers (`contract-declared-unimplemented`, * `contract-implemented-undeclared`). With a base ref: a closed-table verdict for each changed * element against the merge-base, each `breaking` or `dangerous` one joined to the client call * sites in this repository that call it (`contract-breaking`). * * Deterministic and offline: schemas come from the working tree and from the base revision via git. * An unreadable schema is `notAssessed`, never "no changes"; parity is not claimed when no route * handler is indexed; consumers outside this repository are a disclosed boundary. * * Siblings: `certify_public_surface` certifies the shape of code exports; `change_impact_certificate` * the paths a change opens into declared surfaces. */ import { type ContractDocument, type ContractOperation } from '../../analyzer/contract/openapi.js'; import { type IndexedRoute } from '../contract/contract-diff.js'; import { type ProtoDocument } from '../../analyzer/contract/protobuf.js'; import { type GqlDocument } from '../../analyzer/contract/graphql.js'; import { type SchemaProvenance } from '../../analyzer/contract/types.js'; import { type GovernanceFinding } from './enforcement-policy.js'; export interface CertifyServiceContractInput { directory: string; baseRef?: string; /** Cap on each listed item kind (default 100, max 1,000); totals are always given. */ maxResults?: number; allowBaseFallback?: boolean; /** * Opt-in: also count client call sites in indexed sibling repositories * (`.openlore/federation.json`), as `certify_public_surface` does for an exported symbol. * * A service's consumers are usually NOT in its own repository, so a breaking verdict computed * from this repository alone reads as "nothing calls it" for exactly the change most worth * stopping (change: add-contract-graph-projection). */ federation?: boolean; /** Limit the federation census to these registry repo names (default: all). */ federationRepos?: string[]; } /** Consumers of one operation found in a sibling repository. */ export interface FederatedConsumer { /** The registry name of the sibling repository — its stable id, not its path. */ repo: string; file: string; line: number; } /** What the federation census covered, and what it did not. */ export interface FederationCensus { /** Siblings scanned in full. */ repos: string[]; /** Siblings whose scan hit a file cap: scanned, but not exhaustively. */ partial: string[]; /** Siblings not scanned at all, each with why. */ skipped: Array<{ repo: string; reason: string; }>; /** Skipped entries past the cap. */ skippedOmitted?: number; } /** What one revision's scan of one format examined, read, and could not read. */ interface ScanScope { /** Specifications that could not be parsed. */ unreadable: Array<{ file: string; reason: string; }>; /** Every candidate of this format at this revision (examined or not). */ candidates: Set; /** Candidates whose text was examined. */ examined: Set; /** Candidates that could not be read at all (size, a link outside the repository, I/O). */ unread: Array<{ file: string; reason: string; }>; /** Whether a cap left candidates unexamined. */ capped: boolean; /** * Examined candidates that look GENERATED or VENDORED, each with the rule that matched. An * annotation only: the schema is graded exactly as before, never dropped or downgraded on it * (change: disclose-schema-provenance). */ provenance: Map; } /** * One revision's specifications, with what was and was not examined. * * The top-level fields are the OpenAPI / Swagger scan of YAML and JSON files, exactly as they * were before protobuf was read. `proto` is a separate scan of `.proto` files with its own window * and cap (change: add-contract-graph-projection): sharing one window let a repository's protobuf * files push its OpenAPI document out of the scan, and sharing one cap flag downgraded every * OpenAPI removal to "may only have moved". */ export interface SpecSide extends ScanScope { docs: ContractDocument[]; /** GraphQL SDL files, a scope of their own too; client documents are not schemas. */ graphql: ScanScope & { docs: GqlDocument[]; clientDocuments: string[]; }; proto: ScanScope & { /** Types resolved across every `.proto` file of this revision. */ docs: ProtoDocument[]; }; } /** * {@link headSpecs} for the briefings' hot path: the candidates are listed (one git call) and * stat-stamped, and their texts are read and parsed again only when a stamp changed. */ export declare function headSpecsCached(root: string): Promise; export declare function headSpecs(root: string, listed?: string[]): Promise; /** The route inventory written by `analyze` (undefined when absent). */ export declare function indexedRoutes(root: string): Promise; /** * Client call sites in this repository whose HTTP method and literal path match each operation * (with or without its base path), keyed by operation address. */ export declare function callSitesFor(root: string, ops: ReadonlyArray<{ file: string; op: Pick; }>, boundaries: string[], /** Filled with the per-operation totals (before the per-operation cap) and whether a file cap was hit. */ stats?: { capped: boolean; totals: Map; }, /** Also carry each call's offset and client (for reading its body); not served. */ withCall?: boolean, /** Read only these root-relative source files (a diff's), not the whole repository. */ onlyFiles?: ReadonlySet): Promise>>; /** * The payload check for call sites in `files` (root-relative), for `verify_change`: the same rule as * `certify_service_contract`'s `payload`, reading only those files, and, with `onLine`, only call * sites on the lines a diff added or changed. */ export declare function payloadFindingsForFiles(root: string, files: readonly string[], onLine?: (file: string, line: number) => boolean): Promise<{ findings: GovernanceFinding[]; boundaries: string[]; notAssessed: number; }>; export declare function handleCertifyServiceContract(input: CertifyServiceContractInput): Promise>; export {}; //# sourceMappingURL=service-contract.d.ts.map