@fuzdev/fuz_app 0.184.0 → 0.186.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/CLAUDE.md +18 -3
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +36 -5
- package/dist/actions/register_action_ws.d.ts +14 -7
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.d.ts +17 -4
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +41 -7
- package/dist/auth/CLAUDE.md +18 -9
- package/dist/auth/account_queries.d.ts +53 -40
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +57 -50
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +59 -25
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +26 -9
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_queries.d.ts +11 -3
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +4 -4
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +3 -2
- package/dist/auth/audit_log_schema.js +1 -1
- package/dist/auth/auth_ddl.d.ts.map +1 -1
- package/dist/auth/auth_ddl.js +4 -0
- package/dist/auth/cleanup.d.ts +34 -3
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +12 -4
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +35 -0
- package/dist/auth/role_grant_offer_queries.d.ts +13 -13
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +12 -13
- package/dist/auth/role_grant_queries.d.ts +16 -9
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +16 -9
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +15 -0
- package/dist/auth/session_queries.d.ts +24 -0
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +28 -0
- package/dist/db/CLAUDE.md +3 -3
- package/dist/db/cell_ddl.d.ts +8 -3
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +10 -5
- package/dist/http/CLAUDE.md +1 -1
- package/dist/http/body_limit.d.ts +4 -4
- package/dist/http/body_limit.js +4 -4
- package/dist/http/pending_effects.d.ts +8 -4
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/route_spec.d.ts +3 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/realtime/audit_log_sse.d.ts +1 -1
- package/dist/realtime/sse.d.ts +2 -2
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse_constants.d.ts +1 -1
- package/dist/realtime/sse_constants.js +1 -1
- package/dist/server/app_server.d.ts +59 -71
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +52 -60
- package/dist/server/shutdown_drain.d.ts +69 -0
- package/dist/server/shutdown_drain.d.ts.map +1 -0
- package/dist/server/shutdown_drain.js +77 -0
- package/dist/testing/CLAUDE.md +197 -66
- package/dist/testing/admin_integration.d.ts +2 -2
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +36 -20
- package/dist/testing/app_server.d.ts +5 -7
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +5 -7
- package/dist/testing/auth_apps.d.ts +3 -1
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +22 -5
- package/dist/testing/cross_backend/backend_config.d.ts +8 -0
- package/dist/testing/cross_backend/backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/backend_log.d.ts +71 -0
- package/dist/testing/cross_backend/backend_log.d.ts.map +1 -0
- package/dist/testing/cross_backend/backend_log.js +134 -0
- package/dist/testing/cross_backend/backend_swap.d.ts +41 -0
- package/dist/testing/cross_backend/backend_swap.d.ts.map +1 -0
- package/dist/testing/cross_backend/backend_swap.js +431 -0
- package/dist/testing/cross_backend/body_size_smuggling.js +3 -3
- package/dist/testing/cross_backend/bootstrap_backend.d.ts +3 -1
- package/dist/testing/cross_backend/bootstrap_backend.d.ts.map +1 -1
- package/dist/testing/cross_backend/bootstrap_backend.js +9 -5
- package/dist/testing/cross_backend/conformance_case.d.ts +11 -6
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_case.js +4 -0
- package/dist/testing/cross_backend/conformance_principal.d.ts +2 -2
- package/dist/testing/cross_backend/conformance_principal.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_principal.js +27 -10
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +10 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +33 -7
- package/dist/testing/cross_backend/default_backend_configs.d.ts +38 -5
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +50 -15
- package/dist/testing/cross_backend/in_process_setup.d.ts +1 -1
- package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +53 -31
- package/dist/testing/cross_backend/revocation_drivers.d.ts +14 -2
- package/dist/testing/cross_backend/revocation_drivers.d.ts.map +1 -1
- package/dist/testing/cross_backend/revocation_drivers.js +36 -8
- package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +7 -0
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +4 -2
- package/dist/testing/cross_backend/setup.d.ts +44 -43
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +64 -62
- package/dist/testing/cross_backend/spawn_backend.d.ts +19 -1
- package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -1
- package/dist/testing/cross_backend/spawn_backend.js +138 -11
- package/dist/testing/cross_backend/spine_suites.d.ts +17 -14
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +37 -15
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -2
- package/dist/testing/cross_backend/standard.d.ts +18 -82
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +6 -21
- package/dist/testing/cross_backend/standard_auth.d.ts +74 -0
- package/dist/testing/cross_backend/standard_auth.d.ts.map +1 -0
- package/dist/testing/cross_backend/standard_auth.js +28 -0
- package/dist/testing/cross_backend/standard_bundle.d.ts +48 -0
- package/dist/testing/cross_backend/standard_bundle.d.ts.map +1 -0
- package/dist/testing/cross_backend/standard_bundle.js +43 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +18 -6
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +23 -8
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +7 -30
- package/dist/testing/cross_backend/testing_server_core.d.ts +16 -3
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +20 -4
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +6 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +7 -3
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +4 -3
- package/dist/testing/data_exposure.d.ts +4 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +93 -25
- package/dist/testing/db_invariants.d.ts +5 -5
- package/dist/testing/db_invariants.js +5 -5
- package/dist/testing/error_coverage.d.ts +5 -0
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +2 -1
- package/dist/testing/integration.d.ts +4 -20
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +49 -79
- package/dist/testing/integration_helpers.d.ts +16 -0
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +29 -1
- package/dist/testing/logged_errors.d.ts +61 -0
- package/dist/testing/logged_errors.d.ts.map +1 -0
- package/dist/testing/logged_errors.js +285 -0
- package/dist/testing/middleware_gate_probes.d.ts +55 -1
- package/dist/testing/middleware_gate_probes.d.ts.map +1 -1
- package/dist/testing/middleware_gate_probes.js +76 -3
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +41 -16
- package/dist/testing/stubs.d.ts +5 -1
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +6 -3
- package/dist/testing/test_app.d.ts +39 -9
- package/dist/testing/test_app.d.ts.map +1 -1
- package/dist/testing/test_app.js +70 -12
- package/dist/testing/transports/fetch_transport.d.ts +10 -0
- package/dist/testing/transports/fetch_transport.d.ts.map +1 -1
- package/dist/testing/transports/fetch_transport.js +13 -0
- package/package.json +4 -3
|
@@ -24,7 +24,7 @@ import { type RestErrorDef, type REST_AUTHENTICATION_REQUIRED, type REST_CREDENT
|
|
|
24
24
|
import type { RateLimitKey } from '../rate_limiter.js';
|
|
25
25
|
import type { MiddlewareSpec } from './middleware_spec.js';
|
|
26
26
|
import { type ReadonlyJson, type RouteFailOf, type RouteOk, type RouteRaw, type RouteRawBody, type RouteResult, type RouteSse } from './route_result.js';
|
|
27
|
-
import type { OpenedSseStream,
|
|
27
|
+
import type { OpenedSseStream, SseStreamOptions, SseStream } from '../realtime/sse.js';
|
|
28
28
|
import { type RouteAuth } from './auth_shape.js';
|
|
29
29
|
import { type JsonBodyResult } from './json_text.js';
|
|
30
30
|
import { type QueryPairsRead } from './request_target.js';
|
|
@@ -220,7 +220,7 @@ export interface RouteContext<TAuth extends RequestContext | null = RequestConte
|
|
|
220
220
|
post_commit_effects: Array<() => void | Promise<void>>;
|
|
221
221
|
}
|
|
222
222
|
/** Options for `RouteContext.open_sse`. */
|
|
223
|
-
export interface RouteOpenSseOptions extends
|
|
223
|
+
export interface RouteOpenSseOptions extends SseStreamOptions {
|
|
224
224
|
/**
|
|
225
225
|
* Logger for the stream's serialization and `on_close` listener errors and
|
|
226
226
|
* its outbound-overflow warning. Default: the `log` given `apply_route_specs`.
|
|
@@ -233,7 +233,7 @@ export interface RouteOpenSseOptions extends SseResponseOptions {
|
|
|
233
233
|
* which `create_app_server` passes. Injected, so this module stays free of
|
|
234
234
|
* `hono/streaming`.
|
|
235
235
|
*/
|
|
236
|
-
export type RouteSseOpener = <T>(c: Context, log: Logger, options?:
|
|
236
|
+
export type RouteSseOpener = <T>(c: Context, log: Logger, options?: SseStreamOptions) => OpenedSseStream<T>;
|
|
237
237
|
/**
|
|
238
238
|
* Route handler function — receives the `RouteContext` and returns a result
|
|
239
239
|
* (`route_ok`, `route_fail`, `route_raw`, `route_sse` in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route_spec.d.ts","sourceRoot":"","sources":["../../src/lib/http/route_spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAW,IAAI,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAEtE,OAAO,EAEN,KAAK,SAAS,EAEd,KAAK,UAAU,EACf,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,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CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,qEAAqE;IACrE,qBAAqB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5C,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B,KACC,qBA8BF,CAAC;AAuKF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,mBAAmB,GAAI,GAAG,OAAO,EAAE,UAAU,qBAAqB,KAAG,QAyBjF,CAAC;AAwOF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,KAAK,IAAI,EAAE,OAAO,KAAK,CAAC,cAAc,CAAC,KAAG,IAIhF,CAAC;AAsGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,eAAO,MAAM,iBAAiB,GAC7B,KAAK,IAAI,EACT,OAAO,KAAK,CAAC,SAAS,CAAC,EACvB,qBAAqB,iBAAiB,EACtC,KAAK,MAAM,EACX,IAAI,EAAE,EACN,UAAU,sBAAsB,KAC9B,IAuKF,CAAC;AAeF,uCAAuC;AACvC,MAAM,WAAW,sBAAsB;IACtC,iHAAiH;IACjH,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC1B;AA4CD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,EAAE,OAAO,KAAK,CAAC,SAAS,CAAC,KAAG,KAAK,CAAC,SAAS,CAK3F,CAAC"}
|
|
@@ -170,7 +170,7 @@ export declare const create_audit_log_sse: (options: {
|
|
|
170
170
|
*/
|
|
171
171
|
max_per_scope?: number | null;
|
|
172
172
|
/**
|
|
173
|
-
* Each stream's keep-alive interval (`
|
|
173
|
+
* Each stream's keep-alive interval (`SseStreamOptions.keep_alive_ms`), in
|
|
174
174
|
* ms; `null` turns keep-alives off. A test server shortens it.
|
|
175
175
|
*
|
|
176
176
|
* @default SSE_KEEP_ALIVE_INTERVAL_MS
|
package/dist/realtime/sse.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export interface SseNotification {
|
|
|
68
68
|
params: unknown;
|
|
69
69
|
}
|
|
70
70
|
/** Options for `create_sse_stream`. */
|
|
71
|
-
export interface
|
|
71
|
+
export interface SseStreamOptions {
|
|
72
72
|
/**
|
|
73
73
|
* The account the stream belongs to, named in the warning logged when the
|
|
74
74
|
* stream ends on its outbound budget.
|
|
@@ -124,7 +124,7 @@ export interface OpenedSseStream<T> {
|
|
|
124
124
|
* @throws Error when `options.keep_alive_ms` is out of range
|
|
125
125
|
* (`validate_sse_keep_alive_ms`)
|
|
126
126
|
*/
|
|
127
|
-
export declare const create_sse_stream: <T = unknown>(c: Context, log: Logger, options?:
|
|
127
|
+
export declare const create_sse_stream: <T = unknown>(c: Context, log: Logger, options?: SseStreamOptions) => OpenedSseStream<T>;
|
|
128
128
|
/** Spec for a push event — declares params schema, description, and channel. */
|
|
129
129
|
export interface EventSpec {
|
|
130
130
|
/** Event method name, used as the JSON-RPC notification `method`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../src/lib/realtime/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAYrE;;;;GAIG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,GAAG,OAAO;IACrC;;;;OAIG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACxB,wBAAwB;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;;;OAKG;IACH,QAAQ,E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;;;;OAIG;IACH,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,GAAG,OAAO,EAC5C,GAAG,OAAO,EACV,KAAK,MAAM,EACX,UAAU,gBAAgB,KACxB,eAAe,CAAC,CAAC,CAoGnB,CAAC;AAEF,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACzB,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,MAAM,EAAE,SAAS,CAAC;IAClB,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GAAI,CAAC,SAAS,eAAe,EACrE,aAAa;IAAE,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;CAAE,EAC9D,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,KAAK,MAAM,KACT;IAAE,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;CAmBjD,CAAC"}
|
|
@@ -37,7 +37,7 @@ export declare const SSE_KEEP_ALIVE_INTERVAL_MS = 15000;
|
|
|
37
37
|
export declare const SSE_KEEP_ALIVE_INTERVAL_MS_MAX = 2147483647;
|
|
38
38
|
/**
|
|
39
39
|
* Throw unless `keep_alive_ms` is a valid keep-alive interval
|
|
40
|
-
* (`
|
|
40
|
+
* (`SseStreamOptions.keep_alive_ms`):
|
|
41
41
|
* `undefined` (the default), `null` (off), or a positive number of ms up to
|
|
42
42
|
* `SSE_KEEP_ALIVE_INTERVAL_MS_MAX`. Timers read anything else — zero, a
|
|
43
43
|
* negative, `NaN`, `Infinity`, or past the max — as an interval of about
|
|
@@ -42,7 +42,7 @@ export const SSE_KEEP_ALIVE_INTERVAL_MS = 15_000;
|
|
|
42
42
|
export const SSE_KEEP_ALIVE_INTERVAL_MS_MAX = 2_147_483_647;
|
|
43
43
|
/**
|
|
44
44
|
* Throw unless `keep_alive_ms` is a valid keep-alive interval
|
|
45
|
-
* (`
|
|
45
|
+
* (`SseStreamOptions.keep_alive_ms`):
|
|
46
46
|
* `undefined` (the default), `null` (off), or a positive number of ms up to
|
|
47
47
|
* `SSE_KEEP_ALIVE_INTERVAL_MS_MAX`. Timers read anything else — zero, a
|
|
48
48
|
* negative, `NaN`, `Infinity`, or past the max — as an interval of about
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
import { Hono, type Context } from 'hono';
|
|
11
11
|
import type { UpgradeWebSocket } from 'hono/ws';
|
|
12
12
|
import type { AnySchema } from '@fuzdev/fuz_schema/schema.ts';
|
|
13
|
-
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
14
13
|
import type { BootstrapTokenStore } from '../auth/bootstrap_token_store.js';
|
|
15
14
|
import { type EventSpec } from '../realtime/sse.js';
|
|
16
15
|
import { type AuditLogSse } from '../realtime/audit_log_sse.js';
|
|
@@ -25,11 +24,11 @@ import { type AppSurfaceSpec, type AppSurfaceDiagnostic, type RpcEndpointSpec }
|
|
|
25
24
|
import { type RouteSpec } from '../http/route_spec.js';
|
|
26
25
|
import type { MiddlewareCarveOut, MiddlewareSpec } from '../http/middleware_spec.js';
|
|
27
26
|
import { type BootstrapStatus } from '../auth/bootstrap_routes.js';
|
|
28
|
-
import { type EffectErrorContext
|
|
27
|
+
import { type EffectErrorContext } from '../http/pending_effects.js';
|
|
29
28
|
import { type WsEndpointSpec } from '../actions/ws_endpoint_spec.js';
|
|
30
29
|
import type { ConnectionRegistry } from '../actions/connection_registry.js';
|
|
31
|
-
import { type
|
|
32
|
-
import type
|
|
30
|
+
import { type AuthCleanupSchedule } from '../auth/cleanup.js';
|
|
31
|
+
import { type ShutdownDrainGivenUp } from './shutdown_drain.js';
|
|
33
32
|
/**
|
|
34
33
|
* Bootstrap configuration for `AppServerOptions.bootstrap`.
|
|
35
34
|
*
|
|
@@ -291,27 +290,34 @@ export interface AppServerOptions {
|
|
|
291
290
|
keep_alive_ms?: number | null;
|
|
292
291
|
};
|
|
293
292
|
/**
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
293
|
+
* Whether the auth cleanup runs beside the server — required, with no
|
|
294
|
+
* default, so a server neither gets nor loses the sweeps without writing
|
|
295
|
+
* it out. `{every_ms}` runs `start_auth_cleanup` over `backend.deps` — a
|
|
296
|
+
* pass as assembly finishes, then one per `every_ms` — stopped by
|
|
297
|
+
* `AppServer.close` within its drain bound. Each pass deletes expired
|
|
298
|
+
* sessions and closes the connections they opened through
|
|
299
|
+
* `deps.connection_closer` (every WebSocket connection registry and audit
|
|
300
|
+
* stream this server mounts), and audits each newly expired role_grant
|
|
301
|
+
* offer once.
|
|
300
302
|
*
|
|
301
|
-
* **
|
|
302
|
-
*
|
|
303
|
-
*
|
|
303
|
+
* **A production server passes
|
|
304
|
+
* `{every_ms: DEFAULT_AUTH_CLEANUP_INTERVAL_MS}`.** With `'off'` nothing
|
|
305
|
+
* sweeps: expired session rows accumulate and an offer's expiry is never
|
|
306
|
+
* audited. Connections do not depend on it — each closes at its
|
|
304
307
|
* credential's deadline (`auth/credential_deadline.ts`), and the sweep's
|
|
305
|
-
* close repeats that one.
|
|
306
|
-
*
|
|
308
|
+
* close repeats that one. Twin of the Rust spine's
|
|
309
|
+
* `AuthCleanupSchedule::Every`, which a server's backend options carry and
|
|
310
|
+
* its backend attaches as a `fuz_auth::AuthCleanup`.
|
|
307
311
|
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
* Leave it off in an in-process test harness — a background pass deletes
|
|
311
|
-
* rows and writes audit rows mid-test — and in a process that runs
|
|
312
|
+
* `'off'` in an in-process test harness — a background pass deletes rows
|
|
313
|
+
* and writes audit rows mid-test — and in a process that runs
|
|
312
314
|
* `run_auth_cleanup` on a schedule of its own.
|
|
315
|
+
*
|
|
316
|
+
* Checked with the other options, before assembly acquires anything:
|
|
317
|
+
* `every_ms` must be a positive finite number of ms no greater than
|
|
318
|
+
* `PERIODIC_INTERVAL_MS_MAX`.
|
|
313
319
|
*/
|
|
314
|
-
auth_cleanup
|
|
320
|
+
auth_cleanup: AuthCleanupSchedule;
|
|
315
321
|
/** SSE event specs for surface generation. Defaults to `[]` (no SSE events). */
|
|
316
322
|
event_specs?: Array<EventSpec>;
|
|
317
323
|
/**
|
|
@@ -429,13 +435,13 @@ export interface AppServerOptions {
|
|
|
429
435
|
*/
|
|
430
436
|
await_pending_effects?: boolean;
|
|
431
437
|
/**
|
|
432
|
-
* How long `AppServer.close` waits for the work still in flight —
|
|
433
|
-
* HTTP request and WS message accepted,
|
|
434
|
-
* its effect queues (failure audit
|
|
435
|
-
* thunks) have flushed, and every pool
|
|
436
|
-
* closes the database. What is still
|
|
437
|
-
*
|
|
438
|
-
* number of ms.
|
|
438
|
+
* How long `AppServer.close` waits for the work still in flight — an auth
|
|
439
|
+
* cleanup pass in progress, each HTTP request and WS message accepted,
|
|
440
|
+
* until its handler has returned and its effect queues (failure audit
|
|
441
|
+
* rows, API token usage, post-commit thunks) have flushed, and every pool
|
|
442
|
+
* write of `deps.audit` — before it closes the database. What is still
|
|
443
|
+
* running then is given up on and logged. Default
|
|
444
|
+
* `DEFAULT_SHUTDOWN_DRAIN_TIMEOUT_MS`; must be a positive number of ms.
|
|
439
445
|
*/
|
|
440
446
|
shutdown_drain_timeout_ms?: number;
|
|
441
447
|
/**
|
|
@@ -477,9 +483,8 @@ export interface AppServer {
|
|
|
477
483
|
/**
|
|
478
484
|
* Shut the server's resources down, in order:
|
|
479
485
|
*
|
|
480
|
-
* 1. stop the auth cleanup schedule when
|
|
481
|
-
*
|
|
482
|
-
* own, so a shutdown with a deadline races it
|
|
486
|
+
* 1. stop the auth cleanup schedule when `auth_cleanup` started one: no
|
|
487
|
+
* pass starts from here, and a pass in progress is waited for in step 3
|
|
483
488
|
* 2. close every live connection on `deps.connection_closer`
|
|
484
489
|
* (`close_all_connections`) — each WebSocket with `WS_CLOSE_GOING_AWAY`, each
|
|
485
490
|
* audit stream — including registries supplied through
|
|
@@ -489,16 +494,21 @@ export interface AppServer {
|
|
|
489
494
|
* is left closing, so an upgrade or stream that registers afterward is
|
|
490
495
|
* born closed — refused at once rather than outliving the server — and
|
|
491
496
|
* a closed registry hosts no other server
|
|
492
|
-
* 3. wait for the
|
|
497
|
+
* 3. wait for the auth cleanup pass in progress, if any — JS cannot abort
|
|
498
|
+
* one, so at the bound it is given up on and left to finish against the
|
|
499
|
+
* closing database, where the Rust shutdown aborts its upkeep task —
|
|
500
|
+
* and for the work still in flight on `deps.request_tracker` and
|
|
493
501
|
* `deps.audit`: every HTTP request and WS message accepted, until its
|
|
494
502
|
* handler has returned and its effect queues have flushed (failure
|
|
495
503
|
* audit rows, API token usage, post-commit thunks; production holds no
|
|
496
|
-
* HTTP response for them, and a WS reply is sent before its flush),
|
|
504
|
+
* HTTP response for them, and a WS reply is sent before its flush),
|
|
505
|
+
* every WebSocket still opening — its admission re-read, which step 2's
|
|
506
|
+
* close turns into a going-away refusal, and `on_socket_open` — and
|
|
497
507
|
* every pool write of the emitter — a handler still running when the
|
|
498
508
|
* close starts is waited for, then its flush. A WS handler's socket is
|
|
499
509
|
* closed in step 2, which aborts its `signal`; one that runs on is still
|
|
500
|
-
* waited for.
|
|
501
|
-
* gives up on. From here a request that arrives is refused — HTTP with
|
|
510
|
+
* waited for. One bound for all of it, `shutdown_drain_timeout_ms`,
|
|
511
|
+
* logging what it gives up on. From here a request that arrives is refused — HTTP with
|
|
502
512
|
* 503 `service_unavailable`, and a WS message, on a socket step 2
|
|
503
513
|
* didn't end (a hand mount), with the `service_unavailable` JSON-RPC
|
|
504
514
|
* error — never run against the closing database. The Rust
|
|
@@ -520,17 +530,23 @@ export interface AppServer {
|
|
|
520
530
|
* host another server
|
|
521
531
|
* 5. close the database connection (`AppBackend.close`)
|
|
522
532
|
*
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
*
|
|
533
|
+
* Resolves what step 3 gave up on at its bound, every count `0` when it
|
|
534
|
+
* drained everything; `shutdown_gave_up` reads it. A process that serves
|
|
535
|
+
* the app reports a give-up as a failed exit, as the Rust spine's
|
|
536
|
+
* `StartupError::ShutdownGivenUp` does.
|
|
537
|
+
*
|
|
538
|
+
* Idempotent: a second call settles with the first one's outcome — the
|
|
539
|
+
* same report, or the same rejection (a failed close is not retried) — and
|
|
540
|
+
* concurrent calls share one shutdown. Never await it from a handler: its
|
|
541
|
+
* own request is held, so the drain waits on it until
|
|
542
|
+
* `shutdown_drain_timeout_ms`.
|
|
527
543
|
*
|
|
528
544
|
* Stop accepting new HTTP connections first — without awaiting the
|
|
529
545
|
* listener's full drain, since live WebSockets hold it open until `close`
|
|
530
546
|
* ends them — so no new request reaches a closed database. A request the
|
|
531
547
|
* app already accepted is waited for in step 3.
|
|
532
548
|
*/
|
|
533
|
-
close: () => Promise<
|
|
549
|
+
close: () => Promise<ShutdownDrainGivenUp>;
|
|
534
550
|
}
|
|
535
551
|
/**
|
|
536
552
|
* Assert that `audit_sse` was wired by `create_app_server` and return it
|
|
@@ -557,12 +573,6 @@ export declare const require_audit_sse: (source: {
|
|
|
557
573
|
* `fuz_http` `DEFAULT_BODY_LIMIT_BYTES`.
|
|
558
574
|
*/
|
|
559
575
|
export declare const DEFAULT_BODY_LIMIT_BYTES: number;
|
|
560
|
-
/**
|
|
561
|
-
* Default bound on `AppServer.close`'s wait for the effects still in flight
|
|
562
|
-
* (`AppServerOptions.shutdown_drain_timeout_ms`). Twin of the Rust spine's
|
|
563
|
-
* `DEFAULT_DRAIN_TIMEOUT`.
|
|
564
|
-
*/
|
|
565
|
-
export declare const DEFAULT_SHUTDOWN_DRAIN_TIMEOUT_MS = 10000;
|
|
566
576
|
/**
|
|
567
577
|
* Each `AppServerOptions` rate-limiter field, with the defaults an omitted one
|
|
568
578
|
* is built from under `rate_limiters: 'enforced'` and the name its
|
|
@@ -703,41 +713,19 @@ export declare const collect_config_diagnostics: (input: ConfigDiagnosticsInput)
|
|
|
703
713
|
* so far runs, last acquired first (one that throws is logged and the rest
|
|
704
714
|
* still run), and the original error is rethrown: a failed assembly leaves
|
|
705
715
|
* the backend's emitter, closer and notification sender as it found them and
|
|
706
|
-
* no limiter timer running. When `auth_cleanup` is
|
|
716
|
+
* no limiter timer running. When `auth_cleanup` is `{every_ms}`, the
|
|
707
717
|
* auth cleanup schedule starts as the last step of assembly — nothing after
|
|
708
718
|
* it can throw, so an assembly that throws leaves no schedule running.
|
|
709
719
|
*
|
|
710
720
|
* The returned `close` owns shutdown: it stops that schedule, closes every
|
|
711
|
-
* live connection on the backend's closer,
|
|
712
|
-
* closes the database
|
|
721
|
+
* live connection on the backend's closer, waits for the work in flight
|
|
722
|
+
* within its bound, runs the same releases, closes the database, and
|
|
723
|
+
* resolves what the wait gave up on (`AppServer.close`).
|
|
713
724
|
*
|
|
714
725
|
* @returns the assembled Hono app with its surface, bootstrap status, migration results,
|
|
715
726
|
* audit SSE, mounted WS registries, and `close`
|
|
716
727
|
* @throws Error from any assembly step, after releasing what assembly acquired
|
|
717
728
|
*/
|
|
718
729
|
export declare const create_app_server: (options: AppServerOptions) => Promise<AppServer>;
|
|
719
|
-
/**
|
|
720
|
-
* What `drain_effects_on_shutdown` gave up on at its bound, each counted on
|
|
721
|
-
* its own: a request still waiting on its audit writes has those writes
|
|
722
|
-
* counted in `audit_writes` too, so the two are not summed.
|
|
723
|
-
*/
|
|
724
|
-
export interface ShutdownDrainGivenUp {
|
|
725
|
-
/**
|
|
726
|
-
* Requests still held — HTTP requests and WS messages alike, each with its
|
|
727
|
-
* handler or its effect flush still running.
|
|
728
|
-
*/
|
|
729
|
-
requests: number;
|
|
730
|
-
/** Pool writes of the audit emitter still in flight. */
|
|
731
|
-
audit_writes: number;
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* Wait for the requests held (HTTP requests and WS messages, one tracker —
|
|
735
|
-
* each until its handler has returned and its flush settled) and then the
|
|
736
|
-
* audit emitter's pool writes, until none is left or `timeout_ms` passes —
|
|
737
|
-
* then log an error naming what was given up on. Never rejects.
|
|
738
|
-
*
|
|
739
|
-
* @returns what was given up on, both counts `0` when everything settled
|
|
740
|
-
*/
|
|
741
|
-
export declare const drain_effects_on_shutdown: (requests: Pick<RequestTracker, "drain_inflight" | "inflight_count">, audit: Pick<AuditEmitter, "drain_inflight" | "inflight_count">, timeout_ms: number, log: Logger) => Promise<ShutdownDrainGivenUp>;
|
|
742
730
|
export {};
|
|
743
731
|
//# sourceMappingURL=app_server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_server.d.ts","sourceRoot":"","sources":["../../src/lib/server/app_server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"app_server.d.ts","sourceRoot":"","sources":["../../src/lib/server/app_server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,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sB,KAC3B,KAAK,CAAC,oBAAoB,CAgC5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,SAAS,CAQpF,CAAC"}
|
|
@@ -43,6 +43,8 @@ import { register_action_ws } from '../actions/register_action_ws.js';
|
|
|
43
43
|
import { resolve_ws_endpoints } from '../actions/ws_endpoint_spec.js';
|
|
44
44
|
import { create_revocation_guard } from '../actions/connection_closer.js';
|
|
45
45
|
import { start_auth_cleanup } from '../auth/cleanup.js';
|
|
46
|
+
import { PERIODIC_INTERVAL_MS_MAX } from '../periodic.js';
|
|
47
|
+
import { DEFAULT_SHUTDOWN_DRAIN_TIMEOUT_MS, drain_effects_on_shutdown } from './shutdown_drain.js';
|
|
46
48
|
/**
|
|
47
49
|
* Assert that `audit_sse` was wired by `create_app_server` and return it
|
|
48
50
|
* as a non-null `AuditLogSse`. Throws a labelled error when the
|
|
@@ -71,12 +73,6 @@ export const require_audit_sse = (source) => {
|
|
|
71
73
|
* `fuz_http` `DEFAULT_BODY_LIMIT_BYTES`.
|
|
72
74
|
*/
|
|
73
75
|
export const DEFAULT_BODY_LIMIT_BYTES = 1024 * 1024;
|
|
74
|
-
/**
|
|
75
|
-
* Default bound on `AppServer.close`'s wait for the effects still in flight
|
|
76
|
-
* (`AppServerOptions.shutdown_drain_timeout_ms`). Twin of the Rust spine's
|
|
77
|
-
* `DEFAULT_DRAIN_TIMEOUT`.
|
|
78
|
-
*/
|
|
79
|
-
export const DEFAULT_SHUTDOWN_DRAIN_TIMEOUT_MS = 10_000;
|
|
80
76
|
/**
|
|
81
77
|
* Each `AppServerOptions` rate-limiter field, with the defaults an omitted one
|
|
82
78
|
* is built from under `rate_limiters: 'enforced'` and the name its
|
|
@@ -220,13 +216,14 @@ export const collect_config_diagnostics = (input) => {
|
|
|
220
216
|
* so far runs, last acquired first (one that throws is logged and the rest
|
|
221
217
|
* still run), and the original error is rethrown: a failed assembly leaves
|
|
222
218
|
* the backend's emitter, closer and notification sender as it found them and
|
|
223
|
-
* no limiter timer running. When `auth_cleanup` is
|
|
219
|
+
* no limiter timer running. When `auth_cleanup` is `{every_ms}`, the
|
|
224
220
|
* auth cleanup schedule starts as the last step of assembly — nothing after
|
|
225
221
|
* it can throw, so an assembly that throws leaves no schedule running.
|
|
226
222
|
*
|
|
227
223
|
* The returned `close` owns shutdown: it stops that schedule, closes every
|
|
228
|
-
* live connection on the backend's closer,
|
|
229
|
-
* closes the database
|
|
224
|
+
* live connection on the backend's closer, waits for the work in flight
|
|
225
|
+
* within its bound, runs the same releases, closes the database, and
|
|
226
|
+
* resolves what the wait gave up on (`AppServer.close`).
|
|
230
227
|
*
|
|
231
228
|
* @returns the assembled Hono app with its surface, bootstrap status, migration results,
|
|
232
229
|
* audit SSE, mounted WS registries, and `close`
|
|
@@ -243,40 +240,28 @@ export const create_app_server = async (options) => {
|
|
|
243
240
|
}
|
|
244
241
|
};
|
|
245
242
|
/**
|
|
246
|
-
*
|
|
247
|
-
* each until its handler has returned and its flush settled) and then the
|
|
248
|
-
* audit emitter's pool writes, until none is left or `timeout_ms` passes —
|
|
249
|
-
* then log an error naming what was given up on. Never rejects.
|
|
243
|
+
* Read `auth_cleanup`: `null` for `'off'`, else its `every_ms`.
|
|
250
244
|
*
|
|
251
|
-
* @
|
|
245
|
+
* @throws Error unless it is `'off'` or `{every_ms}` with a positive finite
|
|
246
|
+
* number no greater than `PERIODIC_INTERVAL_MS_MAX`
|
|
252
247
|
*/
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
try {
|
|
267
|
-
await Promise.race([drain(), timed_out]);
|
|
268
|
-
}
|
|
269
|
-
finally {
|
|
270
|
-
clearTimeout(timer);
|
|
248
|
+
const parse_auth_cleanup = (auth_cleanup) => {
|
|
249
|
+
if (auth_cleanup === 'off')
|
|
250
|
+
return null;
|
|
251
|
+
const every_ms = typeof auth_cleanup === 'object' &&
|
|
252
|
+
auth_cleanup !== null &&
|
|
253
|
+
Object.hasOwn(auth_cleanup, 'every_ms')
|
|
254
|
+
? auth_cleanup.every_ms
|
|
255
|
+
: undefined;
|
|
256
|
+
if (typeof every_ms === 'number' &&
|
|
257
|
+
Number.isFinite(every_ms) &&
|
|
258
|
+
every_ms > 0 &&
|
|
259
|
+
every_ms <= PERIODIC_INTERVAL_MS_MAX) {
|
|
260
|
+
return every_ms;
|
|
271
261
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
};
|
|
276
|
-
if (given_up.requests === 0 && given_up.audit_writes === 0)
|
|
277
|
-
return given_up;
|
|
278
|
-
log.error(`create_app_server: shutdown gave up after ${timeout_ms}ms on work still running — ${given_up.requests} request(s) (handler or effect flush), ${given_up.audit_writes} audit row write(s)`);
|
|
279
|
-
return given_up;
|
|
262
|
+
throw new Error(`create_app_server: auth_cleanup must be 'off' or {every_ms} with a positive finite number of ms no greater than ${PERIODIC_INTERVAL_MS_MAX}, got ${typeof auth_cleanup === 'object' && auth_cleanup !== null
|
|
263
|
+
? JSON.stringify(auth_cleanup, (_key, value) => typeof value === 'number' && !Number.isFinite(value) ? String(value) : value)
|
|
264
|
+
: String(auth_cleanup)}`);
|
|
280
265
|
};
|
|
281
266
|
/**
|
|
282
267
|
* Run `releases` last-first and empty it. Each runs in its own `try`, so one
|
|
@@ -329,6 +314,11 @@ const assemble_app_server = async (options, releases) => {
|
|
|
329
314
|
if (!(shutdown_drain_timeout_ms > 0 && Number.isFinite(shutdown_drain_timeout_ms))) {
|
|
330
315
|
throw new Error(`create_app_server: shutdown_drain_timeout_ms must be a positive number of ms, got ${shutdown_drain_timeout_ms}`);
|
|
331
316
|
}
|
|
317
|
+
// the schedule starts last, so its interval is refused here, before
|
|
318
|
+
// anything is acquired — as the Rust backend build refuses a zero `Every`
|
|
319
|
+
// first. A caller of the old option shape (`true`, `{interval_ms}`) lands
|
|
320
|
+
// here too, rather than on a schedule it didn't name.
|
|
321
|
+
const auth_cleanup_every_ms = parse_auth_cleanup(options.auth_cleanup);
|
|
332
322
|
// Rate limiters — the ones built here are the server's to dispose, on
|
|
333
323
|
// close or when assembly fails.
|
|
334
324
|
const { mode: rate_limiter_mode, limiters: rate_limiters, built: built_rate_limiters } = resolve_rate_limiters(options);
|
|
@@ -383,9 +373,9 @@ const assemble_app_server = async (options, releases) => {
|
|
|
383
373
|
// The daemon-token keeper, after the migrations and before the bootstrap
|
|
384
374
|
// check, as the Rust spine's boot runs `resolve_keeper_into`: a live
|
|
385
375
|
// bootstrap sets it on a fresh database once it commits, and this covers
|
|
386
|
-
// one already bootstrapped. Best-effort, as there: a failed read
|
|
387
|
-
//
|
|
388
|
-
//
|
|
376
|
+
// one already bootstrapped. Best-effort, as there: a failed read warns
|
|
377
|
+
// (the same message as the Rust twin's) and leaves it unset, and a
|
|
378
|
+
// keeper-less state authenticates no daemon token.
|
|
389
379
|
const daemon_token_state = options.daemon_token_state;
|
|
390
380
|
if (daemon_token_state && daemon_token_state.keeper_account_id === null) {
|
|
391
381
|
try {
|
|
@@ -727,20 +717,19 @@ const assemble_app_server = async (options, releases) => {
|
|
|
727
717
|
// the 404 — read from the app's own router, so every route registered on
|
|
728
718
|
// it counts, one added after assembly included
|
|
729
719
|
app.notFound(create_unmatched_route_handler(app.router));
|
|
730
|
-
// Auth cleanup —
|
|
731
|
-
//
|
|
732
|
-
//
|
|
733
|
-
//
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
: null;
|
|
720
|
+
// Auth cleanup — last: nothing after it can throw, so a failed assembly
|
|
721
|
+
// never leaves a schedule running, and its interval was checked with the
|
|
722
|
+
// other options, so it cannot throw either. Its closes go through
|
|
723
|
+
// `deps.connection_closer`, which the mounts above have filled.
|
|
724
|
+
const auth_cleanup = auth_cleanup_every_ms === null
|
|
725
|
+
? null
|
|
726
|
+
: start_auth_cleanup(deps, { interval_ms: auth_cleanup_every_ms });
|
|
738
727
|
// One shutdown, shared by every call — see `AppServer.close` for the order.
|
|
739
728
|
let closing = null;
|
|
740
729
|
const shutdown = async () => {
|
|
741
|
-
// the schedule first
|
|
742
|
-
|
|
743
|
-
|
|
730
|
+
// the schedule first: no pass starts from here, and the one in progress
|
|
731
|
+
// is waited for in the drain below, under its bound
|
|
732
|
+
const upkeep = auth_cleanup ? [auth_cleanup.stop()] : [];
|
|
744
733
|
// then the connections, so none outlives the server — a failure here
|
|
745
734
|
// must not keep the database open
|
|
746
735
|
try {
|
|
@@ -750,17 +739,20 @@ const assemble_app_server = async (options, releases) => {
|
|
|
750
739
|
log.error('create_app_server: closing live connections on shutdown failed:', error);
|
|
751
740
|
}
|
|
752
741
|
// then the work still in flight, refusing any request that arrives from
|
|
753
|
-
// here, so a handler still running,
|
|
754
|
-
//
|
|
755
|
-
//
|
|
756
|
-
//
|
|
757
|
-
//
|
|
742
|
+
// here, so the cleanup pass, a handler still running, a WS upgrade's
|
|
743
|
+
// admission re-read,
|
|
744
|
+
// and the failure row, token-usage touch or post-commit thunk a request
|
|
745
|
+
// or WS message started, is not cut off by the closing pool — bounded.
|
|
746
|
+
// The Rust spine's drain waits for an HTTP request already dispatched
|
|
747
|
+
// too, but drops a WS message's dispatch still in its handler
|
|
748
|
+
// (`http/CLAUDE.md` §Pending Effects)
|
|
758
749
|
request_tracker.close();
|
|
759
|
-
await drain_effects_on_shutdown(request_tracker, deps.audit, shutdown_drain_timeout_ms, log);
|
|
750
|
+
const given_up = await drain_effects_on_shutdown(request_tracker, deps.audit, upkeep, shutdown_drain_timeout_ms, log);
|
|
760
751
|
// then what assembly acquired — the audit listeners and closer members
|
|
761
752
|
// this server added, and the limiters it built
|
|
762
753
|
run_releases(releases, log, 'shutdown');
|
|
763
754
|
await backend.close();
|
|
755
|
+
return given_up;
|
|
764
756
|
};
|
|
765
757
|
return {
|
|
766
758
|
app,
|