@ultimat3/realtime 31.43.0 → 31.44.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/README.md CHANGED
@@ -989,6 +989,11 @@ client" is the one instruction that cannot help — a rebuilt client spells the
989
989
  The fix is `x queries list --json`, and the name the client sent is echoed back while the registry
990
990
  never is.
991
991
 
992
+ A throw with no code — a live query's `TypeError`, a driver's error — is `X_INTERNAL` on the ack,
993
+ as `@ultimat3/http` labels it, never `X_PROTOCOL_VERSION`. Its cause is withheld from the socket as
994
+ HTTP withholds an unclassified 5xx's (a DSN, a row, a path); the node's error report holds the text.
995
+ `As of 2026-11`.
996
+
992
997
  `As of 2026-07`: tiers 1–2 target v1, tier 3 targets v2.
993
998
 
994
999
  ### Error classes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/realtime",
3
- "version": "31.43.0",
3
+ "version": "31.44.0",
4
4
  "description": "Three-tier realtime: channels, live queries, local-first sync — one protocol, one mutator shape",
5
5
  "keywords": [
6
6
  "ultimate",
@@ -52,10 +52,10 @@
52
52
  "test": "bun test"
53
53
  },
54
54
  "dependencies": {
55
- "@ultimat3/core": "31.43.0",
56
- "@ultimat3/entity": "31.43.0",
57
- "@ultimat3/policy": "31.43.0",
58
- "@ultimat3/query": "31.43.0",
55
+ "@ultimat3/core": "31.44.0",
56
+ "@ultimat3/entity": "31.44.0",
57
+ "@ultimat3/policy": "31.44.0",
58
+ "@ultimat3/query": "31.44.0",
59
59
  "nats": "2.29.3"
60
60
  }
61
61
  }
@@ -323,7 +323,11 @@ export function toWireError(error: unknown): WireError {
323
323
  // `renderThrowable` keeps an Error's own words without trusting `instanceof` or `.message`, and
324
324
  // `stringField` makes the four probes above it as total as the fallback they choose between —
325
325
  // `shape?.code` was a raw property read on that same app value.
326
- const code = stringField(error, 'code') ?? 'X_PROTOCOL_VERSION';
326
+ // `X_INTERNAL` for a throwable with no code, as `@ultimat3/http`'s `factsOf` labels it: it was
327
+ // `X_PROTOCOL_VERSION` until round 5, sending the reader to rebuild a client over a server bug.
328
+ // The decoder's refusals are `ProtocolVersionError`s, coded already, so they keep theirs.
329
+ const code = stringField(error, 'code') ?? 'X_INTERNAL';
330
+ if (code === 'X_INTERNAL') return internalWireError(error);
327
331
  const cause = stringField(error, 'cause') ?? renderThrowable(error);
328
332
  const fix = stringField(error, 'fix') ?? 'x doctor realtime';
329
333
  const docs = stringField(error, 'docs');
@@ -332,6 +336,23 @@ export function toWireError(error: unknown): WireError {
332
336
  return retryAfterSeconds === undefined ? base : { ...base, retryAfterSeconds };
333
337
  }
334
338
 
339
+ /**
340
+ * An unclassified failure, as a stranger gets it: HTTP's `toProblem` blanks the same cause, because
341
+ * it is a driver's DSN, a rejected row or a path, and nothing in it is the caller's to act on. The
342
+ * real text is the node's: `sync-node.ts` reports it, `live-reauth.ts` counts it. An authored
343
+ * `fix` and `docs` still ride, being instructions rather than evidence.
344
+ */
345
+ function internalWireError(error: unknown): WireError {
346
+ const fix = stringField(error, 'fix') ?? INTERNAL_FIX;
347
+ const docs = stringField(error, 'docs');
348
+ const base = { code: 'X_INTERNAL', cause: INTERNAL_CAUSE, fix };
349
+ return docs === undefined ? base : { ...base, docs };
350
+ }
351
+
352
+ const INTERNAL_CAUSE =
353
+ 'the sync node failed while handling this frame; the details are in its logs and error reports';
354
+ const INTERNAL_FIX = 'x errors explain X_INTERNAL --json # then fix the throwing call site';
355
+
335
356
  /**
336
357
  * `meta.retryAfterSeconds`, the field `@ultimat3/http`'s `X_RATE_LIMITED` carries — read as totally
337
358
  * as `stringField` reads the rest, because the throwable is app code's and its getters may throw.