mirror of
https://github.com/morluto/rea.git
synced 2026-10-31 20:06:14 +00:00
Keep each admitted HTTP handler owned through Evidence writes and error rendering, including after its client disconnects. Close joins graceful transport shutdown and handler work before publishing completion, and propagates exact late failures while preserving ordinary request diagnostics. Share lifecycle ownership across OpenAI, Anthropic, and Gemini fixtures while retaining protocol-specific parsing and responses. Exercise real disconnects, graceful concurrent and repeated close, ordinary 400s, and opaque late failures.
17 lines
511 B
TypeScript
17 lines
511 B
TypeScript
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
|
|
export interface ModelFixtureServer {
|
|
readonly origin: string;
|
|
readonly failure: string | undefined;
|
|
close(): Promise<void>;
|
|
}
|
|
|
|
/** Own the HTTP transport and every admitted protocol handler through finalization. */
|
|
export function createModelFixtureServer(
|
|
handleRequest: (
|
|
request: IncomingMessage,
|
|
response: ServerResponse,
|
|
recordFailure: (cause: unknown) => string,
|
|
) => Promise<void>,
|
|
): Promise<ModelFixtureServer>;
|