@appland/scanner 1.84.1 → 1.86.0
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,17 @@
|
|
|
1
|
+
# [@appland/scanner-v1.86.0](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.85.0...@appland/scanner-v1.86.0) (2023-12-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Update @appland/client in @appland/appmap ([953872f](https://github.com/getappmap/appmap-js/commit/953872f398b856348a5897929a08f0e695a5ec81))
|
|
7
|
+
|
|
8
|
+
# [@appland/scanner-v1.85.0](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.84.1...@appland/scanner-v1.85.0) (2023-12-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Scanner rule for unfulfilled promises ([df6afe8](https://github.com/getappmap/appmap-js/commit/df6afe8e2cbc1f677ad1313309fb365971806204)), closes [#1477](https://github.com/getappmap/appmap-js/issues/1477)
|
|
14
|
+
|
|
1
15
|
# [@appland/scanner-v1.84.1](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.84.0...@appland/scanner-v1.84.1) (2023-11-08)
|
|
2
16
|
|
|
3
17
|
|
package/LICENSE.txt
CHANGED
|
@@ -12,7 +12,7 @@ Software: @appland/scanner
|
|
|
12
12
|
|
|
13
13
|
License: MIT License
|
|
14
14
|
|
|
15
|
-
Copyright
|
|
15
|
+
Copyright 2023, AppLand Inc
|
|
16
16
|
|
|
17
17
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
|
18
18
|
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const parseRuleDescription_1 = __importDefault(require("./lib/parseRuleDescription"));
|
|
7
|
+
const id = 'unfulfilled-promise';
|
|
8
|
+
const RULE = {
|
|
9
|
+
id,
|
|
10
|
+
title: 'Unfulfilled Promise',
|
|
11
|
+
description: (0, parseRuleDescription_1.default)(id),
|
|
12
|
+
enumerateScope: true,
|
|
13
|
+
build: () => ({ matcher: (e) => { var _a; return ((_a = e.returnValue) === null || _a === void 0 ? void 0 : _a.value) === 'Promise { <pending> }'; } }),
|
|
14
|
+
};
|
|
15
|
+
exports.default = RULE;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
rule: unfulfilled-promise
|
|
3
|
+
name: Unfulfilled promise
|
|
4
|
+
title: Unfulfilled Promise
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Finds promises which have been created during the recording but have remained unfulfilled at the
|
|
8
|
+
end.
|
|
9
|
+
|
|
10
|
+
### Rule logic
|
|
11
|
+
|
|
12
|
+
The rule simply looks for return events with value of `Promise { <pending> }` without a subsequent
|
|
13
|
+
update.
|
|
14
|
+
|
|
15
|
+
### Notes
|
|
16
|
+
|
|
17
|
+
`Promise { <pending> }` is a special value used by the appmap-node agent to represent promises that
|
|
18
|
+
haven't been fulfilled yet. Normally, once the promise is fulfilled, an event update is added to the
|
|
19
|
+
AppMap with the resolved value and total elapsed run time.
|
|
20
|
+
|
|
21
|
+
However, if a promise remains unfulfilled when the recording ends (for example when a HTTP response
|
|
22
|
+
is sent or a test case finishes) this pending state is never updated.
|
|
23
|
+
|
|
24
|
+
Most of the time it means some asynchronous computation has been started and its results not awaited
|
|
25
|
+
for and therefore not collected; such computations should be removed or the results awaited.
|
|
26
|
+
|
|
27
|
+
In some cases this is an intended behaviour; for example, a background book-keeping or cleanup
|
|
28
|
+
process might be started which doesn't directly impact the results of the operation that triggered
|
|
29
|
+
it. Note that during testing such processes should still run to completion before a test case
|
|
30
|
+
finishes (or else be suppressed altogether); otherwise there might be unintended interference
|
|
31
|
+
between test cases leading to brittle tests. Each test case should start from a known, clean and
|
|
32
|
+
quiescent environment.
|
|
33
|
+
|
|
34
|
+
### Resolution
|
|
35
|
+
|
|
36
|
+
Identify where the promise is created and make sure to `await` on it. Even when the result is void,
|
|
37
|
+
some other part of the program might assume the asynchronous computation has completed. Without
|
|
38
|
+
awaiting it at that point a race condition can result, leading to intermittent stability issues.
|
|
39
|
+
|
|
40
|
+
### Options
|
|
41
|
+
|
|
42
|
+
None
|
|
43
|
+
|
|
44
|
+
### Examples
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
- rule: unfulfilledPromise
|
|
48
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appland/scanner",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.86.0",
|
|
4
4
|
"description": "Analyze AppMaps for code flaws",
|
|
5
5
|
"bin": "built/cli.js",
|
|
6
6
|
"main": "built/index.js",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"typescript": "^4.4.2"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@appland/client": "^1.
|
|
66
|
-
"@appland/models": "^2.
|
|
65
|
+
"@appland/client": "^1.12.0",
|
|
66
|
+
"@appland/models": "^2.10.0",
|
|
67
67
|
"@appland/openapi": "^1.7.0",
|
|
68
68
|
"@appland/sql-parser": "^1.5.0",
|
|
69
69
|
"@types/cli-progress": "^3.9.2",
|