@eagleoutice/flowr 2.13.14 → 2.13.15

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.
Files changed (131) hide show
  1. package/README.md +23 -23
  2. package/abstract-interpretation/data-frame/resolve-args.js +11 -12
  3. package/benchmark/summarizer/second-phase/graph.d.ts +23 -0
  4. package/benchmark/summarizer/second-phase/graph.js +47 -14
  5. package/cli/repl/commands/repl-cfg.js +2 -42
  6. package/cli/repl/commands/repl-clipboard.d.ts +7 -0
  7. package/cli/repl/commands/repl-clipboard.js +53 -0
  8. package/cli/repl/commands/repl-dataflow.js +5 -70
  9. package/cli/repl/commands/repl-normalize.js +3 -51
  10. package/control-flow/cfg-dead-code.js +5 -29
  11. package/control-flow/diff-cfg.js +2 -56
  12. package/control-flow/semantic-cfg-guided-visitor.d.ts +7 -0
  13. package/control-flow/semantic-cfg-guided-visitor.js +14 -0
  14. package/control-flow/useless-loop.js +4 -26
  15. package/core/steps/all/core/10-normalize.d.ts +8 -0
  16. package/core/steps/all/core/10-normalize.js +10 -8
  17. package/core/steps/all/core/11-normalize-tree-sitter.d.ts +5 -7
  18. package/core/steps/all/core/11-normalize-tree-sitter.js +2 -9
  19. package/data/r-base-packages.generated.d.ts +1 -0
  20. package/data/r-base-packages.generated.js +5 -3
  21. package/dataflow/environments/built-in-config.d.ts +9 -1
  22. package/dataflow/environments/built-in-proc-name.d.ts +2 -0
  23. package/dataflow/environments/built-in-proc-name.js +2 -0
  24. package/dataflow/environments/built-in-props.d.ts +4 -0
  25. package/dataflow/environments/built-in-props.js +3 -3
  26. package/dataflow/environments/built-in.d.ts +4 -2
  27. package/dataflow/environments/built-in.js +53 -3
  28. package/dataflow/environments/data-masking-functions.d.ts +3 -4
  29. package/dataflow/environments/data-masking-functions.js +7 -8
  30. package/dataflow/environments/default-builtin-config.d.ts +92 -12
  31. package/dataflow/environments/default-builtin-config.js +86 -43
  32. package/dataflow/environments/environment.d.ts +5 -0
  33. package/dataflow/environments/environment.js +17 -12
  34. package/dataflow/environments/identifier.d.ts +3 -0
  35. package/dataflow/eval/resolve/alias-tracking.js +4 -7
  36. package/dataflow/eval/resolve/node-value.d.ts +51 -0
  37. package/dataflow/eval/resolve/node-value.js +71 -0
  38. package/dataflow/eval/resolve/resolve-argument.js +10 -7
  39. package/dataflow/eval/resolve/resolve-operators.js +1 -2
  40. package/dataflow/eval/values/general.d.ts +4 -0
  41. package/dataflow/eval/values/general.js +11 -0
  42. package/dataflow/eval/values/r-value.d.ts +15 -0
  43. package/dataflow/eval/values/r-value.js +27 -1
  44. package/dataflow/extractor.js +2 -0
  45. package/dataflow/fn/higher-order-function.js +2 -3
  46. package/dataflow/graph/diff-dataflow-graph.js +3 -55
  47. package/dataflow/graph/graph.d.ts +5 -0
  48. package/dataflow/graph/graph.js +27 -0
  49. package/dataflow/internal/linker.d.ts +23 -0
  50. package/dataflow/internal/linker.js +70 -1
  51. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +4 -1
  52. package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +2 -0
  53. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -29
  54. package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +39 -6
  55. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +10 -22
  56. package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +29 -53
  57. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -5
  58. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -7
  59. package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -3
  60. package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +19 -12
  61. package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +2 -1
  62. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +3 -0
  63. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +69 -52
  64. package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +2 -2
  65. package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +2 -8
  66. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +2 -8
  67. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +2 -2
  68. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -2
  69. package/dataflow/internal/process/functions/call/built-in/built-in-source.d.ts +5 -0
  70. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +23 -3
  71. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.d.ts +5 -4
  72. package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +7 -10
  73. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +6 -1
  74. package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +20 -3
  75. package/dataflow/internal/process/functions/call/built-in/built-in-stop-if-not.js +6 -8
  76. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.d.ts +25 -0
  77. package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +105 -0
  78. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +1 -27
  79. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
  80. package/dataflow/internal/process/functions/call/built-in/built-in-with.js +1 -1
  81. package/dataflow/internal/process/functions/call/deferred.d.ts +41 -0
  82. package/dataflow/internal/process/functions/call/deferred.js +127 -0
  83. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +13 -12
  84. package/dataflow/internal/process/functions/call/known-call-handling.js +35 -35
  85. package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
  86. package/dataflow/internal/process/functions/call/named-call-handling.js +8 -4
  87. package/dataflow/internal/process/functions/call/nse.d.ts +28 -0
  88. package/dataflow/internal/process/functions/call/nse.js +87 -0
  89. package/dataflow/internal/process/functions/call/quoted.d.ts +29 -0
  90. package/dataflow/internal/process/functions/call/quoted.js +188 -0
  91. package/documentation/doc-util/doc-types.js +15 -9
  92. package/linter/rules/deprecated-functions.js +9 -3
  93. package/linter/rules/seeded-randomness.js +2 -3
  94. package/linter/rules/undefined-symbol.js +10 -1
  95. package/package.json +1 -1
  96. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +6 -0
  97. package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +17 -1
  98. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.d.ts +2 -11
  99. package/project/plugins/file-plugins/notebooks/flowr-analyzer-qmd-file-plugin.js +3 -15
  100. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.d.ts +16 -0
  101. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmarkdown-file-plugin.js +26 -0
  102. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.d.ts +2 -11
  103. package/project/plugins/file-plugins/notebooks/flowr-analyzer-rmd-file-plugin.js +3 -15
  104. package/project/plugins/loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin.js +4 -10
  105. package/project/plugins/package-version-plugins/flowr-analyzer-meta-description-file-plugin.js +2 -9
  106. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-description-file-plugin.js +2 -9
  107. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +1 -1
  108. package/project/sigdb/reader.d.ts +9 -0
  109. package/project/sigdb/reader.js +30 -0
  110. package/queries/catalog/input-sources-query/input-sources-query-format.js +1 -1
  111. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.d.ts +0 -12
  112. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -37
  113. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -23
  114. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-executor.js +2 -2
  115. package/queries/query-function-filter.d.ts +21 -0
  116. package/queries/query-function-filter.js +48 -0
  117. package/r-bridge/data/data.d.ts +13 -3
  118. package/r-bridge/data/data.js +15 -3
  119. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +2 -0
  120. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +4 -0
  121. package/search/flowr-search-filters.d.ts +5 -1
  122. package/search/flowr-search-filters.js +31 -21
  123. package/search/search-executor/search-enrichers.d.ts +24 -4
  124. package/search/search-executor/search-enrichers.js +22 -9
  125. package/search/search-executor/search-transformer.js +1 -1
  126. package/util/diff-graph.d.ts +13 -0
  127. package/util/diff-graph.js +64 -1
  128. package/util/files.js +9 -8
  129. package/util/r-base-packages.d.ts +2 -0
  130. package/util/r-base-packages.js +3 -1
  131. package/util/version.js +1 -1
package/README.md CHANGED
@@ -43,7 +43,7 @@ It offers a wide variety of features, for example:
43
43
 
44
44
  ```shell
45
45
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
46
- flowR repl v2.13.12, R grammar v14 (tree-sitter engine)
46
+ flowR repl v2.13.14, R grammar v14 (tree-sitter engine)
47
47
  R> :query @linter "read.csv(\"/root/x.txt\")"
48
48
  ```
49
49
 
@@ -52,12 +52,12 @@ It offers a wide variety of features, for example:
52
52
 
53
53
 
54
54
  ```text
55
- Query: linter (9 ms)
55
+ Query: linter (11 ms)
56
56
  ╰ Deprecated Functions (deprecated-functions): no findings
57
57
  ╰ File Path Validity (file-path-validity):
58
58
  ╰ certain:
59
59
  ╰ Path `/root/x.txt` at 1.1-23
60
- ╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 0, processTimeMs: 1
60
+ ╰ Metadata: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 1, processTimeMs: 0
61
61
  ╰ Seeded Randomness (seeded-randomness): no findings
62
62
  ╰ Absolute Paths (absolute-file-paths):
63
63
  ╰ certain:
@@ -73,7 +73,7 @@ It offers a wide variety of features, for example:
73
73
  ╰ Roxygen Arguments (roxygen-arguments): no findings
74
74
  ╰ No Leaked Credentials (no-leaked-credentials): no findings
75
75
  ╰ Undefined Symbol (undefined-symbol): no findings
76
- All queries together required ≈9 ms (1ms accuracy, total 10 ms)
76
+ All queries together required ≈11 ms (1ms accuracy, total 11 ms)
77
77
  ```
78
78
 
79
79
 
@@ -95,12 +95,12 @@ It offers a wide variety of features, for example:
95
95
 
96
96
  _Results (prettified and summarized):_
97
97
 
98
- Query: **linter** (252 ms)\
98
+ Query: **linter** (3550 ms)\
99
99
     ╰ **Deprecated Functions** (deprecated-functions): _no findings_\
100
100
     ╰ **File Path Validity** (file-path-validity):\
101
101
         ╰ certain:\
102
102
             ╰ Path `/root/x.txt` at 1.1-23\
103
-        ╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 3, processTimeMs: 1\
103
+        ╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 4, processTimeMs: 1\
104
104
     ╰ **Seeded Randomness** (seeded-randomness): _no findings_\
105
105
     ╰ **Absolute Paths** (absolute-file-paths):\
106
106
         ╰ certain:\
@@ -116,11 +116,11 @@ It offers a wide variety of features, for example:
116
116
     ╰ **Roxygen Arguments** (roxygen-arguments): _no findings_\
117
117
     ╰ **No Leaked Credentials** (no-leaked-credentials): _no findings_\
118
118
     ╰ **Undefined Symbol** (undefined-symbol): _no findings_\
119
- _All queries together required ≈252 ms (1ms accuracy, total 254 ms)_
119
+ _All queries together required ≈3550 ms (1ms accuracy, total 3552 ms)_
120
120
 
121
121
  <details> <summary style="color:gray">Show Detailed Results as Json</summary>
122
122
 
123
- The analysis required _253.8 ms_ (including parsing and normalization and the query) within the generation environment.
123
+ The analysis required _3551.6 ms_ (including parsing and normalization and the query) within the generation environment.
124
124
 
125
125
  In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
126
126
  Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
@@ -137,8 +137,8 @@ It offers a wide variety of features, for example:
137
137
  ".meta": {
138
138
  "totalCalls": 0,
139
139
  "totalFunctionDefinitions": 0,
140
- "searchTimeMs": 52,
141
- "processTimeMs": 169
140
+ "searchTimeMs": 3,
141
+ "processTimeMs": 3514
142
142
  }
143
143
  },
144
144
  "file-path-validity": {
@@ -160,7 +160,7 @@ It offers a wide variety of features, for example:
160
160
  "totalUnknown": 0,
161
161
  "totalWritesBeforeAlways": 0,
162
162
  "totalValid": 0,
163
- "searchTimeMs": 3,
163
+ "searchTimeMs": 4,
164
164
  "processTimeMs": 1
165
165
  }
166
166
  },
@@ -172,7 +172,7 @@ It offers a wide variety of features, for example:
172
172
  "callsWithAssignmentProducers": 0,
173
173
  "callsWithNonConstantProducers": 0,
174
174
  "callsWithOtherBranchProducers": 0,
175
- "searchTimeMs": 1,
175
+ "searchTimeMs": 2,
176
176
  "processTimeMs": 0
177
177
  }
178
178
  },
@@ -209,7 +209,7 @@ It offers a wide variety of features, for example:
209
209
  ".meta": {
210
210
  "totalCalls": 0,
211
211
  "totalFunctionDefinitions": 0,
212
- "searchTimeMs": 0,
212
+ "searchTimeMs": 1,
213
213
  "processTimeMs": 1
214
214
  }
215
215
  },
@@ -226,7 +226,7 @@ It offers a wide variety of features, for example:
226
226
  "dead-code": {
227
227
  "results": [],
228
228
  ".meta": {
229
- "searchTimeMs": 0,
229
+ "searchTimeMs": 1,
230
230
  "processTimeMs": 0
231
231
  }
232
232
  },
@@ -241,7 +241,7 @@ It offers a wide variety of features, for example:
241
241
  "problematic-inputs": {
242
242
  "results": [],
243
243
  ".meta": {
244
- "searchTimeMs": 0,
244
+ "searchTimeMs": 1,
245
245
  "processTimeMs": 0
246
246
  }
247
247
  },
@@ -281,16 +281,16 @@ It offers a wide variety of features, for example:
281
281
  "subscript": 0
282
282
  },
283
283
  "searchTimeMs": 0,
284
- "processTimeMs": 20
284
+ "processTimeMs": 18
285
285
  }
286
286
  }
287
287
  },
288
288
  ".meta": {
289
- "timing": 252
289
+ "timing": 3550
290
290
  }
291
291
  },
292
292
  ".meta": {
293
- "timing": 252
293
+ "timing": 3550
294
294
  }
295
295
  }
296
296
  ```
@@ -354,7 +354,7 @@ It offers a wide variety of features, for example:
354
354
 
355
355
  ```shell
356
356
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
357
- flowR repl v2.13.12, R grammar v14 (tree-sitter engine)
357
+ flowR repl v2.13.14, R grammar v14 (tree-sitter engine)
358
358
  R> :query @static-slice (11@sum) file://test/testfiles/example.R
359
359
  ```
360
360
 
@@ -368,7 +368,7 @@ It offers a wide variety of features, for example:
368
368
  N <- 10
369
369
  for(i in 1:(N-1)) sum <- sum + i + w
370
370
  sum
371
- All queries together required ≈23 ms (1ms accuracy, total 24 ms)
371
+ All queries together required ≈10 ms (1ms accuracy, total 10 ms)
372
372
  ```
373
373
 
374
374
 
@@ -383,7 +383,7 @@ It offers a wide variety of features, for example:
383
383
  </details>
384
384
 
385
385
  * 🚀 **fast call-graph, data-, and control-flow graphs**\
386
- Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">81.7 ms</span></i> (as of Aug 10, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
386
+ Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">76.2 ms</span></i> (as of Aug 11, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
387
387
  _flowR_ can analyze the data- and control-flow of the average real-world R&nbsp;script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
388
388
  and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#perspectives-cg).
389
389
 
@@ -419,7 +419,7 @@ It offers a wide variety of features, for example:
419
419
 
420
420
  ```shell
421
421
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
422
- flowR repl v2.13.12, R grammar v14 (tree-sitter engine)
422
+ flowR repl v2.13.14, R grammar v14 (tree-sitter engine)
423
423
  R> :dataflow* test/testfiles/example.R
424
424
  ```
425
425
 
@@ -692,7 +692,7 @@ It offers a wide variety of features, for example:
692
692
  ```
693
693
 
694
694
 
695
- (The analysis required _2.6 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
695
+ (The analysis required _1.8 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
696
696
 
697
697
 
698
698
 
@@ -25,10 +25,8 @@ function resolveIdToArgName(id, info) {
25
25
  * Resolves the value of a function argument as string, number, boolean, or vector using {@link resolveIdToValue}
26
26
  */
27
27
  function resolveIdToArgValue(id, info) {
28
- const node = resolveIdToArgument(id, info);
29
- if (node?.value !== undefined) {
30
- const resolvedValue = (0, alias_tracking_1.resolveIdToValue)(node.value, info);
31
- const unliftedValue = (0, r_value_1.unliftRValue)(resolvedValue);
28
+ const unliftedValue = resolveArgToUnlifted(id, info);
29
+ if (unliftedValue !== undefined) {
32
30
  if (Array.isArray(unliftedValue)) {
33
31
  return (0, r_value_1.unwrapRVector)(unliftedValue);
34
32
  }
@@ -42,10 +40,8 @@ function resolveIdToArgValue(id, info) {
42
40
  * Resolves the value of a function argument to a string vector using {@link resolveIdToValue} and {@link unwrapRValueToString}
43
41
  */
44
42
  function resolveIdToArgStringVector(id, info) {
45
- const node = resolveIdToArgument(id, info);
46
- if (node?.value !== undefined) {
47
- const resolvedValue = (0, alias_tracking_1.resolveIdToValue)(node.value, info);
48
- const unliftedValue = (0, r_value_1.unliftRValue)(resolvedValue);
43
+ const unliftedValue = resolveArgToUnlifted(id, info);
44
+ if (unliftedValue !== undefined) {
49
45
  if (Array.isArray(unliftedValue)) {
50
46
  const array = unliftedValue.map(r_value_1.unwrapRValueToString);
51
47
  return array.every(assert_1.isNotUndefined) ? array : undefined;
@@ -74,10 +70,8 @@ function resolveIdToArgValueSymbolName(id, info) {
74
70
  * Resolves the vector length of the value of a function argument using {@link resolveIdToValue}
75
71
  */
76
72
  function resolveIdToArgVectorLength(id, info) {
77
- const node = resolveIdToArgument(id, info);
78
- if (node?.value !== undefined) {
79
- const resolvedValue = (0, alias_tracking_1.resolveIdToValue)(node.value, info);
80
- const unliftedValue = (0, r_value_1.unliftRValue)(resolvedValue);
73
+ const unliftedValue = resolveArgToUnlifted(id, info);
74
+ if (unliftedValue !== undefined) {
81
75
  if (Array.isArray(unliftedValue)) {
82
76
  return unliftedValue.length;
83
77
  }
@@ -87,6 +81,11 @@ function resolveIdToArgVectorLength(id, info) {
87
81
  }
88
82
  return undefined;
89
83
  }
84
+ /** The unlifted value of a function argument, `undefined` if the argument carries no value. */
85
+ function resolveArgToUnlifted(id, info) {
86
+ const node = resolveIdToArgument(id, info);
87
+ return node?.value !== undefined ? (0, r_value_1.unliftRValue)((0, alias_tracking_1.resolveIdToValue)(node.value, info)) : undefined;
88
+ }
90
89
  function resolveIdToArgument(id, { graph, idMap }) {
91
90
  idMap ??= graph?.idMap;
92
91
  const node = id === undefined || typeof id === 'object' ? id : idMap?.get(id);
@@ -1,7 +1,30 @@
1
1
  import type { UltimateSlicerStats } from '../data';
2
+ import type { MergeableRecord } from '../../../util/objects';
3
+ interface BenchmarkGraphEntry extends MergeableRecord {
4
+ name: string;
5
+ unit: string;
6
+ value: number;
7
+ range?: string;
8
+ extra?: string;
9
+ }
10
+ /**
11
+ * Whether an entry describes what the release *is* rather than how fast it *was*.
12
+ *
13
+ * The benchmark action compares every entry it uploads against the release before and calls a value that grew
14
+ * a regression. That is right for a runtime and wrong for a counter: a release with ten more linting rules or a
15
+ * larger signature database is not slower. Those entries are written to {@link infoGraphPath} instead and are
16
+ * uploaded under a suite of their own, where nothing alerts on them. The page merges the two back together.
17
+ *
18
+ * The failures are counters too, but a run that fails to re-parse more slices than the one before is exactly
19
+ * what an alert is for, so they stay with the measurements.
20
+ */
21
+ export declare function isInfoEntry({ name, unit }: Pick<BenchmarkGraphEntry, 'name' | 'unit'>): boolean;
22
+ /** where the counters of `path` go, next to it, so that one upload can alert and the other cannot */
23
+ export declare function infoGraphPath(path: string): string;
2
24
  /**
3
25
  * Write the graph output for the ultimate slicer stats to a file
4
26
  * @param ultimate - The ultimate slicer stats
5
27
  * @param outputGraphPath - The path to write the graph output to
6
28
  */
7
29
  export declare function writeGraphOutput(ultimate: UltimateSlicerStats, outputGraphPath: string): Promise<void>;
30
+ export {};
@@ -3,6 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isInfoEntry = isInfoEntry;
7
+ exports.infoGraphPath = infoGraphPath;
6
8
  exports.writeGraphOutput = writeGraphOutput;
7
9
  const fs_1 = __importDefault(require("fs"));
8
10
  const json_1 = require("../../../util/json");
@@ -13,11 +15,41 @@ function ms(nanoseconds) {
13
15
  return nanoseconds / 1e6;
14
16
  }
15
17
  /**
16
- * The median is a lot less sensitive to the load of the machine that produced the measurement than the mean,
17
- * hence we plot the median whenever there is one and only report the mean as additional information.
18
+ * Every plotted number is the mean, so that one series never mixes two statistics: a run that switches
19
+ * to the median steps up or down by the skew of the corpus, which reads as a change that never happened.
20
+ * The median travels along as additional information, see {@link plotExtra}.
18
21
  */
19
22
  function plotValue(measurement) {
20
- return Number.isFinite(measurement.median) ? measurement.median : measurement.mean;
23
+ return Number.isFinite(measurement.mean) ? measurement.mean : measurement.median;
24
+ }
25
+ /** the statistics a plotted mean is worth nothing without, stated on hover */
26
+ function plotExtra(measurement, digits = 2, scale = 1, unit = '') {
27
+ const say = (v) => (v * scale).toFixed(digits) + unit;
28
+ return `median: ${say(measurement.median)}, std: ${say(measurement.std)}`;
29
+ }
30
+ /**
31
+ * Whether an entry describes what the release *is* rather than how fast it *was*.
32
+ *
33
+ * The benchmark action compares every entry it uploads against the release before and calls a value that grew
34
+ * a regression. That is right for a runtime and wrong for a counter: a release with ten more linting rules or a
35
+ * larger signature database is not slower. Those entries are written to {@link infoGraphPath} instead and are
36
+ * uploaded under a suite of their own, where nothing alerts on them. The page merges the two back together.
37
+ *
38
+ * The failures are counters too, but a run that fails to re-parse more slices than the one before is exactly
39
+ * what an alert is for, so they stay with the measurements.
40
+ */
41
+ function isInfoEntry({ name, unit }) {
42
+ if (name.startsWith(SigDbPrefix)) {
43
+ return true; // the database ships with the release, its size is not this run being slow
44
+ }
45
+ if (unit === 'ms' || name.startsWith('memory')) {
46
+ return false; // a runtime or a size the analysis has to hold, both worth an alert
47
+ }
48
+ return unit === '#' && !/^(reduction|failed|times hit)/.test(name);
49
+ }
50
+ /** where the counters of `path` go, next to it, so that one upload can alert and the other cannot */
51
+ function infoGraphPath(path) {
52
+ return path.replace(/(\.json)?$/, m => '-info' + (m || '.json'));
21
53
  }
22
54
  function timeEntry(name, measurement) {
23
55
  if (!measurement?.mean || !measurement?.std) {
@@ -28,7 +60,7 @@ function timeEntry(name, measurement) {
28
60
  unit: 'ms',
29
61
  value: ms(plotValue(measurement)),
30
62
  range: String(ms(measurement.std)),
31
- extra: `mean: ${ms(measurement.mean).toFixed(2)}ms`
63
+ extra: plotExtra(measurement, 2, 1 / 1e6, 'ms')
32
64
  };
33
65
  }
34
66
  const SigDbPrefix = 'signature database';
@@ -166,7 +198,7 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
166
198
  unit: '#',
167
199
  value: plotValue(measurement),
168
200
  range: String(measurement.std),
169
- extra: `mean: ${measurement.mean.toFixed(2)}`
201
+ extra: plotExtra(measurement)
170
202
  });
171
203
  }
172
204
  }
@@ -194,7 +226,7 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
194
226
  name,
195
227
  unit: '#',
196
228
  value: measurement.total,
197
- extra: `mean: ${measurement.mean.toFixed(2)} per file`
229
+ extra: `mean: ${measurement.mean.toFixed(2)} per file, median: ${measurement.median.toFixed(2)}`
198
230
  });
199
231
  }
200
232
  data.push({
@@ -202,7 +234,7 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
202
234
  unit: 'KiB',
203
235
  value: plotValue(shapes.sizeOfInfo) / 1024,
204
236
  range: String(shapes.sizeOfInfo.std / 1024),
205
- extra: `mean: ${(shapes.sizeOfInfo.mean / 1024).toFixed(2)}`
237
+ extra: plotExtra(shapes.sizeOfInfo, 2, 1 / 1024, ' KiB')
206
238
  });
207
239
  }
208
240
  data.push({
@@ -228,7 +260,7 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
228
260
  name,
229
261
  unit: '#',
230
262
  value: plotValue(measurement),
231
- extra: `mean: ${measurement.mean.toFixed(4)}, std: ${measurement.std.toFixed(4)}`
263
+ extra: plotExtra(measurement, 4)
232
264
  });
233
265
  }
234
266
  }
@@ -236,13 +268,13 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
236
268
  name: 'reduction (characters)',
237
269
  unit: '#',
238
270
  value: plotValue(ultimate.reduction.numberOfCharacters),
239
- extra: `mean: ${ultimate.reduction.numberOfCharacters.mean.toFixed(4)}, std: ${ultimate.reduction.numberOfCharacters.std.toFixed(4)}`
271
+ extra: plotExtra(ultimate.reduction.numberOfCharacters, 4)
240
272
  });
241
273
  data.push({
242
274
  name: 'reduction (normalized tokens)',
243
275
  unit: '#',
244
276
  value: plotValue(ultimate.reduction.numberOfNormalizedTokens),
245
- extra: `mean: ${ultimate.reduction.numberOfNormalizedTokens.mean.toFixed(4)}, std: ${ultimate.reduction.numberOfNormalizedTokens.std.toFixed(4)}`
277
+ extra: plotExtra(ultimate.reduction.numberOfNormalizedTokens, 4)
246
278
  });
247
279
  if (ultimate.controlFlow) {
248
280
  data.push({
@@ -250,7 +282,7 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
250
282
  unit: 'KiB',
251
283
  value: plotValue(ultimate.controlFlow.sizeOfObject) / 1024,
252
284
  range: String(ultimate.controlFlow.sizeOfObject.std / 1024),
253
- extra: `mean: ${(ultimate.controlFlow.sizeOfObject.mean / 1024).toFixed(2)}`
285
+ extra: plotExtra(ultimate.controlFlow.sizeOfObject, 2, 1 / 1024, ' KiB')
254
286
  });
255
287
  }
256
288
  data.push({
@@ -258,11 +290,12 @@ async function writeGraphOutput(ultimate, outputGraphPath) {
258
290
  unit: 'KiB',
259
291
  value: plotValue(ultimate.dataflow.sizeOfObject) / 1024,
260
292
  range: String(ultimate.dataflow.sizeOfObject.std / 1024),
261
- extra: `mean: ${(ultimate.dataflow.sizeOfObject.mean / 1024).toFixed(2)}`
293
+ extra: plotExtra(ultimate.dataflow.sizeOfObject, 2, 1 / 1024, ' KiB')
262
294
  });
263
295
  // the database is a property of the release, not of a file, so it is counted once and comes last
264
296
  data.push(...signatureDatabaseEntries(await (0, sigdb_counts_1.countSignatureDatabase)()));
265
- // write the output file
266
- fs_1.default.writeFileSync(outputGraphPath, JSON.stringify(data, json_1.jsonReplacer));
297
+ /* the counters go into a file of their own, see infoGraphPath */
298
+ fs_1.default.writeFileSync(outputGraphPath, JSON.stringify(data.filter(e => !isInfoEntry(e)), json_1.jsonReplacer));
299
+ fs_1.default.writeFileSync(infoGraphPath(outputGraphPath), JSON.stringify(data.filter(isInfoEntry), json_1.jsonReplacer));
267
300
  }
268
301
  //# sourceMappingURL=graph.js.map
@@ -1,43 +1,11 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.controlflowBbStarCommand = exports.controlflowBbCommand = exports.controlflowStarCommand = exports.controlflowCommand = void 0;
37
4
  const cfg_1 = require("../../../util/mermaid/cfg");
38
5
  const ansi_1 = require("../../../util/text/ansi");
39
6
  const cfg_simplification_1 = require("../../../control-flow/cfg-simplification");
40
7
  const core_1 = require("../core");
8
+ const repl_clipboard_1 = require("./repl-clipboard");
41
9
  function formatInfo(out, type) {
42
10
  return out.formatter.format(`Copied ${type} to clipboard.`, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground, style: 3 /* FontStyles.Italic */ });
43
11
  }
@@ -45,15 +13,7 @@ async function produceAndPrintCfg(analyzer, output, simplifications, cfgConverte
45
13
  const cfg = await analyzer.controlflow([...cfg_simplification_1.DefaultCfgSimplificationOrder, ...simplifications]);
46
14
  const normalizedAst = await analyzer.normalize();
47
15
  const mermaid = cfgConverter(cfg, normalizedAst);
48
- output.stdout(mermaid);
49
- if (output.allowClipboard !== false) {
50
- try {
51
- const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
52
- clipboard.default.writeSync(mermaid);
53
- output.stdout(formatInfo(output, 'mermaid code'));
54
- }
55
- catch { /* do nothing this is a service thing */ }
56
- }
16
+ await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid code'));
57
17
  }
58
18
  exports.controlflowCommand = {
59
19
  description: 'Get mermaid code for the control-flow graph of R code',
@@ -0,0 +1,7 @@
1
+ import type { ReplOutput } from './repl-main';
2
+ /** Output that the user most likely wants on their clipboard as well. */
3
+ export declare const ReplClipboard: {
4
+ readonly name: "ReplClipboard";
5
+ /** Prints `text` and, if the output allows it, copies it to the clipboard and reports `note` afterwards. */
6
+ readonly print: (this: void, output: ReplOutput, text: string, note: string) => Promise<void>;
7
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ReplClipboard = void 0;
37
+ /** Output that the user most likely wants on their clipboard as well. */
38
+ exports.ReplClipboard = {
39
+ name: 'ReplClipboard',
40
+ /** Prints `text` and, if the output allows it, copies it to the clipboard and reports `note` afterwards. */
41
+ async print(output, text, note) {
42
+ output.stdout(text);
43
+ if (output.allowClipboard !== false) {
44
+ try {
45
+ const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
46
+ clipboard.default.writeSync(text);
47
+ output.stdout(note);
48
+ }
49
+ catch { /* do nothing this is a service thing */ }
50
+ }
51
+ }
52
+ };
53
+ //# sourceMappingURL=repl-clipboard.js.map
@@ -1,41 +1,9 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.dataflowSimpleStarCommand = exports.dataflowSimplifiedCommand = exports.dataflowSilentCommand = exports.dataflowAsciiCommand = exports.dataflowStarCommand = exports.dataflowCommand = void 0;
37
4
  const ansi_1 = require("../../../util/text/ansi");
38
5
  const core_1 = require("../core");
6
+ const repl_clipboard_1 = require("./repl-clipboard");
39
7
  const vertex_1 = require("../../../dataflow/graph/vertex");
40
8
  const dfg_ascii_1 = require("../../../util/simple-df/dfg-ascii");
41
9
  const df_helper_1 = require("../../../dataflow/graph/df-helper");
@@ -89,16 +57,7 @@ exports.dataflowCommand = {
89
57
  fn: async ({ output, analyzer }) => {
90
58
  const result = await analyzer.dataflow();
91
59
  const mermaid = df_helper_1.Dataflow.visualize.mermaid.convert({ graph: result.graph, includeEnvironments: false, qualifyBaseR: (0, config_1.isSigDbEnabled)(analyzer.flowrConfig) }).string;
92
- output.stdout(mermaid);
93
- if (output.allowClipboard !== false) {
94
- try {
95
- const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
96
- clipboard.default.writeSync(mermaid);
97
- output.stdout(formatInfo(output, 'mermaid code', result));
98
- }
99
- catch { /* do nothing this is a service thing */
100
- }
101
- }
60
+ await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid code', result));
102
61
  }
103
62
  };
104
63
  exports.dataflowStarCommand = {
@@ -111,15 +70,7 @@ exports.dataflowStarCommand = {
111
70
  fn: async ({ output, analyzer }) => {
112
71
  const result = await analyzer.dataflow();
113
72
  const mermaid = df_helper_1.Dataflow.visualize.mermaid.url(result.graph, false, undefined, false, (0, config_1.isSigDbEnabled)(analyzer.flowrConfig));
114
- output.stdout(mermaid);
115
- if (output.allowClipboard !== false) {
116
- try {
117
- const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
118
- clipboard.default.writeSync(mermaid);
119
- output.stdout(formatInfo(output, 'mermaid url', result));
120
- }
121
- catch { /* do nothing this is a service thing */ }
122
- }
73
+ await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid url', result));
123
74
  }
124
75
  };
125
76
  exports.dataflowAsciiCommand = {
@@ -174,15 +125,7 @@ exports.dataflowSimplifiedCommand = {
174
125
  fn: async ({ output, analyzer }) => {
175
126
  const result = await analyzer.dataflow();
176
127
  const mermaid = df_helper_1.Dataflow.visualize.mermaid.convert({ graph: result.graph, includeEnvironments: false, simplified: true, qualifyBaseR: (0, config_1.isSigDbEnabled)(analyzer.flowrConfig) }).string;
177
- output.stdout(mermaid);
178
- if (output.allowClipboard !== false) {
179
- try {
180
- const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
181
- clipboard.default.writeSync(mermaid);
182
- output.stdout(formatInfo(output, 'mermaid code', result));
183
- }
184
- catch { /* do nothing this is a service thing */ }
185
- }
128
+ await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid code', result));
186
129
  }
187
130
  };
188
131
  exports.dataflowSimpleStarCommand = {
@@ -195,15 +138,7 @@ exports.dataflowSimpleStarCommand = {
195
138
  fn: async ({ output, analyzer }) => {
196
139
  const result = await analyzer.dataflow();
197
140
  const mermaid = df_helper_1.Dataflow.visualize.mermaid.url(result.graph, false, undefined, true, (0, config_1.isSigDbEnabled)(analyzer.flowrConfig));
198
- output.stdout(mermaid);
199
- if (output.allowClipboard !== false) {
200
- try {
201
- const clipboard = await Promise.resolve().then(() => __importStar(require('clipboardy')));
202
- clipboard.default.writeSync(mermaid);
203
- output.stdout(formatInfo(output, 'mermaid url', result));
204
- }
205
- catch { /* do nothing this is a service thing */ }
206
- }
141
+ await repl_clipboard_1.ReplClipboard.print(output, mermaid, formatInfo(output, 'mermaid url', result));
207
142
  }
208
143
  };
209
144
  //# sourceMappingURL=repl-dataflow.js.map