@wcstack/devtools 3.5.4 → 4.0.0-rc.2

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/dist/index.d.ts CHANGED
@@ -69,6 +69,8 @@ interface IStateElementSummaryLike {
69
69
  * $listKeys 宣言」なので、前提判定の正確化に paths.list と対で使う
70
70
  *(明示 index 書き込みは前提に依らず発火し得る)。旧ランタイムにはフィールド自体が
71
71
  * 無いため optional(undefined = $listKeys 側が観測不能)。宣言なしは null。
72
+ * The prerequisite is @wcstack/state 3.x's: a 4.0 runtime fires row watches without a `for`
73
+ * or `$listKeys`, so the coverage report does not judge it there (DevtoolsCore).
72
74
  */
73
75
  readonly keyedListPaths?: ReadonlySet<string> | null;
74
76
  }
@@ -345,7 +347,9 @@ type CoreChangeListener = (kind: CoreChangeKind) => void;
345
347
  * 配線カバレッジ 1 行(static-wiring-dx-design.md §4 — 宣言 × 実測の突合)。
346
348
  * - watch: `fired`(count 回)/ `never` / `prerequisite-missing`
347
349
  * (ワイルドカード行 watch は「for バインド or $listKeys 宣言」が無いと
348
- * リスト書き込みが行へ届かない — 「未発火」と区別しないと誤警告になる)
350
+ * リスト書き込みが行へ届かない — 「未発火」と区別しないと誤警告になる).
351
+ * `prerequisite-missing` is reported for a @wcstack/state 3.x runtime only: 4.0 row watches
352
+ * need neither (see rowWatchNeedsListBinding).
349
353
  * - command / eventToken: `emitted`(count 回)/ `never` /
350
354
  * `emitted-unheard`(全 emit が subscriberCount 0 = 空撃ち。§4 の突合対象)
351
355
  * - binding: canonical declared がある場合のみ。`attached` / `never-attached`
package/dist/index.esm.js CHANGED
@@ -235,6 +235,23 @@ function rootLabelOf(rootNode) {
235
235
  }
236
236
  return rootNode.nodeName.toLowerCase();
237
237
  }
238
+ /**
239
+ * Whether list writes reach a wildcard row watch of this runtime only when each list it ranges
240
+ * over is bound by a `for` (`paths.list`) or declared in `$listKeys` (`keyedListPaths`).
241
+ *
242
+ * That is @wcstack/state 3.x (state-watch-hook-design.md §6-3). 4.0 keeps the lists a row watch
243
+ * ranges over synced itself, so its row watches fire on list writes without either
244
+ * (packages/state/src/temporal/watch.ts) — the prerequisite does not exist there, and a row watch
245
+ * that has not fired is plain `never`. (A 4.0 summary's `paths.list` also holds the lists of every
246
+ * declared path, the `$watch` keys' own included, so it never reads as "no for binding" anyway.)
247
+ *
248
+ * Decided by the major of the source's `packageVersion`: a devtools 4.x can meet a 3.x runtime on a
249
+ * page that pinned `@wcstack/state@3` while migrating. A version that does not parse is taken as an
250
+ * old runtime, which keeps the report as cautious as it was before 4.0.
251
+ */
252
+ function rowWatchNeedsListBinding(packageVersion) {
253
+ return !(Number.parseInt(String(packageVersion), 10) >= 4);
254
+ }
238
255
  /** token カバレッジ 1 行の判定(§4: 空撃ちのみ / 一部空撃ち / 正常 / 未発火) */
239
256
  function tokenCoverageOf(kind, name, stat) {
240
257
  if (stat === undefined) {
@@ -464,6 +481,8 @@ class DevtoolsCore {
464
481
  if (stateElement !== undefined && summary.element !== stateElement) {
465
482
  continue;
466
483
  }
484
+ // a roster entry exists only while its source is registered (onSourceUnregistered drops both)
485
+ const needsListBinding = rowWatchNeedsListBinding(this._sources.get(entry.sourceId).packageVersion);
467
486
  // --- watch: 宣言(watchPaths)× 実測(watch-fired 台帳・自ツリー + 旧 payload 合算) ---
468
487
  for (const path of summary.watchPaths ?? []) {
469
488
  const count = this._measuredFor(this._watchFiredStats, pathKeyOf(path), summary.element)?.count ?? 0;
@@ -471,7 +490,12 @@ class DevtoolsCore {
471
490
  out.push({ kind: "watch", name: path, status: "fired", count, note: null });
472
491
  continue;
473
492
  }
474
- // ワイルドカード行 watch に**リスト書き込み**が届く前提 = 各 `.*` 階層の
493
+ // 4.0: a row watch keeps its lists synced itself — nothing to be missing
494
+ if (!needsListBinding) {
495
+ out.push({ kind: "watch", name: path, status: "never", count: 0, note: null });
496
+ continue;
497
+ }
498
+ // (@wcstack/state 3.x) ワイルドカード行 watch に**リスト書き込み**が届く前提 = 各 `.*` 階層の
475
499
  // リストが「for バインド(paths.list)or `$listKeys` 宣言(keyedListPaths)」
476
500
  // されていること(watch 設計 §6-3)。未成立は「未発火」と区別する。
477
501
  // 前提はリスト置換経路に限る主張 — 明示 index 書き込み(`$resolve` /