/** * Isolation Module * * Handles project isolation checks to prevent noisy neighbor issues. * Manages circuit breakers and concurrency limits per project. * * @module server/runtime-handler/isolation */ import { type IsolationCheckResult, projectIsolation } from "./project-isolation.js"; export type { IsolationCheckResult } from "./project-isolation.js"; /** * Injection interface for testing isolation dependencies */ interface IsolationDeps { checkRequest?: typeof projectIsolation.checkRequest; startRequest?: typeof projectIsolation.startRequest; completeRequest?: typeof projectIsolation.completeRequest; recordTimeout?: typeof projectIsolation.recordTimeout; } /** * Inject dependencies for testing. Pass null to reset to defaults. */ export declare function __injectDepsForTests(deps: IsolationDeps | null): void; /** * Check if a request is allowed to proceed based on isolation rules. */ export declare function checkRequestIsolation(projectSlug: string | undefined, shouldCheck: boolean): IsolationCheckResult; /** * Start tracking an isolated request. * Call this after checkRequestIsolation returns allowed: true. */ export declare function startIsolatedRequest(projectSlug: string | undefined, shouldCheck: boolean): void; /** * Complete an isolated request. * Updates circuit breaker state based on timeout status. */ export declare function completeIsolatedRequest(projectSlug: string | undefined, shouldCheck: boolean, isTimeout: boolean): void; /** * Record timeout state immediately, then release concurrency when work settles. * * A handler may ignore cancellation forever. Waiting for settlement before * recording the timeout would prevent the circuit breaker from seeing the * failure, while releasing the slot immediately would undercount live work. */ export declare function completeIsolatedRequestOnSettlement(projectSlug: string | undefined, shouldCheck: boolean, isTimeout: boolean, settled: Promise): void; /** * Create a 503 Service Unavailable response for isolation rejection. */ export declare function createIsolationErrorResponse(check: IsolationCheckResult): Response; export { projectIsolation } from "./project-isolation.js"; //# sourceMappingURL=isolation.d.ts.map