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 +23 -0
- package/dist/centrifuge.js +1 -1
- package/dist/{chunk-ORGPJ2CX.js → chunk-LN5O3IR6.js} +15 -7
- package/dist/{chunk-ORGPJ2CX.js.map → chunk-LN5O3IR6.js.map} +2 -2
- package/dist/cjs/centrifuge.cjs +14 -6
- package/dist/cjs/centrifuge.cjs.map +2 -2
- package/dist/cjs/index.cjs +14 -6
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/core/replay-manager.d.ts +13 -5
- package/dist/core/replay-manager.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/docs/roadmap.md +7 -0
- package/docs/zh/roadmap.md +8 -1
- package/package.json +1 -1
|
@@ -48,7 +48,9 @@ export declare class ReplayManager<TData = unknown> {
|
|
|
48
48
|
private readonly trace;
|
|
49
49
|
private readonly onPersistenceError;
|
|
50
50
|
private readonly onDispatchError;
|
|
51
|
-
/** Bumped
|
|
51
|
+
/** Bumped by exactly one statement, in `suspend()` below — which is where the
|
|
52
|
+
* `generation !== this.retryGeneration` tests throughout this file look for a
|
|
53
|
+
* cancellation. This class's own `stop()` does not touch the field. */
|
|
52
54
|
private retryGeneration;
|
|
53
55
|
private pendingReplayPersistence;
|
|
54
56
|
private persistenceFlushScheduled;
|
|
@@ -101,10 +103,16 @@ export declare class ReplayManager<TData = unknown> {
|
|
|
101
103
|
/** Start the periodic retention sweep. No-op when no durable retention
|
|
102
104
|
* config makes it necessary. */
|
|
103
105
|
start(): void;
|
|
104
|
-
/** Stop the periodic retention sweep.
|
|
106
|
+
/** Stop the periodic retention sweep. Its only caller in `src/` is `suspend()`,
|
|
107
|
+
* which chains it at its end — the class is internal (`ReplayManager` appears
|
|
108
|
+
* nowhere in the barrel), so no consumer reaches this method directly. It
|
|
109
|
+
* cancels no in-flight work: that is the `retryGeneration` bump in `suspend()`. */
|
|
105
110
|
stop(): void;
|
|
106
|
-
/**
|
|
107
|
-
* or stopped bus does not keep hammering the store
|
|
111
|
+
/** Cancel in-flight persistence retries by superseding their generation, so a
|
|
112
|
+
* hidden tab or a stopped bus does not keep hammering the store. This is the
|
|
113
|
+
* field's only writer; the bus reaches it from its two `replayManager.suspend()`
|
|
114
|
+
* call sites (the cluster's `onSuspend` handler, and `beginStop()`), and this
|
|
115
|
+
* class's own `stop()` only clears the sweep timer. */
|
|
108
116
|
suspend(): void;
|
|
109
117
|
/** Drop all in-memory buffers and require hydration for the next lifecycle. */
|
|
110
118
|
resetBuffers(): void;
|
|
@@ -136,7 +144,7 @@ export declare class ReplayManager<TData = unknown> {
|
|
|
136
144
|
* so a burst of publications issues at most one clearBefore transaction. */
|
|
137
145
|
private scheduleRetentionCleanup;
|
|
138
146
|
/** Run a persistence operation with exponential backoff on transient failure.
|
|
139
|
-
*
|
|
147
|
+
* The `suspend()` bump of `retryGeneration` cancels the loop early; a
|
|
140
148
|
* structurally failing operation throws after `persistenceRetryMaxAttempts`,
|
|
141
149
|
* leaving the ring buffer intact so the bus keeps working. */
|
|
142
150
|
private withPersistenceRetry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replay-manager.d.ts","sourceRoot":"","sources":["../../src/core/replay-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"replay-manager.d.ts","sourceRoot":"","sources":["../../src/core/replay-manager.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,iFAAiF;AACjF,qBAAa,8BAA+B,SAAQ,KAAK;;CAKxD;AAED,uEA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B;kEAC8D;IACxD,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB9C,oEAAoE;IAC9D,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BnD;oCACgC;IAChC,KAAK,IAAI,IAAI;IAYb;;;uFAGmF;IACnF,IAAI,IAAI,IAAI;IAKZ;;;;2DAIuD;IACvD,OAAO,IAAI,IAAI;IAwBf,+EAA+E;IAC/E,YAAY,IAAI,IAAI;IAWpB;;0DAEsD;IACtD,QAAQ,IAAI;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAYjF;+DAC2D;IAC3D,OAAO,CAAC,OAAO;IAqBf;;;+EAG2E;IAC3E,OAAO,CAAC,wBAAwB;IAYhC;oDACgD;IAChD,OAAO,CAAC,gBAAgB;IAexB;;8DAE0D;YAC5C,OAAO;IA0GrB;gFAC4E;IAC5E,OAAO,CAAC,wBAAwB;IAkChC;;;kEAG8D;YAChD,oBAAoB;CAwCnC"}
|
package/dist/index.js
CHANGED
package/docs/roadmap.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
0.21.25 was released on September 25, 2026. The project is intentionally continuing through reliability-focused releases before a 1.0.0 stability freeze.
|
|
4
4
|
|
|
5
|
+
## 0.21.26 delivered scope
|
|
6
|
+
|
|
7
|
+
- **Who cancels a persistence retry, and who does not.** Four comments in `replay-manager.ts` said the cancellation generation was bumped "on suspend/stop". The class defines both methods and only `suspend()` writes the field; `stop()` clears the retention-sweep timer and supersedes nothing. The true half — a hidden tab and a stopped bus *do* both cancel their queued durable appends — belongs to the DataBus, which reaches `ReplayManager.suspend()` from the cluster's `onSuspend` handler and from `beginStop()`. That mismatch is also why nothing ever contradicted the sentence: the test covering the behavior is a bus-level one.
|
|
8
|
+
- **False from birth, not stale.** At `0cb8572`, the commit that split this file out, `stop()` had the body it has now — clear the timer, nothing else — and `suspend()` was already the field's only writer, so the pair never described code that existed. The class is internal (`ReplayManager` is nowhere in the barrel), which is the reason this is a maintainer-facing correction rather than a consumer-facing one.
|
|
9
|
+
- **The scan that produced the work list was the defect of the pass.** It asked which zero-count branch arms still lacked a verdict by reading the line above each site, and reported 21 unvisited legs out of a 46-arm ledger in which every arm already carries one — verdict comments run five to fifteen lines, and the measurement they cite is the point. Reading the same sites with a window turned a re-audit into one real find. `AGENTS.md` now carries the rule: a scan is a probe, so give it the control a probe needs — run it on a site known to be answered and check it says "present".
|
|
10
|
+
- **Nothing to test, and that is classified rather than waved away.** The diff is comment lines only, the suite is unchanged at 936 tests, the ledger at 46 of 1963, the aggregate at 99.02 / 97.65 / 99.27 / 99.69. Where the corrected text *does* reach consumers was measured instead: it appears in `dist/core/replay-manager.d.ts`, in the ESM chunk and in both CJS bundles, because esbuild keeps comments in the JS and every one of those paths is published.
|
|
11
|
+
|
|
5
12
|
## 0.21.25 delivered scope
|
|
6
13
|
|
|
7
14
|
- **A fan-out that did not terminate.** Handler lists are `Set`s and `dispatch()` iterated the live collection, so a handler that registered a *fresh* closure for its own topic was served the message that caused the registration — and that handler registered another, and so on. Measured: **500 handlers invoked for one publication** (the probe's ceiling, not a limit the library had) and **999 for the next**, since the registrations persist. The pattern behind it is ordinary application code: re-arming a one-shot handler on every message.
|
package/docs/zh/roadmap.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# 路线图
|
|
2
2
|
|
|
3
|
-
0.21.
|
|
3
|
+
0.21.26 已于 2026 年 9 月 25 日发布。项目会先持续完成可靠性发布,再进入 1.0.0 稳定性冻结。
|
|
4
|
+
|
|
5
|
+
## 0.21.26 已完成范围
|
|
6
|
+
|
|
7
|
+
- **谁取消持久化重试,谁不取消。** `replay-manager.ts` 里有四处注释说取消代际"is bumped on suspend/stop"。这个类两个方法都定义了,而只有 `suspend()` 会写这个字段;`stop()` 清掉的是回收定时器的扫尾计时,什么在途工作都不覆盖。成立的那一半——隐藏的 tab 和停止的 bus 确实都会取消自己排队的持久化写入——属于 DataBus:它从 cluster 的 `onSuspend` 处理和 `beginStop()` 两处走到 `ReplayManager.suspend()`。这个层级错位也正是那句话从来没被反驳过的原因:覆盖这一行为的测试是 bus 层的测试。
|
|
8
|
+
- **生下来就是错的,不是变旧的。** 在 `0cb8572`——把这个文件拆出来的那个提交——里,`stop()` 就已经和现在一样只有清空计时器这一件事,而 `suspend()` 也已经是字段的唯一写者,所以这对名字从未描述过任何存在过的代码。这个类是内部的(`ReplayManager` 在 barrel 里没有任何出口),因此这是一次面向维护者的更正,而不是面向使用者的。
|
|
9
|
+
- **产出这份任务清单的扫描,本身才是这一遍的缺陷。** 它判断哪些零计数分支还缺少落点结论的方式,是读每个站点头上一行,于是在一份 46 个分支、每个都已带结论的账本上报出 21 个"未访问"——结论注释本来就有五行到十五行长,而它引用的测量正是重点。换成带窗口地读这些站点,一次重审就变成了一个真实发现。`AGENTS.md` 现在收下了这条规则:扫描也是探针,所以要给它探针该有的对照——先拿一个已知有答案的站点跑一遍,确认它回答"存在"。
|
|
10
|
+
- **没有可测的东西,这一点是被分类而不是被略过的。** 差异只有注释行,测试仍是 936 条,账本仍是 46 / 1963,聚合仍是 99.02 / 97.65 / 99.27 / 99.69。改过的文字*如何*抵达使用者反倒是量出来的:它出现在 `dist/core/replay-manager.d.ts`、那个 ESM chunk 以及两个 CJS 包里——esbuild 会把注释留在 JS 里,而这些路径全部随包发布。
|
|
4
11
|
|
|
5
12
|
## 0.21.25 已完成范围
|
|
6
13
|
|
package/package.json
CHANGED