@poppykit/client 0.6.0 → 0.6.1
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 +7 -0
- package/STORAGE.md +6 -0
- package/dist/postgres-runtime.js +12 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Local migration block2 adds Operations v2 codecs, negotiated API/MCP/conversation mechanics and durable trusted-consent attempt storage/recovery. See [OPERATIONS.md](OPERATIONS.md). This is a local SDK checkpoint, not full CLI integration or package publication.
|
|
4
4
|
|
|
5
|
+
## 0.6.1 — 2026-11-01
|
|
6
|
+
|
|
7
|
+
Handle PostgreSQL socket loss while an SDK transaction or migration owns a
|
|
8
|
+
checked-out connection. Invalidate failed transaction handles, discard broken
|
|
9
|
+
connections, and preserve the original migration error when rollback also fails.
|
|
10
|
+
A failed COMMIT still requires durable-state reconciliation before retry.
|
|
11
|
+
|
|
5
12
|
## 0.6.0 — current-spec core migration
|
|
6
13
|
|
|
7
14
|
Separate delegated resource Sessions from OAuth account grants; discover issuers and
|
package/STORAGE.md
CHANGED
|
@@ -190,3 +190,9 @@ span model/network I/O. See the [provider example](PROVIDER.md).
|
|
|
190
190
|
## Business operation persistence
|
|
191
191
|
|
|
192
192
|
[Operations storage contracts](OPERATIONS.md#persistence-and-migration) are separate from authentication lifecycle operations and message receipts. BusinessAttemptStore uses a synchronous transaction callback and an ascending nonterminal `pending` selector. SQLite adds a separate business_attempts table; PostgreSQL uses a separate record kind. No existing SQL history, credentials or uncertain work is deleted. Unknown versions fail closed. External effects require a durable downstream idempotency/reconciliation contract. Never prune or release an uncertain business claim after a worker deadline.
|
|
193
|
+
|
|
194
|
+
Postgres adapters handle socket errors while they own a checked-out connection.
|
|
195
|
+
Connection loss invalidates the transaction, rejects the operation and discards
|
|
196
|
+
the broken connection. A successful retry must reconcile durable state first;
|
|
197
|
+
a lost COMMIT response does not prove rollback. Callers still own their pool and
|
|
198
|
+
its idle `error` handler, and host-enlisted connection lifetimes.
|
package/dist/postgres-runtime.js
CHANGED
|
@@ -35,6 +35,9 @@ export async function postgresMigration(schema) {
|
|
|
35
35
|
export async function migratePostgres(pool, schema) {
|
|
36
36
|
schemaName(schema);
|
|
37
37
|
const client = await pool.connect();
|
|
38
|
+
let connectionError;
|
|
39
|
+
const onError = (error) => { connectionError = error; };
|
|
40
|
+
client.on('error', onError);
|
|
38
41
|
try {
|
|
39
42
|
await client.query('BEGIN');
|
|
40
43
|
await client.query("SET LOCAL statement_timeout='5s'");
|
|
@@ -50,11 +53,12 @@ export async function migratePostgres(pool, schema) {
|
|
|
50
53
|
await client.query('COMMIT');
|
|
51
54
|
}
|
|
52
55
|
catch (error) {
|
|
53
|
-
await client.query('ROLLBACK');
|
|
56
|
+
await client.query('ROLLBACK').catch((failure) => { connectionError = failure; });
|
|
54
57
|
throw error;
|
|
55
58
|
}
|
|
56
59
|
finally {
|
|
57
|
-
client.release();
|
|
60
|
+
client.release(connectionError);
|
|
61
|
+
client.removeListener('error', onError);
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
function scopeActive(context) {
|
|
@@ -144,6 +148,9 @@ export class PostgresRuntime {
|
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
const client = await this.pool.connect(), context = { client, active: true, locks: new Set(), state: { serial: 0, active: true }, childActive: false };
|
|
151
|
+
let connectionError;
|
|
152
|
+
const onError = (error) => { connectionError = error; context.state.active = false; };
|
|
153
|
+
client.on('error', onError);
|
|
147
154
|
try {
|
|
148
155
|
await client.query('BEGIN');
|
|
149
156
|
await client.query("SET LOCAL statement_timeout='5s'");
|
|
@@ -161,13 +168,14 @@ export class PostgresRuntime {
|
|
|
161
168
|
}
|
|
162
169
|
catch (error) {
|
|
163
170
|
context.state.active = false;
|
|
164
|
-
await client.query('ROLLBACK').catch(() => { });
|
|
171
|
+
await client.query('ROLLBACK').catch((failure) => { connectionError = failure; });
|
|
165
172
|
throw error;
|
|
166
173
|
}
|
|
167
174
|
finally {
|
|
168
175
|
context.active = false;
|
|
169
176
|
context.state.active = false;
|
|
170
|
-
client.release();
|
|
177
|
+
client.release(connectionError);
|
|
178
|
+
client.removeListener('error', onError);
|
|
171
179
|
}
|
|
172
180
|
}
|
|
173
181
|
connection() {
|