@proteinjs/db 1.32.2 → 1.32.3

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
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.32.3](https://github.com/proteinjs/db/compare/@proteinjs/db@1.32.2...@proteinjs/db@1.32.3) (2026-08-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * reconcile re-read rides out brief INFORMATION_SCHEMA propagation (bounded retry) ([0f4739b](https://github.com/proteinjs/db/commit/0f4739bb2f233d9dff462cf7ec74777f53ea0de6))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [1.32.2](https://github.com/proteinjs/db/compare/@proteinjs/db@1.32.1...@proteinjs/db@1.32.2) (2026-08-15)
7
18
 
8
19
 
@@ -6,6 +6,14 @@ export interface ColumnTypeFactory {
6
6
  getType(column: Column<any, any>): string;
7
7
  }
8
8
  export declare class TableManager {
9
+ /**
10
+ * Bounded verification re-reads for {@link reconcileConcurrentSchemaChange}: an already-exists
11
+ * DDL error proves the conflicting schema change COMMITTED, but INFORMATION_SCHEMA on this
12
+ * connection can briefly lag that commit — 5 × 200ms rides out the propagation without letting
13
+ * a genuine conflict stall for more than ~1s.
14
+ */
15
+ private static readonly RECONCILE_VERIFY_ATTEMPTS;
16
+ private static readonly RECONCILE_VERIFY_RETRY_DELAY_MS;
9
17
  private logger;
10
18
  columnTypeFactory: ColumnTypeFactory;
11
19
  schemaOperations: SchemaOperations;
@@ -44,7 +52,9 @@ export declare class TableManager {
44
52
  * getTableChanges uses) must confirm every table now exists AND has no remaining changes of
45
53
  * the kind we attempted. A concurrent actor applying our EXACT change satisfies this; a
46
54
  * genuine conflict (e.g. the column landed with a different type, so a column-type change is
47
- * still outstanding) does not.
55
+ * still outstanding) does not. The re-read is resilient to brief schema propagation — see
56
+ * {@link verifyIntendedDefinition} for the bounded retry that prevents a momentarily-stale
57
+ * INFORMATION_SCHEMA read from false-negativing into the very crash this closes.
48
58
  * If either gate fails, the ORIGINAL error propagates unchanged. Because every actor runs this
49
59
  * same reconcile, it closes all three windows: migration-Job-vs-pod, pod-vs-pod, and
50
60
  * multi-replica boot.
@@ -55,9 +65,23 @@ export declare class TableManager {
55
65
  * absent, re-throwing) — so an unexpected activation is visible in prod logs rather than silent.
56
66
  */
57
67
  private reconcileConcurrentSchemaChange;
68
+ /**
69
+ * Re-read the live schema until `table` is present with the intended definition, retrying a
70
+ * BOUNDED number of times ({@link RECONCILE_VERIFY_ATTEMPTS} × {@link RECONCILE_VERIFY_RETRY_DELAY_MS}).
71
+ *
72
+ * The already-exists error means the conflicting DDL has COMMITTED — the object exists — but
73
+ * INFORMATION_SCHEMA on this connection can briefly lag that commit, and a single point-in-time
74
+ * read that misses it would false-negative into a re-throw, reintroducing the exact boot crash
75
+ * this reconcile closes. So the re-read's job is (a) to wait out momentary invisibility and
76
+ * (b) to verify the DEFINITION matches intent. A momentary stale read resolves via retry into
77
+ * success; only a definition still absent or mismatched after every attempt is a genuine
78
+ * conflict — logged at WARN, then the ORIGINAL error re-throws.
79
+ */
80
+ private verifyIntendedDefinition;
58
81
  /** Concise, loggable reason from a schema-update error: the backend names the offending object
59
82
  * in `details` (validation phase) or `message` (apply phase). */
60
83
  private schemaErrorReason;
84
+ private delay;
61
85
  private validateDynamicReferenceColumns;
62
86
  private shouldAlterTable;
63
87
  private getTableChanges;
@@ -1 +1 @@
1
- {"version":3,"file":"TableManager.d.ts","sourceRoot":"","sources":["../../../src/schema/TableManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAa,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MA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AED,qBAAa,YAAY;IACvB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAK;IACtD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,+BAA+B,CAAO;IAC9D,OAAO,CAAC,MAAM,CAA2F;IAClG,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,cAAc,EAAE,cAAc,CAAC;gBAGpC,QAAQ,EAAE,QAAQ,EAClB,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,CAAC,EAAE,cAAc;IAO3B,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC;IAInC;;;;;;OAMG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B3B,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;YAgBnC,mBAAmB;IAajC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;YACW,+BAA+B;IAiB7C;;;;;;;;;;;OAWG;YACW,wBAAwB;IAyCtC;sEACkE;IAClE,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,+BAA+B;IAwDvC,OAAO,CAAC,gBAAgB;YAgBV,eAAe;YA6Ff,kBAAkB;CA8CjC"}
@@ -221,7 +221,9 @@ var TableManager = /** @class */ (function () {
221
221
  * getTableChanges uses) must confirm every table now exists AND has no remaining changes of
222
222
  * the kind we attempted. A concurrent actor applying our EXACT change satisfies this; a
223
223
  * genuine conflict (e.g. the column landed with a different type, so a column-type change is
224
- * still outstanding) does not.
224
+ * still outstanding) does not. The re-read is resilient to brief schema propagation — see
225
+ * {@link verifyIntendedDefinition} for the bounded retry that prevents a momentarily-stale
226
+ * INFORMATION_SCHEMA read from false-negativing into the very crash this closes.
225
227
  * If either gate fails, the ORIGINAL error propagates unchanged. Because every actor runs this
226
228
  * same reconcile, it closes all three windows: migration-Job-vs-pod, pod-vs-pod, and
227
229
  * multi-replica boot.
@@ -234,7 +236,7 @@ var TableManager = /** @class */ (function () {
234
236
  TableManager.prototype.reconcileConcurrentSchemaChange = function (tables, error) {
235
237
  var _a, _b;
236
238
  return __awaiter(this, void 0, void 0, function () {
237
- var tableNames, reason, _i, tables_2, table, remainingChanges;
239
+ var tableNames, reason, _i, tables_2, table;
238
240
  return __generator(this, function (_c) {
239
241
  switch (_c.label) {
240
242
  case 0:
@@ -246,39 +248,83 @@ var TableManager = /** @class */ (function () {
246
248
  _i = 0, tables_2 = tables;
247
249
  _c.label = 1;
248
250
  case 1:
249
- if (!(_i < tables_2.length)) return [3 /*break*/, 5];
251
+ if (!(_i < tables_2.length)) return [3 /*break*/, 4];
250
252
  table = tables_2[_i];
251
- return [4 /*yield*/, this.tableExists(table)];
253
+ return [4 /*yield*/, this.verifyIntendedDefinition(table, tableNames, reason, error)];
252
254
  case 2:
253
- // A create that failed already-exists yet leaves the table absent is not the
254
- // concurrent-winner case — surface the original error rather than masking it.
255
- if (!(_c.sent())) {
256
- this.logger.warn({
257
- message: "[schema reconcile] caught ALREADY_EXISTS for table(s) '".concat(tableNames, "' but '").concat(table.name, "' is still absent on re-read \u2014 NOT a concurrent apply; re-throwing. reason: ").concat(reason),
258
- });
259
- throw error;
255
+ _c.sent();
256
+ _c.label = 3;
257
+ case 3:
258
+ _i++;
259
+ return [3 /*break*/, 1];
260
+ case 4:
261
+ this.logger.warn({
262
+ message: "[schema reconcile] tolerated concurrent ALREADY_EXISTS for table(s) '".concat(tableNames, "' \u2014 re-read verified the object present with the intended definition, treating as applied (a concurrent actor won the race). reason: ").concat(reason),
263
+ });
264
+ return [2 /*return*/];
265
+ }
266
+ });
267
+ });
268
+ };
269
+ /**
270
+ * Re-read the live schema until `table` is present with the intended definition, retrying a
271
+ * BOUNDED number of times ({@link RECONCILE_VERIFY_ATTEMPTS} × {@link RECONCILE_VERIFY_RETRY_DELAY_MS}).
272
+ *
273
+ * The already-exists error means the conflicting DDL has COMMITTED — the object exists — but
274
+ * INFORMATION_SCHEMA on this connection can briefly lag that commit, and a single point-in-time
275
+ * read that misses it would false-negative into a re-throw, reintroducing the exact boot crash
276
+ * this reconcile closes. So the re-read's job is (a) to wait out momentary invisibility and
277
+ * (b) to verify the DEFINITION matches intent. A momentary stale read resolves via retry into
278
+ * success; only a definition still absent or mismatched after every attempt is a genuine
279
+ * conflict — logged at WARN, then the ORIGINAL error re-throws.
280
+ */
281
+ TableManager.prototype.verifyIntendedDefinition = function (table, tableNames, reason, error) {
282
+ return __awaiter(this, void 0, void 0, function () {
283
+ var remainingChanges, attempt;
284
+ return __generator(this, function (_a) {
285
+ switch (_a.label) {
286
+ case 0:
287
+ attempt = 1;
288
+ _a.label = 1;
289
+ case 1:
290
+ if (!(attempt <= TableManager.RECONCILE_VERIFY_ATTEMPTS)) return [3 /*break*/, 7];
291
+ if (!(attempt > 1)) return [3 /*break*/, 3];
292
+ return [4 /*yield*/, this.delay(TableManager.RECONCILE_VERIFY_RETRY_DELAY_MS)];
293
+ case 2:
294
+ _a.sent();
295
+ _a.label = 3;
296
+ case 3: return [4 /*yield*/, this.tableExists(table)];
297
+ case 4:
298
+ if (!(_a.sent())) {
299
+ remainingChanges = undefined;
300
+ return [3 /*break*/, 6];
260
301
  }
261
302
  return [4 /*yield*/, this.getTableChanges(table)];
262
- case 3:
263
- remainingChanges = _c.sent();
264
- if (this.shouldAlterTable(remainingChanges)) {
265
- // The object exists but the live schema still differs from the intended definition, so a
266
- // concurrent actor did NOT apply our exact change (a genuine conflict). Propagate.
303
+ case 5:
304
+ remainingChanges = _a.sent();
305
+ if (!this.shouldAlterTable(remainingChanges)) {
306
+ return [2 /*return*/]; // verified: present with the intended definition
307
+ }
308
+ _a.label = 6;
309
+ case 6:
310
+ attempt++;
311
+ return [3 /*break*/, 1];
312
+ case 7:
313
+ if (!remainingChanges) {
314
+ // Still absent after every re-read — not the concurrent-winner case; surface the original
315
+ // error rather than masking it.
267
316
  this.logger.warn({
268
- message: "[schema reconcile] caught ALREADY_EXISTS for table '".concat(table.name, "' but the live schema does NOT match the intended definition on re-read (genuine conflict) \u2014 re-throwing. reason: ").concat(reason),
269
- obj: { remainingChanges: remainingChanges },
317
+ message: "[schema reconcile] caught ALREADY_EXISTS for table(s) '".concat(tableNames, "' but '").concat(table.name, "' is still absent after ").concat(TableManager.RECONCILE_VERIFY_ATTEMPTS, " re-reads \u2014 NOT a concurrent apply; re-throwing. reason: ").concat(reason),
270
318
  });
271
319
  throw error;
272
320
  }
273
- _c.label = 4;
274
- case 4:
275
- _i++;
276
- return [3 /*break*/, 1];
277
- case 5:
321
+ // The object exists but the live schema still differs from the intended definition, so a
322
+ // concurrent actor did NOT apply our exact change (a genuine conflict). Propagate.
278
323
  this.logger.warn({
279
- message: "[schema reconcile] tolerated concurrent ALREADY_EXISTS for table(s) '".concat(tableNames, "' \u2014 re-read verified the object present with the intended definition, treating as applied (a concurrent actor won the race). reason: ").concat(reason),
324
+ message: "[schema reconcile] caught ALREADY_EXISTS for table '".concat(table.name, "' but the live schema does NOT match the intended definition after ").concat(TableManager.RECONCILE_VERIFY_ATTEMPTS, " re-reads (genuine conflict) \u2014 re-throwing. reason: ").concat(reason),
325
+ obj: { remainingChanges: remainingChanges },
280
326
  });
281
- return [2 /*return*/];
327
+ throw error;
282
328
  }
283
329
  });
284
330
  });
@@ -290,6 +336,9 @@ var TableManager = /** @class */ (function () {
290
336
  var candidate = error;
291
337
  return String((_b = (_a = candidate === null || candidate === void 0 ? void 0 : candidate.details) !== null && _a !== void 0 ? _a : candidate === null || candidate === void 0 ? void 0 : candidate.message) !== null && _b !== void 0 ? _b : error);
292
338
  };
339
+ TableManager.prototype.delay = function (ms) {
340
+ return new Promise(function (resolve) { return setTimeout(resolve, ms); });
341
+ };
293
342
  TableManager.prototype.validateDynamicReferenceColumns = function (table) {
294
343
  var isDynamicRefColumn = function (column) {
295
344
  return typeof column.dynamicRefTableColName === 'string';
@@ -484,6 +533,14 @@ var TableManager = /** @class */ (function () {
484
533
  });
485
534
  });
486
535
  };
536
+ /**
537
+ * Bounded verification re-reads for {@link reconcileConcurrentSchemaChange}: an already-exists
538
+ * DDL error proves the conflicting schema change COMMITTED, but INFORMATION_SCHEMA on this
539
+ * connection can briefly lag that commit — 5 × 200ms rides out the propagation without letting
540
+ * a genuine conflict stall for more than ~1s.
541
+ */
542
+ TableManager.RECONCILE_VERIFY_ATTEMPTS = 5;
543
+ TableManager.RECONCILE_VERIFY_RETRY_DELAY_MS = 200;
487
544
  return TableManager;
488
545
  }());
489
546
  exports.TableManager = TableManager;
@@ -1 +1 @@
1
- {"version":3,"file":"TableManager.js","sourceRoot":"","sources":["../../../src/schema/TableManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA2C;AAC3C,kCAAoD;AAEpD,mDAAkD;AAIlD,IAAM,SAAS,GAAG,UAAC,GAAW;IAC5B,OAAA,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;AAA5E,CAA4E,CAAC;AAM/E;IAME,sBACE,QAAkB,EAClB,iBAAoC,EACpC,gBAAkC,EAClC,cAA+B;QATzB,WAAM,GAAG,IAAI,eAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,cAAc,CAAQ,EAAE,CAAC,CAAC;QAWvG,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,+BAAc,CAAC,QAAQ,CAAC,CAAC;IACvF,CAAC;I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AAE,EAAC;;;;KAC3C;IAjaD;;;;;OAKG;IACqB,sCAAyB,GAAG,CAAC,AAAJ,CAAK;IAC9B,4CAA+B,GAAG,GAAG,AAAN,CAAO;IA2ZhE,mBAAC;CAAA,AAnaD,IAmaC;AAnaY,oCAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteinjs/db",
3
- "version": "1.32.2",
3
+ "version": "1.32.3",
4
4
  "main": "./dist/generated/index.js",
5
5
  "types": "./dist/generated/index.d.ts",
6
6
  "exports": {
@@ -66,5 +66,5 @@
66
66
  "ts-jest": "29.1.1",
67
67
  "typescript": "5.2.2"
68
68
  },
69
- "gitHead": "744307f0dc93bb03bf9cecb76251a6848511b327"
69
+ "gitHead": "3fa64176929e1c9183cf3d998d9d629dcbb669b0"
70
70
  }
@@ -13,6 +13,14 @@ export interface ColumnTypeFactory {
13
13
  }
14
14
 
15
15
  export class TableManager {
16
+ /**
17
+ * Bounded verification re-reads for {@link reconcileConcurrentSchemaChange}: an already-exists
18
+ * DDL error proves the conflicting schema change COMMITTED, but INFORMATION_SCHEMA on this
19
+ * connection can briefly lag that commit — 5 × 200ms rides out the propagation without letting
20
+ * a genuine conflict stall for more than ~1s.
21
+ */
22
+ private static readonly RECONCILE_VERIFY_ATTEMPTS = 5;
23
+ private static readonly RECONCILE_VERIFY_RETRY_DELAY_MS = 200;
16
24
  private logger = new Logger({ name: this.constructor.name, logLevel: getEnvVar('DB_LOG_LEVEL') as any });
17
25
  public columnTypeFactory: ColumnTypeFactory;
18
26
  public schemaOperations: SchemaOperations;
@@ -119,7 +127,9 @@ export class TableManager {
119
127
  * getTableChanges uses) must confirm every table now exists AND has no remaining changes of
120
128
  * the kind we attempted. A concurrent actor applying our EXACT change satisfies this; a
121
129
  * genuine conflict (e.g. the column landed with a different type, so a column-type change is
122
- * still outstanding) does not.
130
+ * still outstanding) does not. The re-read is resilient to brief schema propagation — see
131
+ * {@link verifyIntendedDefinition} for the bounded retry that prevents a momentarily-stale
132
+ * INFORMATION_SCHEMA read from false-negativing into the very crash this closes.
123
133
  * If either gate fails, the ORIGINAL error propagates unchanged. Because every actor runs this
124
134
  * same reconcile, it closes all three windows: migration-Job-vs-pod, pod-vs-pod, and
125
135
  * multi-replica boot.
@@ -138,30 +148,65 @@ export class TableManager {
138
148
  const reason = this.schemaErrorReason(error);
139
149
 
140
150
  for (const table of tables) {
141
- // A create that failed already-exists yet leaves the table absent is not the
142
- // concurrent-winner case — surface the original error rather than masking it.
151
+ await this.verifyIntendedDefinition(table, tableNames, reason, error);
152
+ }
153
+
154
+ this.logger.warn({
155
+ message: `[schema reconcile] tolerated concurrent ALREADY_EXISTS for table(s) '${tableNames}' — re-read verified the object present with the intended definition, treating as applied (a concurrent actor won the race). reason: ${reason}`,
156
+ });
157
+ }
158
+
159
+ /**
160
+ * Re-read the live schema until `table` is present with the intended definition, retrying a
161
+ * BOUNDED number of times ({@link RECONCILE_VERIFY_ATTEMPTS} × {@link RECONCILE_VERIFY_RETRY_DELAY_MS}).
162
+ *
163
+ * The already-exists error means the conflicting DDL has COMMITTED — the object exists — but
164
+ * INFORMATION_SCHEMA on this connection can briefly lag that commit, and a single point-in-time
165
+ * read that misses it would false-negative into a re-throw, reintroducing the exact boot crash
166
+ * this reconcile closes. So the re-read's job is (a) to wait out momentary invisibility and
167
+ * (b) to verify the DEFINITION matches intent. A momentary stale read resolves via retry into
168
+ * success; only a definition still absent or mismatched after every attempt is a genuine
169
+ * conflict — logged at WARN, then the ORIGINAL error re-throws.
170
+ */
171
+ private async verifyIntendedDefinition(
172
+ table: Table<any>,
173
+ tableNames: string,
174
+ reason: string,
175
+ error: unknown
176
+ ): Promise<void> {
177
+ let remainingChanges: TableChanges | undefined;
178
+ for (let attempt = 1; attempt <= TableManager.RECONCILE_VERIFY_ATTEMPTS; attempt++) {
179
+ if (attempt > 1) {
180
+ await this.delay(TableManager.RECONCILE_VERIFY_RETRY_DELAY_MS);
181
+ }
182
+
143
183
  if (!(await this.tableExists(table))) {
144
- this.logger.warn({
145
- message: `[schema reconcile] caught ALREADY_EXISTS for table(s) '${tableNames}' but '${table.name}' is still absent on re-read — NOT a concurrent apply; re-throwing. reason: ${reason}`,
146
- });
147
- throw error;
184
+ remainingChanges = undefined;
185
+ continue;
148
186
  }
149
187
 
150
- const remainingChanges = await this.getTableChanges(table);
151
- if (this.shouldAlterTable(remainingChanges)) {
152
- // The object exists but the live schema still differs from the intended definition, so a
153
- // concurrent actor did NOT apply our exact change (a genuine conflict). Propagate.
154
- this.logger.warn({
155
- message: `[schema reconcile] caught ALREADY_EXISTS for table '${table.name}' but the live schema does NOT match the intended definition on re-read (genuine conflict) — re-throwing. reason: ${reason}`,
156
- obj: { remainingChanges },
157
- });
158
- throw error;
188
+ remainingChanges = await this.getTableChanges(table);
189
+ if (!this.shouldAlterTable(remainingChanges)) {
190
+ return; // verified: present with the intended definition
159
191
  }
160
192
  }
161
193
 
194
+ if (!remainingChanges) {
195
+ // Still absent after every re-read — not the concurrent-winner case; surface the original
196
+ // error rather than masking it.
197
+ this.logger.warn({
198
+ message: `[schema reconcile] caught ALREADY_EXISTS for table(s) '${tableNames}' but '${table.name}' is still absent after ${TableManager.RECONCILE_VERIFY_ATTEMPTS} re-reads — NOT a concurrent apply; re-throwing. reason: ${reason}`,
199
+ });
200
+ throw error;
201
+ }
202
+
203
+ // The object exists but the live schema still differs from the intended definition, so a
204
+ // concurrent actor did NOT apply our exact change (a genuine conflict). Propagate.
162
205
  this.logger.warn({
163
- message: `[schema reconcile] tolerated concurrent ALREADY_EXISTS for table(s) '${tableNames}' re-read verified the object present with the intended definition, treating as applied (a concurrent actor won the race). reason: ${reason}`,
206
+ message: `[schema reconcile] caught ALREADY_EXISTS for table '${table.name}' but the live schema does NOT match the intended definition after ${TableManager.RECONCILE_VERIFY_ATTEMPTS} re-reads (genuine conflict) re-throwing. reason: ${reason}`,
207
+ obj: { remainingChanges },
164
208
  });
209
+ throw error;
165
210
  }
166
211
 
167
212
  /** Concise, loggable reason from a schema-update error: the backend names the offending object
@@ -171,6 +216,10 @@ export class TableManager {
171
216
  return String(candidate?.details ?? candidate?.message ?? error);
172
217
  }
173
218
 
219
+ private delay(ms: number): Promise<void> {
220
+ return new Promise((resolve) => setTimeout(resolve, ms));
221
+ }
222
+
174
223
  private validateDynamicReferenceColumns(table: Table<any>): void {
175
224
  const isDynamicRefColumn = (column: any): column is DynamicReferenceColumn<any> =>
176
225
  typeof column.dynamicRefTableColName === 'string';