pipework 0.163.0 → 0.165.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 +8 -0
- package/REFERENCE.md +18 -2
- package/dist/core/errors/base.d.ts +1 -0
- package/dist/core/errors/base.d.ts.map +1 -1
- package/dist/core/errors/base.js +15 -0
- package/dist/core/errors/base.js.map +1 -1
- package/dist/infra/quota/handle.d.ts +3 -0
- package/dist/infra/quota/handle.d.ts.map +1 -1
- package/dist/infra/quota/handle.js +11 -7
- package/dist/infra/quota/handle.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.165.0
|
|
4
|
+
|
|
5
|
+
- **Fixed: pipework errors are recognized across physical copies of the same version** (#703). When a workspace and a library it links each resolve their own copy of pipework, `instanceof` on any pipework error class (`QuotaExhaustedError`, `JobLaterError`, `JobPermanentError`, the HTTP error classes) now holds for the same error constructed by the other copy, keyed on the shared `Symbol.for('pipework.error')` brand and the class name in its prototype chain. A job that throws a `QuotaExhaustedError` from the library's copy is handed back to pending until `resetAt` with no attempt counted, instead of failing an attempt. Unbranded look-alikes are not matched.
|
|
6
|
+
|
|
7
|
+
## 0.164.0
|
|
8
|
+
|
|
9
|
+
- **Added: outbound quota from a process outside the manifold** (#701). `quota.create({ reserve, connection: tap(url) })` takes, records and reads the shared budget over a standalone `tap()` connection, with no manifold and no request, job or `flow.run` context, so a plain Node worker spends the same `outbound_quota` budget as the pipework app (which must have migrated the table with blueprint `quota: {}`). A refusal throws `QuotaExhaustedError` (with `resetAt`) to the caller. The caller owns the connection's lifecycle. Passing both `connection` and `database` throws.
|
|
10
|
+
|
|
3
11
|
## 0.163.0
|
|
4
12
|
|
|
5
13
|
- **Added: outbound quota — callers of one rate-limited upstream share its budget by class** (#699). `quota.create({ reserve: { bulk: 500 } })` returns a handle; send each outbound call through `handle.call({ key: 'github:installation:<id>', class: 'bulk' }, () => fetch(...))`. The budget is read from the upstream's own response headers (`x-ratelimit-remaining`, `x-ratelimit-reset`, `x-ratelimit-limit`, `retry-after`; pass `read` for other providers) and kept in the new `outbound_quota` table (opt in with the blueprint's `quota: {}`), so every process sees it. Each call takes one unit before it is sent; a class is refused with `QuotaExhaustedError` (429, carrying `resetAt`) while remaining is at or below its reserve, so `bulk` stops with 500 left for `interactive`, which is refused only at zero. Inside a job a refusal hands the job back to pending until the reset with no attempt counted. Spending is written outside the caller's transaction, so a rollback does not refund it. `record(key, headers)` covers calls sent through another client; `state(key)` reads the budget.
|
package/REFERENCE.md
CHANGED
|
@@ -1461,13 +1461,14 @@ Opt in with blueprint `quota: {}`. The generated migration then includes one tab
|
|
|
1461
1461
|
|
|
1462
1462
|
### `quota.create`
|
|
1463
1463
|
|
|
1464
|
-
`quota.create<C extends string>({ reserve?, read?, database? })` returns a handle typed on the class names.
|
|
1464
|
+
`quota.create<C extends string>({ reserve?, read?, database?, connection? })` returns a handle typed on the class names.
|
|
1465
1465
|
|
|
1466
1466
|
- `reserve` — per class, the remaining count kept for other classes: a call of class `c` is refused while `remaining <= reserve[c]`. Absent classes have reserve 0 (refused only at zero).
|
|
1467
1467
|
- `read(headers)` — returns `{ remaining, resetAt, limit? }` or `null`. The default reads `x-ratelimit-remaining`, `x-ratelimit-reset` (epoch seconds) and optional `x-ratelimit-limit`.
|
|
1468
1468
|
- `database` — default the instance's default database.
|
|
1469
|
+
- `connection` — a `tap()` connection for a process outside the manifold; the caller owns its lifecycle. With it no managed context is needed and `database` is not used; passing both throws at `create`.
|
|
1469
1470
|
|
|
1470
|
-
All reads and writes run on their own autocommitted connection, outside the caller's transaction: a rollback never gives back spent budget, and no row lock is held while the request is in flight.
|
|
1471
|
+
All reads and writes run on their own autocommitted connection, outside the caller's transaction: a rollback never gives back spent budget, and no row lock is held while the request is in flight. Without `connection`, outside a request, job or `flow.run` they throw; with it they run anywhere.
|
|
1471
1472
|
|
|
1472
1473
|
### Methods
|
|
1473
1474
|
|
|
@@ -1492,6 +1493,21 @@ await github.call({ key, class: 'interactive' }, () => octokit.request('POST /re
|
|
|
1492
1493
|
})
|
|
1493
1494
|
```
|
|
1494
1495
|
|
|
1496
|
+
### Example: a worker outside the manifold
|
|
1497
|
+
|
|
1498
|
+
A plain Node service shares the same budget through `tap()`. The `outbound_quota` table must already exist (migrated by the pipework app that opted in with blueprint `quota: {}`). A refusal throws `QuotaExhaustedError` to the caller, since there is no job to hand back.
|
|
1499
|
+
|
|
1500
|
+
```ts
|
|
1501
|
+
const conn = tap(process.env.DATABASE_URL!)
|
|
1502
|
+
const github = quota.create<'interactive' | 'bulk'>({ reserve: { bulk: 500 }, connection: conn })
|
|
1503
|
+
|
|
1504
|
+
await github.call({ key: `github:installation:${installationId}`, class: 'bulk' }, () => octokit.request('GET /repos/{owner}/{repo}/actions/runs', args), {
|
|
1505
|
+
headers: (res) => res.headers,
|
|
1506
|
+
})
|
|
1507
|
+
|
|
1508
|
+
await conn.close() // at shutdown
|
|
1509
|
+
```
|
|
1510
|
+
|
|
1495
1511
|
## credits — Prepaid Usage Credits
|
|
1496
1512
|
|
|
1497
1513
|
Prepaid credits per tenant, like CI minutes: a subscription grants an allocation each period, packs are bought on top, and work draws them down. Every grant has its own expiry; spending draws the soonest-expiring grant first. A job reserves before it starts, settles the actual amount when it ends, and releases on failure. Units are whole numbers (safe integers, bigint in SQL); the app decides what one unit is.
|
|
@@ -3,6 +3,7 @@ export declare abstract class PipeworkError extends Error {
|
|
|
3
3
|
abstract readonly httpStatus: number;
|
|
4
4
|
readonly details: Record<string, unknown>;
|
|
5
5
|
constructor(message: string, details?: Record<string, unknown>);
|
|
6
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* True for any PipeworkError, including one thrown across a module-realm boundary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/core/errors/base.ts"],"names":[],"mappings":"AASA,8BAAsB,aAAc,SAAQ,KAAK;IAC/C,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;gBAE7B,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/core/errors/base.ts"],"names":[],"mappings":"AASA,8BAAsB,aAAc,SAAQ,KAAK;IAC/C,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;gBAE7B,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;WASlD,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;CAS9D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAQtE"}
|
package/dist/core/errors/base.js
CHANGED
|
@@ -14,6 +14,21 @@ export class PipeworkError extends Error {
|
|
|
14
14
|
this.details = details;
|
|
15
15
|
Object.defineProperty(this, PIPEWORK_ERROR, { value: true, enumerable: false });
|
|
16
16
|
}
|
|
17
|
+
// The brand is the identity across physical copies of pipework: a branded error is an
|
|
18
|
+
// instance of the class its prototype chain names, whichever copy constructed it.
|
|
19
|
+
static [Symbol.hasInstance](value) {
|
|
20
|
+
if (Function.prototype[Symbol.hasInstance].call(this, value))
|
|
21
|
+
return true;
|
|
22
|
+
if (!isPipeworkError(value))
|
|
23
|
+
return false;
|
|
24
|
+
if (this === PipeworkError)
|
|
25
|
+
return true;
|
|
26
|
+
for (let proto = Object.getPrototypeOf(value); proto !== null; proto = Object.getPrototypeOf(proto)) {
|
|
27
|
+
if (proto.constructor?.name === this.name)
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
17
32
|
}
|
|
18
33
|
/**
|
|
19
34
|
* True for any PipeworkError, including one thrown across a module-realm boundary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/core/errors/base.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,sFAAsF;AACtF,mFAAmF;AACnF,qFAAqF;AACrF,+DAA+D;AAC/D,sGAAsG;AACtG,+FAA+F;AAC/F,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;AAEnD,MAAM,OAAgB,aAAc,SAAQ,KAAK;IAGtC,OAAO,CAAyB;IAEzC,YAAY,OAAe,EAAE,UAAmC,EAAE;QAChE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAA;IACjF,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAiC,CAAC,cAAc,CAAC,KAAK,IAAI;QAC3D,OAAQ,KAAkC,CAAC,UAAU,KAAK,QAAQ;QAClE,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ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AA;QAClG,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAiC,CAAC,cAAc,CAAC,KAAK,IAAI;QAC3D,OAAQ,KAAkC,CAAC,UAAU,KAAK,QAAQ;QAClE,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ,CACvD,CAAA;AACH,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ManagedConnection } from '../../data/db/pool.js';
|
|
1
2
|
/** Anything with a case-insensitive `get` — a fetch `Headers` satisfies it. */
|
|
2
3
|
export type QuotaHeaders = {
|
|
3
4
|
get(name: string): string | null;
|
|
@@ -15,6 +16,8 @@ export interface QuotaConfig<C extends string> {
|
|
|
15
16
|
readonly read?: (headers: QuotaHeaders) => QuotaBudget | null;
|
|
16
17
|
/** Database name; default the instance's default database. */
|
|
17
18
|
readonly database?: string;
|
|
19
|
+
/** A standalone connection (from `tap()`) for a process outside the manifold; the caller owns its lifecycle. With it, no managed context is needed and `database` is not used. */
|
|
20
|
+
readonly connection?: ManagedConnection;
|
|
18
21
|
}
|
|
19
22
|
export interface QuotaState {
|
|
20
23
|
readonly remaining: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../../../src/infra/quota/handle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../../../src/infra/quota/handle.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAG9D,+EAA+E;AAC/E,MAAM,MAAM,YAAY,GAAG;IAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;CAAE,CAAA;AAC/D,MAAM,MAAM,gBA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C,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IAC1G,sFAAsF;IACtF,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7D,6EAA6E;IAC7E,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAA;CAC/C;AAoDD,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,GAAE,WAAW,CAAC,CAAC,CAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAmGnF"}
|
|
@@ -50,17 +50,21 @@ function logRecordFailure(key, err) {
|
|
|
50
50
|
getBaseLogger().error({ err, key }, 'quota could not record the budget from a response');
|
|
51
51
|
}
|
|
52
52
|
export function createQuota(config = {}) {
|
|
53
|
+
if (config.connection !== undefined && config.database !== undefined) {
|
|
54
|
+
throw new Error('[pipework] quota.create takes connection or database, not both.');
|
|
55
|
+
}
|
|
53
56
|
const read = config.read ?? defaultRead;
|
|
57
|
+
const db = () => config.connection !== undefined ? config.connection.drizzle : resolveDb(config.database);
|
|
54
58
|
async function record(key, input) {
|
|
55
59
|
const headers = toHeaders(input);
|
|
56
60
|
const budget = read(headers);
|
|
57
61
|
const retryAfter = intHeader(headers, 'retry-after');
|
|
58
62
|
if (budget === null && retryAfter === null)
|
|
59
63
|
return;
|
|
60
|
-
const
|
|
64
|
+
const conn = db();
|
|
61
65
|
if (budget !== null) {
|
|
62
66
|
const limit = budget.limit ?? null;
|
|
63
|
-
await
|
|
67
|
+
await conn.execute(sql `
|
|
64
68
|
INSERT INTO outbound_quota (key, remaining, "limit", reset_at, updated_at)
|
|
65
69
|
VALUES (${key}, ${budget.remaining}, ${limit}, ${iso(budget.resetAt)}::timestamptz, now())
|
|
66
70
|
ON CONFLICT (key) DO UPDATE SET
|
|
@@ -78,7 +82,7 @@ export function createQuota(config = {}) {
|
|
|
78
82
|
updated_at = now()`);
|
|
79
83
|
}
|
|
80
84
|
if (retryAfter !== null) {
|
|
81
|
-
await
|
|
85
|
+
await conn.execute(sql `
|
|
82
86
|
INSERT INTO outbound_quota (key, remaining, "limit", reset_at, updated_at)
|
|
83
87
|
VALUES (${key}, 0, NULL, now() + make_interval(secs => ${Math.max(0, retryAfter)}), now())
|
|
84
88
|
ON CONFLICT (key) DO UPDATE SET
|
|
@@ -88,7 +92,7 @@ export function createQuota(config = {}) {
|
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
async function state(key) {
|
|
91
|
-
const rows = await
|
|
95
|
+
const rows = await db().execute(sql `
|
|
92
96
|
SELECT remaining, "limit", reset_at FROM outbound_quota WHERE key = ${key} AND reset_at > now()`);
|
|
93
97
|
const row = rows[0];
|
|
94
98
|
if (row === undefined)
|
|
@@ -100,15 +104,15 @@ export function createQuota(config = {}) {
|
|
|
100
104
|
};
|
|
101
105
|
}
|
|
102
106
|
async function take(key, cls) {
|
|
103
|
-
const
|
|
107
|
+
const conn = db();
|
|
104
108
|
const reserve = config.reserve?.[cls] ?? 0;
|
|
105
|
-
const taken = await
|
|
109
|
+
const taken = await conn.execute(sql `
|
|
106
110
|
UPDATE outbound_quota SET remaining = remaining - 1, updated_at = now()
|
|
107
111
|
WHERE key = ${key} AND reset_at > now() AND remaining > ${reserve}
|
|
108
112
|
RETURNING remaining`);
|
|
109
113
|
if (taken.length > 0)
|
|
110
114
|
return;
|
|
111
|
-
const rows = await
|
|
115
|
+
const rows = await conn.execute(sql `
|
|
112
116
|
SELECT remaining, reset_at FROM outbound_quota WHERE key = ${key} AND reset_at > now()`);
|
|
113
117
|
const row = rows[0];
|
|
114
118
|
if (row === undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle.js","sourceRoot":"","sources":["../../../src/infra/quota/handle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA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