Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .agents/skills/work-with-subscriptions/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Use this when working in `helios-subscriptions`, the FHIR topic-based Subscripti
- The messaging channel is separately gated by `HFS_SUBSCRIPTION_MESSAGING_ENABLED`.
- Endpoint safety (`channels/egress.rs`, rest-hook and messaging): endpoints that are, or resolve to, private/loopback addresses are refused unless `HFS_SUBSCRIPTION_ALLOW_PRIVATE_ENDPOINTS=true`, and redirects are never followed (a `3xx` is a permanent error). Tests that deliver to a loopback receiver set `SubscriptionConfig::allow_private_endpoints`.
- Notification bundles follow the topic-based subscription spec; delivery failures retry with backoff (`engine/retry.rs`).
- WebSocket subscriptions use binding tokens (`ws_token`) managed per connection (`ws_manager`). A connection must bind within 10 s; a bound client has a 256-notification queue and 30 s to accept each frame, and is dropped when it stops draining. A subscription takes at most 16 bound clients (`1008 too-many-clients` past it) and 16 outstanding binding tokens (`429`); a notification is serialized once and its bytes shared by every client queue (#2721).
- WebSocket subscriptions use binding tokens (`ws_token`) managed per connection (`ws_manager`). A connection must bind within 10 s; a bound client has a 256-notification queue, 30 s to accept each frame and 2 min from queueing to take each notification, and is closed (`1008 client-too-slow`) when it stops draining or stays behind; all four limits are `HFS_SUBSCRIPTION_WS_*` variables. Every close frame is sent within 5 s or given up on. A subscription takes at most 16 bound clients (`1008 too-many-clients` past it) and 16 outstanding binding tokens (`429`); a notification is serialized once and its bytes shared by every client queue (#2721).

## Channels (`crates/subscriptions/src/channels/`)

Expand All @@ -33,6 +33,11 @@ Use this when working in `helios-subscriptions`, the FHIR topic-based Subscripti
| `HFS_SUBSCRIPTION_PERSIST_STATUS` | Write server-driven status transitions back into the stored `Subscription` (default `true`) |
| `HFS_SUBSCRIPTION_STATUS_WRITE_TIMEOUT_MS` | Per-write timeout for that write-back (default `5000`) |
| `HFS_SUBSCRIPTION_EVENT_HISTORY_SIZE` | Events remembered per subscription for `$events` (default `100`, `0` disables; in memory only, empty after a restart) |
| `HFS_SUBSCRIPTION_WS_MAX_UNBOUND_CONNECTIONS` | WebSocket connections that may be waiting to bind at once (default `256`); further upgrades get `503` with `Retry-After` |
| `HFS_SUBSCRIPTION_WS_BIND_TIMEOUT_MS` | How long a WebSocket connection may take to bind (default `10000`) |
| `HFS_SUBSCRIPTION_WS_SEND_TIMEOUT_MS` | How long a bound WebSocket client may take to accept one frame (default `30000`) |
| `HFS_SUBSCRIPTION_WS_DELIVERY_TIMEOUT_MS` | How long after it was queued a notification may still be undelivered to a bound WebSocket client (default `120000`) |
| `HFS_SUBSCRIPTION_WS_CLIENT_QUEUE_CAPACITY` | Notifications a bound WebSocket client may have waiting (default `256`) |
| `HFS_SUBSCRIPTION_REHYDRATE` | Replay stored topics/subscriptions into the engine at startup (default `true`) |
| `HFS_SUBSCRIPTION_REHYDRATE_HANDSHAKE` | Re-run activation for stored `requested`/`error` subscriptions (default `true`) |
| `HFS_SUBSCRIPTION_REHYDRATE_HANDSHAKE_CONCURRENCY` | Cap on concurrent startup handshakes (default `8`) |
Expand Down
7 changes: 6 additions & 1 deletion .claude/skills/work-with-subscriptions/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Use this when working in `helios-subscriptions`, the FHIR topic-based Subscripti
- The messaging channel is separately gated by `HFS_SUBSCRIPTION_MESSAGING_ENABLED`.
- Endpoint safety (`channels/egress.rs`, rest-hook and messaging): endpoints that are, or resolve to, private/loopback addresses are refused unless `HFS_SUBSCRIPTION_ALLOW_PRIVATE_ENDPOINTS=true`, and redirects are never followed (a `3xx` is a permanent error). Tests that deliver to a loopback receiver set `SubscriptionConfig::allow_private_endpoints`.
- Notification bundles follow the topic-based subscription spec; delivery failures retry with backoff (`engine/retry.rs`).
- WebSocket subscriptions use binding tokens (`ws_token`) managed per connection (`ws_manager`). A connection must bind within 10 s; a bound client has a 256-notification queue and 30 s to accept each frame, and is dropped when it stops draining. A subscription takes at most 16 bound clients (`1008 too-many-clients` past it) and 16 outstanding binding tokens (`429`); a notification is serialized once and its bytes shared by every client queue (#2721).
- WebSocket subscriptions use binding tokens (`ws_token`) managed per connection (`ws_manager`). A connection must bind within 10 s; a bound client has a 256-notification queue, 30 s to accept each frame and 2 min from queueing to take each notification, and is closed (`1008 client-too-slow`) when it stops draining or stays behind; all four limits are `HFS_SUBSCRIPTION_WS_*` variables. Every close frame is sent within 5 s or given up on. A subscription takes at most 16 bound clients (`1008 too-many-clients` past it) and 16 outstanding binding tokens (`429`); a notification is serialized once and its bytes shared by every client queue (#2721).

## Channels (`crates/subscriptions/src/channels/`)

Expand All @@ -33,6 +33,11 @@ Use this when working in `helios-subscriptions`, the FHIR topic-based Subscripti
| `HFS_SUBSCRIPTION_PERSIST_STATUS` | Write server-driven status transitions back into the stored `Subscription` (default `true`) |
| `HFS_SUBSCRIPTION_STATUS_WRITE_TIMEOUT_MS` | Per-write timeout for that write-back (default `5000`) |
| `HFS_SUBSCRIPTION_EVENT_HISTORY_SIZE` | Events remembered per subscription for `$events` (default `100`, `0` disables; in memory only, empty after a restart) |
| `HFS_SUBSCRIPTION_WS_MAX_UNBOUND_CONNECTIONS` | WebSocket connections that may be waiting to bind at once (default `256`); further upgrades get `503` with `Retry-After` |
| `HFS_SUBSCRIPTION_WS_BIND_TIMEOUT_MS` | How long a WebSocket connection may take to bind (default `10000`) |
| `HFS_SUBSCRIPTION_WS_SEND_TIMEOUT_MS` | How long a bound WebSocket client may take to accept one frame (default `30000`) |
| `HFS_SUBSCRIPTION_WS_DELIVERY_TIMEOUT_MS` | How long after it was queued a notification may still be undelivered to a bound WebSocket client (default `120000`) |
| `HFS_SUBSCRIPTION_WS_CLIENT_QUEUE_CAPACITY` | Notifications a bound WebSocket client may have waiting (default `256`) |
| `HFS_SUBSCRIPTION_REHYDRATE` | Replay stored topics/subscriptions into the engine at startup (default `true`) |
| `HFS_SUBSCRIPTION_REHYDRATE_HANDSHAKE` | Re-run activation for stored `requested`/`error` subscriptions (default `true`) |
| `HFS_SUBSCRIPTION_REHYDRATE_HANDSHAKE_CONCURRENCY` | Cap on concurrent startup handshakes (default `8`) |
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ JWT/bearer auth (`HFS_AUTH_*`, e.g. `HFS_AUTH_ENABLED`, `HFS_AUTH_JWKS_URL`, `HF
| `HFS_SUBSCRIPTION_REHYDRATE` | `true` | Reload stored `Subscription`/`SubscriptionTopic` resources into the engine at startup, so subscriptions keep delivering across a restart |
| `HFS_SUBSCRIPTION_REHYDRATE_HANDSHAKE` | `true` | Re-run the activation handshake for stored `requested` subscriptions during rehydration |
| `HFS_SUBSCRIPTION_EVENT_HISTORY_SIZE` | `100` | Events remembered per subscription for `GET Subscription/{id}/$events` (in memory, lost on restart); `0` disables the history |
| `HFS_SUBSCRIPTION_WS_MAX_UNBOUND_CONNECTIONS` | `256` | WebSocket connections that may be waiting to send their bind message at once; an upgrade past the limit is refused with `503` and `Retry-After` |
| `HFS_SUBSCRIPTION_WS_BIND_TIMEOUT_MS` | `10000` | How long a WebSocket connection may take to send its bind message (`1008 bind-timeout` past it) |
| `HFS_SUBSCRIPTION_WS_SEND_TIMEOUT_MS` | `30000` | How long a bound WebSocket client may take to accept one frame, whatever its size (`1008 client-too-slow` past it); raise it for large `full-resource` notifications over slow links |
| `HFS_SUBSCRIPTION_WS_DELIVERY_TIMEOUT_MS` | `120000` | How long after it was queued a notification may still be undelivered to a bound WebSocket client (`1008 client-too-slow` past it), however few are waiting; also bounds the send of one frame, so keep it above the send timeout |
| `HFS_SUBSCRIPTION_WS_CLIENT_QUEUE_CAPACITY` | `256` | Notifications a bound WebSocket client may have waiting; a client whose queue overflows is closed (`1008 client-too-slow`) |
| `HFS_BULK_EXPORT_ENABLED` | `true` | Enable the [Bulk Data Export](crates/rest/README.md#bulk-data-export) `$export` operation; when `false`, all `$export` endpoints return `501` |
| `HFS_BULK_EXPORT_OUTPUT_BACKEND` | `local-fs` | Bulk export output store: `local-fs` or `s3`. See the [rest crate README](crates/rest/README.md#bulk-data-export) for the full `HFS_BULK_EXPORT_*` table |
| `HFS_BULK_SUBMIT_ENABLED` | `true` | Enable the [Bulk Data Submit](crates/rest/README.md#bulk-data-submit) `$bulk-submit` operation (HFS as Data Consumer — fetches a provider manifest and ingests it); when `false`, all `$bulk-submit` endpoints return `501`. Available on `sqlite`, `postgres` and `mongodb` (+ `-elasticsearch` composites) |
Expand Down
5 changes: 5 additions & 0 deletions crates/hfs/src/env_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ const KNOWN: &[&str] = &[
"HFS_SUBSCRIPTION_SMTP_TIMEOUT_SECS",
"HFS_SUBSCRIPTION_SMTP_USERNAME",
"HFS_SUBSCRIPTION_STATUS_WRITE_TIMEOUT_MS",
"HFS_SUBSCRIPTION_WS_BIND_TIMEOUT_MS",
"HFS_SUBSCRIPTION_WS_CLIENT_QUEUE_CAPACITY",
"HFS_SUBSCRIPTION_WS_DELIVERY_TIMEOUT_MS",
"HFS_SUBSCRIPTION_WS_MAX_UNBOUND_CONNECTIONS",
"HFS_SUBSCRIPTION_WS_SEND_TIMEOUT_MS",
"HFS_TENANT_REQUIRE_PROVISIONED",
"HFS_TENANT_ROUTING_MODE",
"HFS_TENANT_STRICT_VALIDATION",
Expand Down
Loading
Loading