From 5ab2b02924b465ca9325338ccd8456f54a246892 Mon Sep 17 00:00:00 2001 From: intech Date: Fri, 12 Jun 2026 21:59:59 +0400 Subject: [PATCH] docs(examples): align with opt-in resilience defaults Co-Authored-By: Claude Opus 4.8 (1M context) --- auth/README.md | 2 +- basic-service-bun/README.md | 2 +- basic-service-bun/src/index.ts | 3 ++- basic-service-node/README.md | 2 +- basic-service-node/src/index.ts | 3 ++- basic-service-tsx/README.md | 2 +- basic-service-tsx/src/index.ts | 3 ++- performance-test-server/README.md | 15 ++++++++------- performance-test-server/src/index.ts | 15 ++++++++------- with-custom-interceptor/src/index.ts | 2 +- 10 files changed, 27 insertions(+), 22 deletions(-) diff --git a/auth/README.md b/auth/README.md index cbd8d92..a8cf039 100644 --- a/auth/README.md +++ b/auth/README.md @@ -90,7 +90,7 @@ Both services expose three RPC methods with the same authorization levels: Request │ ▼ -defaultInterceptors (error handler, timeout, bulkhead) +defaultInterceptors (error handler, validation) │ ▼ jwtAuth (extract + verify JWT, set AuthContext) diff --git a/basic-service-bun/README.md b/basic-service-bun/README.md index 2780da0..c539119 100644 --- a/basic-service-bun/README.md +++ b/basic-service-bun/README.md @@ -8,7 +8,7 @@ Demonstrates: - Greeter service with two RPC methods - Health checks (gRPC + HTTP) via `@connectum/healthcheck` - Server reflection via `@connectum/reflection` -- Default interceptors (error handler, timeout, bulkhead) via `@connectum/interceptors` +- Default interceptors (error handler, validation) via `@connectum/interceptors` - Graceful shutdown ## Prerequisites diff --git a/basic-service-bun/src/index.ts b/basic-service-bun/src/index.ts index 63ff4c4..eac5d9d 100644 --- a/basic-service-bun/src/index.ts +++ b/basic-service-bun/src/index.ts @@ -24,7 +24,8 @@ console.log("🚀 Starting Basic Service Example...\n"); * * Interceptors are passed explicitly — core has no built-in interceptors. * Use createDefaultInterceptors() from @connectum/interceptors for the - * production-ready chain (error handler, timeout, bulkhead, etc.). + * default chain (error handler + validation; resilience interceptors + * such as timeout, bulkhead, circuitBreaker, retry are opt-in). */ const options: CreateServerOptions = { // Register services diff --git a/basic-service-node/README.md b/basic-service-node/README.md index 9a8ef74..7d7f956 100644 --- a/basic-service-node/README.md +++ b/basic-service-node/README.md @@ -8,7 +8,7 @@ Demonstrates: - Greeter service with two RPC methods - Health checks (gRPC + HTTP) via `@connectum/healthcheck` - Server reflection via `@connectum/reflection` -- Default interceptors (error handler, timeout, bulkhead) via `@connectum/interceptors` +- Default interceptors (error handler, validation) via `@connectum/interceptors` - Graceful shutdown ## Prerequisites diff --git a/basic-service-node/src/index.ts b/basic-service-node/src/index.ts index 63ff4c4..eac5d9d 100644 --- a/basic-service-node/src/index.ts +++ b/basic-service-node/src/index.ts @@ -24,7 +24,8 @@ console.log("🚀 Starting Basic Service Example...\n"); * * Interceptors are passed explicitly — core has no built-in interceptors. * Use createDefaultInterceptors() from @connectum/interceptors for the - * production-ready chain (error handler, timeout, bulkhead, etc.). + * default chain (error handler + validation; resilience interceptors + * such as timeout, bulkhead, circuitBreaker, retry are opt-in). */ const options: CreateServerOptions = { // Register services diff --git a/basic-service-tsx/README.md b/basic-service-tsx/README.md index eaf965d..bdee349 100644 --- a/basic-service-tsx/README.md +++ b/basic-service-tsx/README.md @@ -8,7 +8,7 @@ Demonstrates: - Greeter service with two RPC methods - Health checks (gRPC + HTTP) via `@connectum/healthcheck` - Server reflection via `@connectum/reflection` -- Default interceptors (error handler, timeout, bulkhead) via `@connectum/interceptors` +- Default interceptors (error handler, validation) via `@connectum/interceptors` - Graceful shutdown ## Prerequisites diff --git a/basic-service-tsx/src/index.ts b/basic-service-tsx/src/index.ts index 63ff4c4..eac5d9d 100644 --- a/basic-service-tsx/src/index.ts +++ b/basic-service-tsx/src/index.ts @@ -24,7 +24,8 @@ console.log("🚀 Starting Basic Service Example...\n"); * * Interceptors are passed explicitly — core has no built-in interceptors. * Use createDefaultInterceptors() from @connectum/interceptors for the - * production-ready chain (error handler, timeout, bulkhead, etc.). + * default chain (error handler + validation; resilience interceptors + * such as timeout, bulkhead, circuitBreaker, retry are opt-in). */ const options: CreateServerOptions = { // Register services diff --git a/performance-test-server/README.md b/performance-test-server/README.md index 764bbfb..1255116 100644 --- a/performance-test-server/README.md +++ b/performance-test-server/README.md @@ -174,14 +174,10 @@ interceptors: [] // NO interceptors - pure baseline ### Validation Only (Port 8082) ```typescript +// Validation is enabled by default; resilience interceptors are opt-in, +// so only errorHandler needs to be disabled explicitly. interceptors: createDefaultInterceptors({ errorHandler: false, - timeout: false, - bulkhead: false, - circuitBreaker: false, - retry: false, - validation: true, - serializer: false, }) ``` @@ -212,8 +208,13 @@ interceptors: [ interceptors: [ ...createDefaultInterceptors({ errorHandler: { logErrors: true, includeStackTrace: true }, + // Resilience interceptors are opt-in — enabled explicitly here + // so this configuration measures the full chain overhead. + timeout: true, + bulkhead: true, + circuitBreaker: true, + retry: true, serializer: true, - validation: true, }), createLoggerInterceptor({ level: "error", skipHealthCheck: true }), createOtelInterceptor({ diff --git a/performance-test-server/src/index.ts b/performance-test-server/src/index.ts index de0b2d2..dc236b4 100644 --- a/performance-test-server/src/index.ts +++ b/performance-test-server/src/index.ts @@ -52,14 +52,10 @@ const validationOptions: CreateServerOptions = { port: 8082, host: "0.0.0.0", tls: tlsConfig, + // Validation is enabled by default; resilience interceptors are opt-in, + // so only errorHandler needs to be disabled explicitly. interceptors: createDefaultInterceptors({ errorHandler: false, - timeout: false, - bulkhead: false, - circuitBreaker: false, - retry: false, - validation: true, - serializer: false, }), }; @@ -111,8 +107,13 @@ const fullChainOptions: CreateServerOptions = { logErrors: true, includeStackTrace: true, }, + // Resilience interceptors are opt-in — enable them explicitly + // so this configuration measures the full chain overhead. + timeout: true, + bulkhead: true, + circuitBreaker: true, + retry: true, serializer: true, - validation: true, }), createLoggerInterceptor({ level: "error", diff --git a/with-custom-interceptor/src/index.ts b/with-custom-interceptor/src/index.ts index 56a6b00..0fcab4a 100644 --- a/with-custom-interceptor/src/index.ts +++ b/with-custom-interceptor/src/index.ts @@ -19,7 +19,7 @@ console.log("Starting Custom Interceptor Example...\n"); * Create server with custom interceptors appended after the default chain. * * Interceptor execution order: - * 1. Default chain (errorHandler, timeout, bulkhead, circuitBreaker, retry, fallback, serializer) + * 1. Default chain (errorHandler, validation; resilience interceptors are opt-in) * 2. apiKeyInterceptor — checks x-api-key for SecureEcho * 3. rateLimitInterceptor — rate-limits RateLimitedEcho */