pipework 0.119.0 → 0.120.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.120.0
4
+
5
+ - **Added: `surface.http({ onInternalError })`** (#609). An HTTP surface now takes the same `onInternalError` hook as `ServerConfig` (#584), so `alerts.requestFaults(handle)` works for surface-built apps, `pipework serve` included. It runs for each internal 5xx under `surface.start` and `.test()` alike; before, the surface dropped it.
6
+
3
7
  ## 0.119.0
4
8
 
5
9
  - **Fixed: a test-harness savepoint could reset a tenant it did not set** (#605). On release, a `pipe.transaction` savepoint under the vitest harness put back every setting that differed from its start, including one sent on the shared test connection by another task while it was open. So a `withFlow({ tenant })` that ran while an earlier task held a savepoint lost `pipework.tenant_id` (read as `''`, refusing RLS writes) when that savepoint released. A release now puts back only the settings and role changed by statements sent from inside its own block. Test-only; requests and jobs were not affected.
package/REFERENCE.md CHANGED
@@ -678,6 +678,8 @@ Surface namespace — declarative entry points that define how the app runs (HTT
678
678
 
679
679
  Creates an HTTP surface — a Fastify server with routes, middleware, and production validation. Returns an HttpSurfaceBuilder with a .test() method for inject()-based integration tests.
680
680
 
681
+ It accepts `onInternalError` (and so `alerts.requestFaults(...)`) as `ServerConfig` does; it runs for each internal 5xx under `.test()` and `start` alike.
682
+
681
683
  ### `surface.worker`
682
684
 
683
685
  Creates a worker surface — a long-running process that claims and executes jobs from queues.
@@ -1517,7 +1519,7 @@ Pass in `sources`; each raises with a fixed key on a tick and, where it can tell
1517
1519
 
1518
1520
  `table` is the jobs table, default `pipework_jobs`. A custom source is `{ name, evaluate(): Promise<{ key, severity, message, subject? }[]>, owns?(key) }`; with `owns`, an open alert it owns that `evaluate` no longer returns is resolved.
1519
1521
 
1520
- `alerts.requestFaults(handle, { owner?, runbook?, severity? = 'error' })` returns a hook for the HTTP server's `onInternalError`: each internal 5xx raises `request-fault:<METHOD> <route pattern>` with message `<METHOD> <route>: <error message>`, context `{ method, route, requestId, traceId, message }` and the request's tenant as subject; repeats on one route group into one alert. Pass it as `createServer(m, { onInternalError: alerts.requestFaults(ops, { owner: 'platform' }) })`.
1522
+ `alerts.requestFaults(handle, { owner?, runbook?, severity? = 'error' })` returns a hook for the HTTP server's `onInternalError`: each internal 5xx raises `request-fault:<METHOD> <route pattern>` with message `<METHOD> <route>: <error message>`, context `{ method, route, requestId, traceId, message }` and the request's tenant as subject; repeats on one route group into one alert. Pass it as `createServer(m, { onInternalError: alerts.requestFaults(ops, { owner: 'platform' }) })` or `surface.http({ onInternalError: ... })`.
1521
1523
 
1522
1524
  ```ts
1523
1525
  const sink = alerts.webhook({ url: process.env.OPS_HOOK!, secret: process.env.OPS_SECRET! })