cross-tab-worker-databus 0.21.25 → 0.21.26

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,3 +1,26 @@
1
+ ## [0.21.26] - 2026-09-25
2
+
3
+ One false sentence about who cancels a persistence retry, corrected everywhere it had been written — found by an audit pass whose own scheduling step was wrong, which is the part worth reading.
4
+
5
+ ### Fixed
6
+
7
+ - **`retryGeneration` has exactly one writer, and it is not `stop()`.** Four comments in `replay-manager.ts` described the cancellation generation as bumped "on suspend/stop". This class defines *both* of those methods, and only `suspend()` increments the field — `stop()` clears the retention-sweep timer and cancels nothing in flight. A maintainer auditing "what supersedes an in-flight retry" who read `stop()` first would have found no bump and had to conclude either that the comment was right and the code was broken, or that the pair meant something else. `ReplayManager` appears nowhere in the barrel, so no consumer can reach the wrong model; the class's own callers can, and `stop()`'s only caller in `src/` is `suspend()`.
8
+ - **The half that was true is now stated at the level it is true at.** `CrossTabDataBus` has no `suspend()` method at all: it reaches the bump from two sites, the cluster's `onSuspend` handler and `beginStop()`. So a hidden *tab* and a stopped *bus* both do cancel their queued durable appends — through `ReplayManager.suspend()` — and that is exactly why the shorthand stayed plausible: the test that covers the behavior is named "cancels a pending persistence retry when the bus stops", and it passes whatever this class's `stop()` does. Nor was the sentence a stale remnant of code that once behaved that way — checked against `0cb8572`, the commit that split this file out, `stop()` has never touched the field; the pair has been false since the day it was written.
9
+ - **One corrected claim about the corrected claims, caught before it shipped.** The pass began with a scan that decided which zero-count branch arms still lacked a verdict at their site by reading the line above each one. It reported 21 unvisited legs on a ledger of 46 in which **every** arm already carries one, because those verdicts run five to fifteen lines and state the measurement that closes the arm. Reading the reported sites with a window is what turned the pass into a one-defect pass instead of a re-do of closed work.
10
+
11
+ ### Tests
12
+
13
+ - **None added, and that is the honest classification.** Nothing here moves behavior: the diff is comment lines only (`git diff -U0 src/` with every non-comment line filtered out returns nothing), the suite is unchanged at 936 tests, the perf gates at 5/5, and the branch-arm ledger at **46 zero-count arms of 1963** with aggregate 99.02 / 97.65 / 99.27 / 99.69 — byte-identical to `0.21.25`'s. A test asserting that `ReplayManager.stop()` cancels nothing would characterize an internal method with one caller rather than pin a contract, and this repository's rule is to name that difference instead of banking the green.
14
+
15
+ ### Documentation
16
+
17
+ - **`AGENTS.md` gained the scoping rule.** A scan is a probe, so it needs the control the probe rules already demand: run it on a site you know is answered and check it reports "present" before its output becomes a task list — a scan that cannot distinguish *absent* from *not looked at* schedules rework over closed ground, and that rework looks like progress. The second half of the rule is the pair-shorthand itself: when a comment names two methods as doing the same thing, check each name in the class that owns the thing, because the pair can be accurate about callers and false about callees while every test passes.
18
+ - **The shipped surface for a comment is wider than the declarations.** Verified rather than assumed: the corrected sentences appear in `dist/core/replay-manager.d.ts`, in the ESM chunk `dist/chunk-WKOCDMCH.js`, and in both CJS bundles (`dist/cjs/index.cjs`, `dist/cjs/centrifuge.cjs`) — esbuild preserves comments in the JS, and all of those paths are in `package.json` `files`.
19
+
20
+ ### Compatibility
21
+
22
+ Comment-only. No export, frame, option, default or storage key moved; `verify:compat`, `verify:types` and `verify:pack` pass against `v0.21.25`.
23
+
1
24
  ## [0.21.25] - 2026-09-25
2
25
 
3
26
  A publication's fan-out set is now fixed when its delivery begins, which closes a shape that did not terminate: a handler that registers a fresh closure for its own topic made the message that triggered the registration keep delivering to the handlers it created.
@@ -7,7 +7,7 @@ import {
7
7
  publicationMetadata,
8
8
  selectWorkerBackend,
9
9
  serializeError
10
- } from "./chunk-ORGPJ2CX.js";
10
+ } from "./chunk-LN5O3IR6.js";
11
11
  import {
12
12
  CENTRIFUGE_INPUT_TYPE,
13
13
  CENTRIFUGE_OUTPUT_TYPE,
@@ -1996,7 +1996,9 @@ var ReplayManager = class {
1996
1996
  trace;
1997
1997
  onPersistenceError;
1998
1998
  onDispatchError;
1999
- /** Bumped on suspend/stop so in-flight persistence retries are cancelled. */
1999
+ /** Bumped by exactly one statement, in `suspend()` below — which is where the
2000
+ * `generation !== this.retryGeneration` tests throughout this file look for a
2001
+ * cancellation. This class's own `stop()` does not touch the field. */
2000
2002
  retryGeneration = 0;
2001
2003
  pendingReplayPersistence = [];
2002
2004
  persistenceFlushScheduled = false;
@@ -2155,13 +2157,19 @@ var ReplayManager = class {
2155
2157
  this.scheduleRetentionCleanup(this.now() - this.retentionMs);
2156
2158
  }, this.retentionSweepMs);
2157
2159
  }
2158
- /** Stop the periodic retention sweep. */
2160
+ /** Stop the periodic retention sweep. Its only caller in `src/` is `suspend()`,
2161
+ * which chains it at its end — the class is internal (`ReplayManager` appears
2162
+ * nowhere in the barrel), so no consumer reaches this method directly. It
2163
+ * cancels no in-flight work: that is the `retryGeneration` bump in `suspend()`. */
2159
2164
  stop() {
2160
2165
  if (this.retentionTimer) clearInterval(this.retentionTimer);
2161
2166
  this.retentionTimer = null;
2162
2167
  }
2163
- /** Suspend the manager: cancel in-flight persistence retries (so a hidden tab
2164
- * or stopped bus does not keep hammering the store) and stop the sweep. */
2168
+ /** Cancel in-flight persistence retries by superseding their generation, so a
2169
+ * hidden tab or a stopped bus does not keep hammering the store. This is the
2170
+ * field's only writer; the bus reaches it from its two `replayManager.suspend()`
2171
+ * call sites (the cluster's `onSuspend` handler, and `beginStop()`), and this
2172
+ * class's own `stop()` only clears the sweep timer. */
2165
2173
  suspend() {
2166
2174
  this.retryGeneration += 1;
2167
2175
  if (this.hydration) {
@@ -2335,7 +2343,7 @@ var ReplayManager = class {
2335
2343
  });
2336
2344
  }
2337
2345
  /** Run a persistence operation with exponential backoff on transient failure.
2338
- * Bumped `retryGeneration` (suspend/stop) cancels the loop early; a
2346
+ * The `suspend()` bump of `retryGeneration` cancels the loop early; a
2339
2347
  * structurally failing operation throws after `persistenceRetryMaxAttempts`,
2340
2348
  * leaving the ring buffer intact so the bus keeps working. */
2341
2349
  async withPersistenceRetry(persistenceOperation, operation) {
@@ -2491,7 +2499,7 @@ var SDK_VERSION = (
2491
2499
  // declaration's type is `string | undefined` and the export's is `string`
2492
2500
  // (dropping the conditional is TS2322, measured). Recorded here so the leg reads
2493
2501
  // as a shape the harness cannot reach rather than as a case nobody exercised.
2494
- true ? "0.21.25" : ""
2502
+ true ? "0.21.26" : ""
2495
2503
  );
2496
2504
 
2497
2505
  // src/core/data-bus.ts
@@ -3731,4 +3739,4 @@ export {
3731
3739
  parseDataBusPublication,
3732
3740
  selectWorkerBackend
3733
3741
  };
3734
- //# sourceMappingURL=chunk-ORGPJ2CX.js.map
3742
+ //# sourceMappingURL=chunk-LN5O3IR6.js.map