@cardenelabs/cdl 0.40.12 → 0.41.1

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
@@ -5,6 +5,58 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.41.1] - 2026-09-10
9
+
10
+ ### Changed
11
+
12
+ - **検査の速さの判定を、1 枚ごとの壁時計から全図の合計へ移した** (#776)
13
+
14
+ 同じ図を同じ process で 3 周すると答えが変わっていた。
15
+
16
+ | 図 | 1 周目 | 2 周目 | 3 周目 |
17
+ |---|---|---|---|
18
+ | `interactive-social-share-buttons` | 53ms | 0ms | 1ms |
19
+ | `interactive-traffic-sankey` | 50ms | 159ms | 115ms |
20
+
21
+ 1 つ目は最初の 1 回だけ掛かる下準備、2 つ目は機械の混み具合で、どちらも図の性質ではない。
22
+ 100ms の境で数えると **入力が同じなのに超過が 0 / 1 / 1 件** と周ごとに変わり、
23
+ 測れなかったことを「遅い」 に倒していた。
24
+
25
+ 合計は同じ 3 周で 559 / 877 / 858 ms と 1.6 倍の幅に収まり、境の 5000ms から充分離れて
26
+ いるので判定が安定する。 **合計だけを見る**。
27
+
28
+ **報告を 1 件に丸めるのもやめた**。 旧実装は `findIndex` で最初に当たった 1 枚しか
29
+ 出しておらず、20 枚が超過した周でも報告は 1 枚だった。 超過した時は重い順の内訳を文面へ
30
+ 載せ、出し切れない分は「残り N 図は出していない」 と件数で残す。
31
+
32
+ 判定は `perfBudgetViolations` として切り出した。 合計が 5000ms を超える状況を実際に作ると
33
+ 確かめる検査そのものが 5 秒以上掛かるため、時間の配列を直接渡せる形にしている。
34
+ `index.ts` からは出していないので、公開する API は変わらない。
35
+
36
+ ## [0.41.0] - 2026-09-10
37
+
38
+ ### Removed (破壊的変更)
39
+
40
+ - **軸 40 `memory-budget` を廃し、描く物の数は軸 34 `dom-complexity-budget` に一本化した** (#775)
41
+
42
+ この軸は「図が大きすぎる」 を **箱の面積の合計** で測っていたため、順位が実物と逆になって
43
+ いた。 下流の見本帳 444 枚の実測がそれを示す。
44
+
45
+ | 図 | 旧軸 40 の値 | 箱 | 行 | 線の折れ | 段の指定 | 描く物の合計 |
46
+ |---|---|---|---|---|---|---|
47
+ | `oauth-flow` | 1153288 (超過) | 1 | 0 | 0 | 4 | **5** |
48
+ | `interactive-traffic-sankey` | 208070 (通る) | 6 | 0 | 44 | 3 | **53** |
49
+
50
+ 箱 1 つの縦長の図が超過し、線の折れが 44 ある図が通っていた。 境の値も説明 (10^7) と
51
+ 実装 (10^6) が食い違い、正常の範囲の内側に置かれていた。
52
+
53
+ **軸 34 の数え方は変えない**。 軸 40 は細かさ (行 / 線の折れ) を 1 度も拾えておらず
54
+ (面積の項が支配していた)、消しても失う検知が無い。 境の 400 は今の数え方で決めた値なので、
55
+ 数え方を変えると境の根拠が消える。
56
+
57
+ 消費側への影響は 2 つ。 `VisualAxis` から `"memory-budget"` が消え、`report.counts` の
58
+ 同名の鍵も消える。 鍵で数えている側は参照を外す。
59
+
8
60
  ## [0.40.12] - 2026-09-10
9
61
 
10
62
  ### Fixed
@@ -2087,7 +2139,9 @@ Initial OSS release.
2087
2139
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
2088
2140
  行き止まりになる。
2089
2141
 
2090
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.40.12...HEAD
2142
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.41.1...HEAD
2143
+ [0.41.1]: https://github.com/cardene777/cdl/compare/v0.41.0...v0.41.1
2144
+ [0.41.0]: https://github.com/cardene777/cdl/compare/v0.40.12...v0.41.0
2091
2145
  [0.40.12]: https://github.com/cardene777/cdl/compare/v0.40.11...v0.40.12
2092
2146
  [0.40.11]: https://github.com/cardene777/cdl/compare/v0.40.10...v0.40.11
2093
2147
  [0.40.10]: https://github.com/cardene777/cdl/compare/v0.40.9...v0.40.10
package/dist/index.cjs CHANGED
@@ -15542,7 +15542,6 @@ function emptyCounts() {
15542
15542
  "row-content-typing": 0,
15543
15543
  "terminal-safe-text": 0,
15544
15544
  "gpu-layer-efficiency": 0,
15545
- "memory-budget": 0,
15546
15545
  "svg-injection-safety": 0,
15547
15546
  "seo-metadata-quality": 0,
15548
15547
  "bidi-hyphenation": 0,
@@ -17285,24 +17284,6 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
17285
17284
  "warn"
17286
17285
  );
17287
17286
  }
17288
- const MEMORY_BUDGET = 1e6;
17289
- let nodeMemUnit = 0;
17290
- for (const n of laid.nodes) nodeMemUnit += n.w * n.h;
17291
- let edgeMemUnit = 0;
17292
- for (const e of laid.edges) {
17293
- const segs = extractPathSegments(e.d);
17294
- edgeMemUnit += segs.length * 100;
17295
- }
17296
- let phaseMemUnit = 0;
17297
- for (const p of diag.phases) phaseMemUnit += (p.tweens.length + p.sets.length) * 50;
17298
- const totalMemUnit = nodeMemUnit + edgeMemUnit + phaseMemUnit;
17299
- if (totalMemUnit > MEMORY_BUDGET) {
17300
- push(
17301
- "memory-budget",
17302
- `diagram memory unit \u63A8\u5B9A ${totalMemUnit.toFixed(0)} > budget ${MEMORY_BUDGET} (nodes=${nodeMemUnit.toFixed(0)} edges=${edgeMemUnit.toFixed(0)} phases=${phaseMemUnit.toFixed(0)})`,
17303
- "warn"
17304
- );
17305
- }
17306
17287
  const XSS_PATTERNS = [
17307
17288
  { re: /<script\b/i, label: "<script> tag" },
17308
17289
  { re: /javascript:/i, label: "javascript: URI" },
@@ -17726,6 +17707,24 @@ function visualValidateAll(diagrams, opts) {
17726
17707
  metaViolations
17727
17708
  };
17728
17709
  }
17710
+ var PERF_BUDGET_TOTAL_MS = 5e3;
17711
+ var PERF_SLOWEST_SAMPLE = 5;
17712
+ function perfBudgetViolations(durations, diagrams = []) {
17713
+ const total = durations.reduce((s, d) => s + d, 0);
17714
+ if (total <= PERF_BUDGET_TOTAL_MS) return [];
17715
+ const \u91CD\u3044\u9806 = durations.map((ms, i) => ({ id: diagrams[i]?.id ?? "?", ms })).sort((a, b) => b.ms - a.ms);
17716
+ const \u629C\u7C8B = \u91CD\u3044\u9806.slice(0, PERF_SLOWEST_SAMPLE);
17717
+ const \u6B8B\u308A = \u91CD\u3044\u9806.length - \u629C\u7C8B.length;
17718
+ const \u5185\u8A33 = \u629C\u7C8B.map((d) => `"${d.id}" ${d.ms}ms`).join(" / ") + (\u6B8B\u308A > 0 ? `\u3001 \u6B8B\u308A ${\u6B8B\u308A} \u56F3\u306F\u51FA\u3057\u3066\u3044\u306A\u3044` : "");
17719
+ return [
17720
+ {
17721
+ axis: "validate-performance-budget",
17722
+ diagramId: "__meta__",
17723
+ detail: `visualValidateAll \u5168 ${durations.length} \u56F3\u306E\u7D2F\u8A08 ${total}ms > ${PERF_BUDGET_TOTAL_MS}ms budget (\u91CD\u3044\u9806 ${\u5185\u8A33})`,
17724
+ severity: "warn"
17725
+ }
17726
+ ];
17727
+ }
17729
17728
  function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports = []) {
17730
17729
  const out = [];
17731
17730
  const totalErrors = reports.reduce(
@@ -17741,27 +17740,7 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
17741
17740
  severity: "warn"
17742
17741
  });
17743
17742
  }
17744
- const PERF_BUDGET_PER_DIAGRAM_MS = 100;
17745
- const PERF_BUDGET_TOTAL_MS = 5e3;
17746
- const overBudgetIdx = durations.findIndex((d) => d > PERF_BUDGET_PER_DIAGRAM_MS);
17747
- if (overBudgetIdx >= 0) {
17748
- const did = diagrams[overBudgetIdx]?.id ?? "?";
17749
- out.push({
17750
- axis: "validate-performance-budget",
17751
- diagramId: did,
17752
- detail: `diagram "${did}" validate ${durations[overBudgetIdx]}ms > ${PERF_BUDGET_PER_DIAGRAM_MS}ms budget`,
17753
- severity: "warn"
17754
- });
17755
- }
17756
- const totalDur = durations.reduce((s, d) => s + d, 0);
17757
- if (totalDur > PERF_BUDGET_TOTAL_MS) {
17758
- out.push({
17759
- axis: "validate-performance-budget",
17760
- diagramId: "__meta__",
17761
- detail: `visualValidateAll \u5168 diagram \u7D2F\u8A08 ${totalDur}ms > ${PERF_BUDGET_TOTAL_MS}ms budget`,
17762
- severity: "warn"
17763
- });
17764
- }
17743
+ out.push(...perfBudgetViolations(durations, diagrams));
17765
17744
  const DEAD_ALLOWLIST = [
17766
17745
  // catalog で自然発火なしを許容する security / migration / performance / meta / dev-quality axis 群。
17767
17746
  // 実 diagram に該当データ (XSS / migration list / oversized / broken doc) が混入するのが稀なため。
@@ -17809,7 +17788,6 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
17809
17788
  "row-content-typing",
17810
17789
  "terminal-safe-text",
17811
17790
  "gpu-layer-efficiency",
17812
- "memory-budget",
17813
17791
  "svg-injection-safety",
17814
17792
  "seo-metadata-quality",
17815
17793
  "bidi-hyphenation",
@@ -17879,7 +17857,6 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
17879
17857
  "row-content-typing",
17880
17858
  "terminal-safe-text",
17881
17859
  "gpu-layer-efficiency",
17882
- "memory-budget",
17883
17860
  "svg-injection-safety",
17884
17861
  "seo-metadata-quality",
17885
17862
  "bidi-hyphenation",
@@ -17921,7 +17898,7 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
17921
17898
  });
17922
17899
  }
17923
17900
  }
17924
- const EXPECTED_AXIS_COUNT = 68;
17901
+ const EXPECTED_AXIS_COUNT = 67;
17925
17902
  if (allAxes.length !== EXPECTED_AXIS_COUNT) {
17926
17903
  out.push({
17927
17904
  axis: "axis-documentation-completeness",