@antelopejs/dms 0.20.6 → 0.20.8-next.916.gd319141
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 +14 -0
- package/bin/control/commands-verify.mjs +8 -49
- package/bin/control/options.mjs +0 -1
- package/bin/control/run-state.mjs +1 -1
- package/bin/control/timing.mjs +1 -16
- package/bin/control/timing.test.mjs +0 -11
- package/bin/control/verify/decode.mjs +4 -144
- package/bin/control/verify/decode.test.mjs +1 -149
- package/bin/control/verify/formal.mjs +22 -218
- package/bin/control/verify/formal.test.mjs +60 -117
- package/bin/control/verify/map.test.mjs +0 -73
- package/bin/control/verify/types.mjs +4 -18
- package/bin/dms-control.mjs +0 -2
- package/dist/implementations/dms/page/controller.d.ts +2 -1
- package/dist/implementations/dms/page/controller.js.map +1 -1
- package/dist/implementations/dms-builder/engine/configure-target.d.ts +8 -0
- package/dist/implementations/dms-builder/engine/configure-target.js +36 -0
- package/dist/implementations/dms-builder/engine/configure-target.js.map +1 -0
- package/dist/implementations/dms-builder/engine/connection-access-config.js +2 -2
- package/dist/implementations/dms-builder/engine/connection-targets.js.map +1 -1
- package/dist/implementations/dms-builder/engine/database-access.d.ts +1 -1
- package/dist/implementations/dms-builder/engine/database-access.js +2 -2
- package/dist/implementations/dms-builder/engine/database-check-input.d.ts +3 -2
- package/dist/implementations/dms-builder/engine/database-check-input.js.map +1 -1
- package/dist/implementations/dms-builder/engine/database-check.js +2 -2
- package/dist/implementations/dms-builder/engine/database-check.js.map +1 -1
- package/dist/implementations/dms-builder/engine/index.d.ts +1 -0
- package/dist/implementations/dms-builder/engine/index.js +1 -0
- package/dist/implementations/dms-builder/engine/index.js.map +1 -1
- package/dist/implementations/dms-builder/engine/probe-answer.d.ts +44 -1
- package/dist/implementations/dms-builder/engine/probe-answer.js +2 -5
- package/dist/implementations/dms-builder/engine/probe-answer.js.map +1 -1
- package/dist/mcp/tools/builder-compose.js +19 -3
- package/dist/mcp/tools/builder-compose.js.map +1 -1
- package/dist/mcp/tools/builder-pages.js +68 -6
- package/dist/mcp/tools/builder-pages.js.map +1 -1
- package/dist/mcp/tools/builder-request-targets.d.ts +14 -0
- package/dist/mcp/tools/builder-request-targets.js +256 -0
- package/dist/mcp/tools/builder-request-targets.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +1 -0
- package/dist/mcp/tools/index.js +3 -1
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/mockup-apply-to-page.d.ts +2 -0
- package/dist/mcp/tools/mockup-apply-to-page.js +15 -1
- package/dist/mcp/tools/mockup-apply-to-page.js.map +1 -1
- package/dist/mockup/apply-to-page.d.ts +1 -0
- package/dist/mockup/apply-to-page.js +3 -2
- package/dist/mockup/apply-to-page.js.map +1 -1
- package/dist/mockup/compile.js +7 -1
- package/dist/mockup/compile.js.map +1 -1
- package/dist/mockup/files.d.ts +1 -1
- package/dist/mockup/files.js +2 -2
- package/dist/mockup/sample-routes.d.ts +3 -0
- package/dist/mockup/sample-routes.js +53 -0
- package/dist/mockup/sample-routes.js.map +1 -0
- package/dist/pages/settings/users/roles.js.map +1 -1
- package/dist/store/internal/frontend/frontend-ready.d.ts +2 -1
- package/dist/store/internal/frontend/frontend-ready.js.map +1 -1
- package/dist/store/operations.js +4 -4
- package/dist/store/operations.js.map +1 -1
- package/dist/utils/upload-constraints.d.ts +1 -1
- package/dist/utils/upload-constraints.js +2 -2
- package/dist/utils/upload-constraints.js.map +1 -1
- package/dist/validation/issue-message.d.ts +1 -1
- package/dist/validation/issue-message.js +3 -3
- package/dist/validation/issue-message.js.map +1 -1
- package/frontend-vue/layers/dms-core/app/utils/formatter.ts +1 -0
- package/frontend-vue/layers/dms-layout/app/build/composables/navigation/useVisitNavBadges.ts +11 -14
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/security/useSecurityFormat.ts +5 -5
- package/frontend-vue/layers/dms-layout/app/build/utils/modules-catalog.ts +7 -2
- package/frontend-vue/layers/dms-layout/app/build/utils/notificationPayload.ts +9 -5
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleHistory.ts +4 -1
- package/frontend-vue/layers/dms-layout/app/composables/page/useModulesListing.ts +7 -17
- package/frontend-vue/layers/dms-layout/app/custom-pages/modules.vue +5 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +17 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +9 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupCatalog.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +18 -16
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +8 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/containers/drawerSize.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationBadges.ts +2 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldComponentProps.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/layout/sidePanelState.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/period/periodQuery.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionValues.ts +13 -13
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/writeError.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupThumbnail.vue +6 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +26 -18
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +7 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/previewFixturesOnly.ts +82 -0
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +10 -1
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +2 -0
- package/frontend-vue/layers/dms-ui/app/composables/form/useUploadWithProgress.ts +6 -1
- package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +2 -2
- package/package.json +32 -30
- package/skills/dms-project/scripts/dms-dev.sh +0 -0
- package/bin/control/verify/behaviour.mjs +0 -183
- package/bin/control/verify/behaviour.test.mjs +0 -472
- package/bin/control/verify/emit.mjs +0 -539
- package/bin/control/verify/judgement.mjs +0 -101
- package/bin/control/verify/verdict.mjs +0 -327
- package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +0 -23
- package/frontend-vue/scripts/probes/frontend-behavior.cjs +0 -606
- package/frontend-vue/scripts/probes/frontend-legacy.cjs +0 -620
- package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +0 -322
- package/frontend-vue/scripts/prove-comment-emit.mjs +0 -171
- package/frontend-vue/scripts/prove-component-registration.mjs +0 -259
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.20.7
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.20.6...v0.20.7)
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- **dms:** Refuse a builder block that sends requests outside its page's data API ([#1074](https://github.com/AntelopeJS/dms/pull/1074))
|
|
10
|
+
- **dms:** Keep a mockup's sample tree off live routes ([#1075](https://github.com/AntelopeJS/dms/pull/1075))
|
|
11
|
+
- **dms:** Judge mockup_apply_to_page writes and drop x-dms-ui- headers from uploads ([#1076](https://github.com/AntelopeJS/dms/pull/1076))
|
|
12
|
+
|
|
13
|
+
### ❤️ Contributors
|
|
14
|
+
|
|
15
|
+
- Antony Rizzitelli ([@Upd4ting](http://github.com/Upd4ting))
|
|
16
|
+
|
|
3
17
|
## v0.20.6
|
|
4
18
|
|
|
5
19
|
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.20.5...v0.20.6)
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { print } from "./commands-stack.mjs";
|
|
3
3
|
import { runJourneyFile } from "./journey.mjs";
|
|
4
|
-
import { loadRun
|
|
4
|
+
import { loadRun } from "./run-state.mjs";
|
|
5
5
|
import { timed } from "./timing.mjs";
|
|
6
6
|
import { doorLine, flaggedDoors, patchFiles } from "./verify/doors.mjs";
|
|
7
|
-
import {
|
|
8
|
-
formalGate,
|
|
9
|
-
runFormalCheck,
|
|
10
|
-
touchedFormalChecks,
|
|
11
|
-
} from "./verify/formal.mjs";
|
|
12
|
-
import { readJudgement } from "./verify/judgement.mjs";
|
|
7
|
+
import { runFormalCheck, touchedFormalChecks } from "./verify/formal.mjs";
|
|
13
8
|
import { checkMap, planFor } from "./verify/map.mjs";
|
|
14
9
|
import { journeysFile, loadSkill } from "./verify/skill.mjs";
|
|
15
|
-
import { renderVerdict } from "./verify/verdict.mjs";
|
|
16
10
|
|
|
17
11
|
/**
|
|
18
12
|
* @typedef {import("./options.mjs").Values} Values
|
|
@@ -108,64 +102,31 @@ async function commandFormal(dir, values) {
|
|
|
108
102
|
const plan = planFor(skill, state.baseRef);
|
|
109
103
|
const touched = touchedFormalChecks(skill, plan.changed);
|
|
110
104
|
const checks = values.all ? skill.config.formal : touched;
|
|
111
|
-
const diff = {
|
|
112
|
-
baseSha: plan.baseSha,
|
|
113
|
-
headSha: plan.headSha,
|
|
114
|
-
changed: plan.changed,
|
|
115
|
-
};
|
|
116
105
|
for (const check of checks) {
|
|
117
|
-
const gate = touched.includes(check);
|
|
118
106
|
const result = await timed(
|
|
119
107
|
state,
|
|
120
108
|
"formal",
|
|
121
|
-
() => runFormalCheck(skill, state, check
|
|
109
|
+
() => runFormalCheck(skill, state, check),
|
|
122
110
|
{ check: check.name },
|
|
123
111
|
);
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
? weight.fails
|
|
127
|
-
? "FAIL"
|
|
128
|
-
: "PASS"
|
|
129
|
-
: result.violated.length > 0
|
|
112
|
+
const outcome =
|
|
113
|
+
result.violated.length > 0
|
|
130
114
|
? "VIOLATED"
|
|
131
115
|
: result.exitCode === 0
|
|
132
116
|
? "HOLDS"
|
|
133
117
|
: "ERROR";
|
|
118
|
+
const scope = touched.includes(check) ? "" : " (does not cover the diff)";
|
|
134
119
|
print(
|
|
135
|
-
`${outcome} ${check.name}: ${
|
|
120
|
+
`${outcome} ${check.name}: ${result.violated.join(", ") || "no violated rule"}${scope} (exit ${result.exitCode})`,
|
|
136
121
|
);
|
|
137
122
|
}
|
|
138
123
|
if (checks.length === 0) print("no formal check covers the diff");
|
|
139
124
|
return 0;
|
|
140
125
|
}
|
|
141
126
|
|
|
142
|
-
/**
|
|
143
|
-
* @param {string} dir The run root
|
|
144
|
-
* @param {Values} values The options of the command line
|
|
145
|
-
* @returns {Promise<number>} The exit code
|
|
146
|
-
*/
|
|
147
|
-
async function commandVerdict(dir, values) {
|
|
148
|
-
const pr = Number(values.pr);
|
|
149
|
-
if (!Number.isInteger(pr) || pr <= 0) {
|
|
150
|
-
print("verdict needs --pr <number>");
|
|
151
|
-
return 2;
|
|
152
|
-
}
|
|
153
|
-
const state = readRun(dir);
|
|
154
|
-
const skill = await skillOf(values, state);
|
|
155
|
-
const verdict = await renderVerdict(
|
|
156
|
-
skill,
|
|
157
|
-
state,
|
|
158
|
-
pr,
|
|
159
|
-
readJudgement(skill, join(state.evidence, "judgement.json")),
|
|
160
|
-
values.all,
|
|
161
|
-
);
|
|
162
|
-
print(verdict.markdown);
|
|
163
|
-
return verdict.result === "FAIL" ? 1 : 0;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
127
|
/**
|
|
167
128
|
* Runs a command of the verification harness: `map`, `plan`, `journey`,
|
|
168
|
-
* `doors
|
|
129
|
+
* `doors` and `formal`.
|
|
169
130
|
*
|
|
170
131
|
* @param {string} command The command
|
|
171
132
|
* @param {string[]} rest Its positional arguments
|
|
@@ -184,8 +145,6 @@ export function runVerifyCommand(command, rest, values) {
|
|
|
184
145
|
return commandDoors(rest[0], values);
|
|
185
146
|
case "formal":
|
|
186
147
|
return commandFormal(rest[0], values);
|
|
187
|
-
case "verdict":
|
|
188
|
-
return commandVerdict(rest[0], values);
|
|
189
148
|
default:
|
|
190
149
|
return Promise.resolve(undefined);
|
|
191
150
|
}
|
package/bin/control/options.mjs
CHANGED
|
@@ -216,7 +216,7 @@ const isStoredRun = objectOf(
|
|
|
216
216
|
* creates or reads that folder. An account that `down` left without its
|
|
217
217
|
* `password` reads with an empty one. Only a command that never reads,
|
|
218
218
|
* starts, signals or forgets a process the run recorded opens its run here:
|
|
219
|
-
* `mail`, `timings`, `api
|
|
219
|
+
* `mail`, `timings`, `api` and `onboard`. Every other command
|
|
220
220
|
* opens it with {@link loadRun}.
|
|
221
221
|
*
|
|
222
222
|
* @param {string} dir The run root, as `up` printed it
|
package/bin/control/timing.mjs
CHANGED
|
@@ -181,7 +181,7 @@ export function summarize(entries) {
|
|
|
181
181
|
* @param {number} ms A duration
|
|
182
182
|
* @returns {string} It in seconds with one decimal
|
|
183
183
|
*/
|
|
184
|
-
|
|
184
|
+
function formatSeconds(ms) {
|
|
185
185
|
return (ms / MS_PER_SECOND).toFixed(1);
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -227,18 +227,3 @@ export function formatTimings(summary) {
|
|
|
227
227
|
)
|
|
228
228
|
.join("\n");
|
|
229
229
|
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* The summary as the Markdown table of the verdict's Timing section.
|
|
233
|
-
*
|
|
234
|
-
* @param {TimingSummary} summary The summary
|
|
235
|
-
* @returns {string[]} The lines of the table
|
|
236
|
-
*/
|
|
237
|
-
export function markdownTimings(summary) {
|
|
238
|
-
const [header, ...body] = cellsOf(summary);
|
|
239
|
-
return [
|
|
240
|
-
`| ${header.join(" | ")} |`,
|
|
241
|
-
`|${header.map(() => "---").join("|")}|`,
|
|
242
|
-
...body.map((row) => `| ${row.join(" | ")} |`),
|
|
243
|
-
];
|
|
244
|
-
}
|
|
@@ -5,7 +5,6 @@ import { join } from "node:path";
|
|
|
5
5
|
import test from "node:test";
|
|
6
6
|
import {
|
|
7
7
|
formatTimings,
|
|
8
|
-
markdownTimings,
|
|
9
8
|
readTimings,
|
|
10
9
|
summarize,
|
|
11
10
|
timed,
|
|
@@ -121,16 +120,6 @@ await test("the plain table aligns its columns and ends with the total line", ()
|
|
|
121
120
|
);
|
|
122
121
|
});
|
|
123
122
|
|
|
124
|
-
await test("the Markdown table has the same cells as the plain one", () => {
|
|
125
|
-
const summary = summarize([entry("up", 2000, "00")]);
|
|
126
|
-
assert.deepEqual(markdownTimings(summary), [
|
|
127
|
-
"| phase | count | total s | median ms | max ms |",
|
|
128
|
-
"|---|---|---|---|---|",
|
|
129
|
-
"| up | 1 | 2.0 | 2000 | 2000 |",
|
|
130
|
-
"| total | | 2.0 | | |",
|
|
131
|
-
]);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
123
|
await test("timed records the phase and returns what the action returned", async (t) => {
|
|
135
124
|
const run = scratchRun(t);
|
|
136
125
|
const value = await timed(run, "mail", () => 7, { step: "01-open" });
|
|
@@ -1,121 +1,23 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
1
|
import {
|
|
3
2
|
arrayOf,
|
|
4
3
|
decode,
|
|
5
|
-
either,
|
|
6
4
|
instanceOf,
|
|
7
|
-
isBoolean,
|
|
8
|
-
isNumber,
|
|
9
5
|
isString,
|
|
10
6
|
nullable,
|
|
11
|
-
oneOf,
|
|
12
7
|
recordOf,
|
|
13
8
|
objectOf,
|
|
14
9
|
} from "../json.mjs";
|
|
15
10
|
|
|
16
11
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* that does not match is refused with an error that names where it was read.
|
|
12
|
+
* Guard for the JSON the verification harness reads back, the skill's
|
|
13
|
+
* config. It is checked against the typedef it narrows to, and a value that
|
|
14
|
+
* does not match is refused with an error that names where it was read.
|
|
21
15
|
*
|
|
22
16
|
* @typedef {import("../json.mjs").Guard<unknown>} AnyGuard
|
|
23
17
|
*/
|
|
24
18
|
|
|
25
19
|
const strings = arrayOf(isString);
|
|
26
20
|
|
|
27
|
-
const rules = objectOf({
|
|
28
|
-
exitCode: nullable(isNumber),
|
|
29
|
-
violated: strings,
|
|
30
|
-
passing: strings,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
/** @type {import("../json.mjs").Guard<import("./types.mjs").FormalResult>} The result `runFormalCheck` records in `result.json` */
|
|
34
|
-
export const isFormalResult = objectOf(
|
|
35
|
-
{
|
|
36
|
-
name: isString,
|
|
37
|
-
exitCode: nullable(isNumber),
|
|
38
|
-
violated: strings,
|
|
39
|
-
passing: strings,
|
|
40
|
-
folder: isString,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
commits: objectOf({ baseSha: isString, headSha: isString }),
|
|
44
|
-
behaviour: objectOf({
|
|
45
|
-
method: isString,
|
|
46
|
-
changed: isBoolean,
|
|
47
|
-
removed: strings,
|
|
48
|
-
added: strings,
|
|
49
|
-
}),
|
|
50
|
-
checkChanged: isBoolean,
|
|
51
|
-
base: nullable(rules),
|
|
52
|
-
fixed: strings,
|
|
53
|
-
dropped: strings,
|
|
54
|
-
missing: strings,
|
|
55
|
-
},
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
/** @type {import("../json.mjs").Guard<import("./types.mjs").FeatureResult[]>} The journey results a run records in `<feature>/feature.json` */
|
|
59
|
-
const isFeatureResults = arrayOf(
|
|
60
|
-
objectOf(
|
|
61
|
-
{
|
|
62
|
-
feature: isString,
|
|
63
|
-
journey: isString,
|
|
64
|
-
title: isString,
|
|
65
|
-
entryPoint: isString,
|
|
66
|
-
status: oneOf(["PASS", "FAIL"]),
|
|
67
|
-
database: isString,
|
|
68
|
-
steps: arrayOf(
|
|
69
|
-
objectOf({
|
|
70
|
-
name: isString,
|
|
71
|
-
checks: arrayOf(
|
|
72
|
-
objectOf({ name: isString, pass: isBoolean, detail: isString }),
|
|
73
|
-
),
|
|
74
|
-
}),
|
|
75
|
-
),
|
|
76
|
-
error: nullable(isString),
|
|
77
|
-
folder: isString,
|
|
78
|
-
},
|
|
79
|
-
{ ms: isNumber },
|
|
80
|
-
),
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
/** @type {import("../json.mjs").Guard<import("./types.mjs").RawJudgement>} The verifier's `judgement.json` */
|
|
84
|
-
export const isRawJudgement = objectOf(
|
|
85
|
-
{},
|
|
86
|
-
{
|
|
87
|
-
verifier: isString,
|
|
88
|
-
notVerified: strings,
|
|
89
|
-
attention: strings,
|
|
90
|
-
docs: arrayOf(
|
|
91
|
-
objectOf({ page: isString }, { matches: isBoolean, note: isString }),
|
|
92
|
-
),
|
|
93
|
-
doors: objectOf(
|
|
94
|
-
{},
|
|
95
|
-
{
|
|
96
|
-
none: isString,
|
|
97
|
-
rows: arrayOf(
|
|
98
|
-
objectOf(
|
|
99
|
-
{},
|
|
100
|
-
{
|
|
101
|
-
kind: isString,
|
|
102
|
-
location: isString,
|
|
103
|
-
irreversible: isString,
|
|
104
|
-
containment: isString,
|
|
105
|
-
},
|
|
106
|
-
),
|
|
107
|
-
),
|
|
108
|
-
falsePositives: arrayOf(
|
|
109
|
-
objectOf(
|
|
110
|
-
{},
|
|
111
|
-
{ kind: isString, location: isString, reason: isString },
|
|
112
|
-
),
|
|
113
|
-
),
|
|
114
|
-
},
|
|
115
|
-
),
|
|
116
|
-
},
|
|
117
|
-
);
|
|
118
|
-
|
|
119
21
|
const isRegexOrNull = nullable(instanceOf(RegExp));
|
|
120
22
|
|
|
121
23
|
const isFormalCheck = objectOf(
|
|
@@ -124,16 +26,8 @@ const isFormalCheck = objectOf(
|
|
|
124
26
|
covers: strings,
|
|
125
27
|
command: strings,
|
|
126
28
|
violation: isRegexOrNull,
|
|
127
|
-
passing: isRegexOrNull,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
files: strings,
|
|
131
|
-
baseCommand: strings,
|
|
132
|
-
behaviour: either(
|
|
133
|
-
objectOf({ kind: oneOf(["emit"]) }),
|
|
134
|
-
objectOf({ kind: oneOf(["probe"]), command: strings }),
|
|
135
|
-
),
|
|
136
29
|
},
|
|
30
|
+
{ files: strings },
|
|
137
31
|
);
|
|
138
32
|
|
|
139
33
|
const isDoorRule = objectOf({
|
|
@@ -181,37 +75,3 @@ export function decodeSkillConfig(exported, source) {
|
|
|
181
75
|
notShared: config.notShared ?? [],
|
|
182
76
|
};
|
|
183
77
|
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* @param {unknown} stored What `result.json` holds
|
|
187
|
-
* @param {string} source The file
|
|
188
|
-
* @returns {import("./types.mjs").FormalResult} The result
|
|
189
|
-
* @throws When the value is not a formal check result
|
|
190
|
-
*/
|
|
191
|
-
export function decodeFormalResult(stored, source) {
|
|
192
|
-
return decode(isFormalResult, stored, source, "a formal check result");
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* @param {unknown} stored What `judgement.json` holds
|
|
197
|
-
* @param {string} source The file
|
|
198
|
-
* @returns {import("./types.mjs").RawJudgement} The judgement
|
|
199
|
-
* @throws When the value is not a judgement
|
|
200
|
-
*/
|
|
201
|
-
export function decodeRawJudgement(stored, source) {
|
|
202
|
-
return decode(isRawJudgement, stored, source, "a verifier's judgement");
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* The journey results a run recorded for a feature.
|
|
207
|
-
*
|
|
208
|
-
* @param {string} file The feature's `feature.json`
|
|
209
|
-
* @returns {import("./types.mjs").FeatureResult[]} The results, none when the journeys did not run
|
|
210
|
-
* @throws When the file is not a list of journey results
|
|
211
|
-
*/
|
|
212
|
-
export function readFeatureResults(file) {
|
|
213
|
-
if (!existsSync(file)) return [];
|
|
214
|
-
/** @type {unknown} */
|
|
215
|
-
const stored = JSON.parse(readFileSync(file, "utf8"));
|
|
216
|
-
return decode(isFeatureResults, stored, file, "a list of journey results");
|
|
217
|
-
}
|
|
@@ -4,9 +4,6 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import test from "node:test";
|
|
7
|
-
import { readFeatureResults } from "./decode.mjs";
|
|
8
|
-
import { readFormalResult } from "./formal.mjs";
|
|
9
|
-
import { readJudgement } from "./judgement.mjs";
|
|
10
7
|
import { loadSkill } from "./skill.mjs";
|
|
11
8
|
|
|
12
9
|
/**
|
|
@@ -19,103 +16,6 @@ function scratch(t) {
|
|
|
19
16
|
return dir;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
/**
|
|
23
|
-
* @param {string} file The file
|
|
24
|
-
* @param {unknown} value What it holds as JSON
|
|
25
|
-
*/
|
|
26
|
-
function writeJson(file, value) {
|
|
27
|
-
mkdirSync(join(file, ".."), { recursive: true });
|
|
28
|
-
writeFileSync(file, JSON.stringify(value));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const FORMAL = {
|
|
32
|
-
name: "formal-add",
|
|
33
|
-
exitCode: 0,
|
|
34
|
-
violated: [],
|
|
35
|
-
passing: ["AddWorks"],
|
|
36
|
-
folder: "formal/formal-add",
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
await test("a formal result is read as recorded", (t) => {
|
|
40
|
-
const evidence = scratch(t);
|
|
41
|
-
writeJson(join(evidence, "formal", "formal-add", "result.json"), {
|
|
42
|
-
...FORMAL,
|
|
43
|
-
base: null,
|
|
44
|
-
fixed: [],
|
|
45
|
-
});
|
|
46
|
-
assert.deepEqual(readFormalResult({ evidence }, "formal-add"), {
|
|
47
|
-
...FORMAL,
|
|
48
|
-
base: null,
|
|
49
|
-
fixed: [],
|
|
50
|
-
});
|
|
51
|
-
assert.equal(readFormalResult({ evidence }, "formal-other"), undefined);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
await test("a formal result whose rules are no list is refused", (t) => {
|
|
55
|
-
const evidence = scratch(t);
|
|
56
|
-
writeJson(join(evidence, "formal", "formal-add", "result.json"), {
|
|
57
|
-
...FORMAL,
|
|
58
|
-
violated: "AddWorks",
|
|
59
|
-
});
|
|
60
|
-
assert.throws(
|
|
61
|
-
() => readFormalResult({ evidence }, "formal-add"),
|
|
62
|
-
/result\.json is malformed: expected a formal check result/,
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const RESULT = {
|
|
67
|
-
feature: "smoke",
|
|
68
|
-
journey: "onboard",
|
|
69
|
-
title: "Onboard",
|
|
70
|
-
entryPoint: "/",
|
|
71
|
-
status: "PASS",
|
|
72
|
-
database: "dms_run",
|
|
73
|
-
steps: [
|
|
74
|
-
{ name: "open", checks: [{ name: "loads", pass: true, detail: "" }] },
|
|
75
|
-
],
|
|
76
|
-
error: null,
|
|
77
|
-
folder: "smoke/onboard",
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
await test("journey results are read as recorded and none when absent", (t) => {
|
|
81
|
-
const dir = scratch(t);
|
|
82
|
-
assert.deepEqual(readFeatureResults(join(dir, "feature.json")), []);
|
|
83
|
-
writeJson(join(dir, "feature.json"), [RESULT]);
|
|
84
|
-
assert.deepEqual(readFeatureResults(join(dir, "feature.json")), [RESULT]);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
await test("a journey result keeps its duration, and one whose duration is no number is refused", (t) => {
|
|
88
|
-
const dir = scratch(t);
|
|
89
|
-
writeJson(join(dir, "feature.json"), [{ ...RESULT, ms: 4200 }]);
|
|
90
|
-
assert.equal(readFeatureResults(join(dir, "feature.json"))[0].ms, 4200);
|
|
91
|
-
writeJson(join(dir, "feature.json"), [{ ...RESULT, ms: "4.2s" }]);
|
|
92
|
-
assert.throws(
|
|
93
|
-
() => readFeatureResults(join(dir, "feature.json")),
|
|
94
|
-
/malformed: expected a list of journey results/,
|
|
95
|
-
);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
await test("a journey result with a status that is neither PASS nor FAIL is refused", (t) => {
|
|
99
|
-
const dir = scratch(t);
|
|
100
|
-
writeJson(join(dir, "feature.json"), [{ ...RESULT, status: "PASSED" }]);
|
|
101
|
-
assert.throws(
|
|
102
|
-
() => readFeatureResults(join(dir, "feature.json")),
|
|
103
|
-
/feature\.json is malformed: expected a list of journey results/,
|
|
104
|
-
);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
await test("a journey result whose check does not say pass or fail is refused", (t) => {
|
|
108
|
-
const dir = scratch(t);
|
|
109
|
-
const steps = [
|
|
110
|
-
{ name: "open", checks: [{ name: "loads", pass: "yes", detail: "" }] },
|
|
111
|
-
];
|
|
112
|
-
writeJson(join(dir, "feature.json"), [{ ...RESULT, steps }]);
|
|
113
|
-
assert.throws(
|
|
114
|
-
() => readFeatureResults(join(dir, "feature.json")),
|
|
115
|
-
/malformed: expected a list of journey results/,
|
|
116
|
-
);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
19
|
const CONFIG = `export default {
|
|
120
20
|
playground: "playground",
|
|
121
21
|
prepare: [["pnpm", "install"]],
|
|
@@ -205,7 +105,7 @@ await test("a config whose formal check pattern is a string is refused", async (
|
|
|
205
105
|
t,
|
|
206
106
|
CONFIG.replace(
|
|
207
107
|
"formal: []",
|
|
208
|
-
'formal: [{ name: "f", covers: [], command: ["node"], violation: "^x"
|
|
108
|
+
'formal: [{ name: "f", covers: [], command: ["node"], violation: "^x" }]',
|
|
209
109
|
),
|
|
210
110
|
);
|
|
211
111
|
await assert.rejects(
|
|
@@ -221,51 +121,3 @@ await test("a config module without a default export is refused", async (t) => {
|
|
|
221
121
|
/verify\.config\.ts is malformed/,
|
|
222
122
|
);
|
|
223
123
|
});
|
|
224
|
-
|
|
225
|
-
const JUDGEMENT = {
|
|
226
|
-
verifier: "thread",
|
|
227
|
-
notVerified: ["ui"],
|
|
228
|
-
attention: [],
|
|
229
|
-
docs: [{ page: "docs/a.md", matches: true, note: "ok" }],
|
|
230
|
-
doors: { none: "no door" },
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
await test("a judgement is read into the verdict's shape", async (t) => {
|
|
234
|
-
const skill = await loadSkill(skillFolder(t, CONFIG), tmpdir());
|
|
235
|
-
const file = join(scratch(t), "judgement.json");
|
|
236
|
-
writeJson(file, JUDGEMENT);
|
|
237
|
-
assert.deepEqual(readJudgement(skill, file), {
|
|
238
|
-
notVerified: ["ui"],
|
|
239
|
-
attention: [],
|
|
240
|
-
docs: [{ page: "docs/a.md", matches: true, note: "ok" }],
|
|
241
|
-
doorsNone: "no door",
|
|
242
|
-
doors: [],
|
|
243
|
-
falsePositives: [],
|
|
244
|
-
verifier: "thread",
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
await test("a judgement whose lists hold other than strings is refused", async (t) => {
|
|
249
|
-
const skill = await loadSkill(skillFolder(t, CONFIG), tmpdir());
|
|
250
|
-
const file = join(scratch(t), "judgement.json");
|
|
251
|
-
writeJson(file, { ...JUDGEMENT, notVerified: "ui" });
|
|
252
|
-
assert.throws(
|
|
253
|
-
() => readJudgement(skill, file),
|
|
254
|
-
/judgement\.json is malformed: expected a verifier's judgement/,
|
|
255
|
-
);
|
|
256
|
-
writeJson(file, {
|
|
257
|
-
...JUDGEMENT,
|
|
258
|
-
docs: [{ page: "docs/a.md", matches: "yes" }],
|
|
259
|
-
});
|
|
260
|
-
assert.throws(
|
|
261
|
-
() => readJudgement(skill, file),
|
|
262
|
-
/malformed: expected a verifier/,
|
|
263
|
-
);
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
await test("a judgement that is no object is refused", async (t) => {
|
|
267
|
-
const skill = await loadSkill(skillFolder(t, CONFIG), tmpdir());
|
|
268
|
-
const file = join(scratch(t), "judgement.json");
|
|
269
|
-
writeJson(file, ["verifier"]);
|
|
270
|
-
assert.throws(() => readJudgement(skill, file), /is malformed/);
|
|
271
|
-
});
|