@antelopejs/dms 0.17.0 → 0.18.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 +65 -0
- package/README.md +7 -11
- package/bin/control/backend-records.test.mjs +276 -0
- package/bin/control/backend.mjs +212 -0
- package/bin/control/backend.test.mjs +325 -0
- package/bin/control/base.mjs +3 -7
- package/bin/control/browser-client.mjs +6 -4
- package/bin/control/browser.mjs +173 -36
- package/bin/control/build-cache.mjs +394 -0
- package/bin/control/build-cache.test.mjs +270 -0
- package/bin/control/build-inputs.mjs +172 -0
- package/bin/control/build-key-refusals.test.mjs +138 -0
- package/bin/control/build-key.mjs +479 -0
- package/bin/control/build-key.test.mjs +392 -0
- package/bin/control/build-layout.test.mjs +314 -0
- package/bin/control/commands-stack.mjs +46 -6
- package/bin/control/commands-verify.mjs +9 -2
- package/bin/control/doctor.mjs +87 -16
- package/bin/control/forwarder.mjs +86 -0
- package/bin/control/forwarder.test.mjs +141 -0
- package/bin/control/frontend-check.mjs +54 -0
- package/bin/control/frontend-workspace.mjs +150 -0
- package/bin/control/frontend-workspace.test.mjs +133 -0
- package/bin/control/helpers/env.mjs +21 -0
- package/bin/control/helpers/evidence.mjs +13 -0
- package/bin/control/helpers/fake-run.mjs +290 -0
- package/bin/control/helpers/key-fixture.mjs +82 -0
- package/bin/control/helpers/pids.mjs +27 -0
- package/bin/control/helpers/repo.mjs +13 -0
- package/bin/control/helpers/tree.mjs +40 -0
- package/bin/control/identity.mjs +238 -0
- package/bin/control/identity.test.mjs +166 -0
- package/bin/control/journey.mjs +64 -16
- package/bin/control/journey.test.mjs +60 -2
- package/bin/control/namespaces.test.mjs +211 -0
- package/bin/control/options.mjs +2 -0
- package/bin/control/pid-guard.test.mjs +202 -0
- package/bin/control/prepared-workspace.mjs +20 -0
- package/bin/control/processes.mjs +122 -33
- package/bin/control/processes.test.mjs +255 -0
- package/bin/control/renderer.test.mjs +2 -1
- package/bin/control/run-copy.mjs +77 -0
- package/bin/control/run-state.mjs +142 -16
- package/bin/control/stack.mjs +259 -210
- package/bin/control/tab.mjs +13 -6
- package/bin/control/tab.test.mjs +444 -0
- package/bin/control/timing.mjs +244 -0
- package/bin/control/timing.test.mjs +197 -0
- package/bin/control/verify/decode.mjs +34 -21
- package/bin/control/verify/decode.test.mjs +39 -0
- package/bin/control/verify/doors.test.mjs +2 -0
- package/bin/control/verify/map.mjs +57 -7
- package/bin/control/verify/map.test.mjs +264 -0
- package/bin/control/verify/skill.mjs +12 -3
- package/bin/control/verify/types.mjs +2 -2
- package/bin/control/verify/verdict.mjs +37 -7
- package/bin/dms-control.mjs +14 -6
- package/dist/config/internal/state.d.ts +2 -2
- package/dist/config/internal/state.js.map +1 -1
- package/dist/utils/sign-in-country.d.ts +0 -1
- package/dist/utils/sign-in-country.js +7 -17
- package/dist/utils/sign-in-country.js.map +1 -1
- package/frontend-vue/layers/dms-layout/app/components/layout/DashboardSearch.vue +24 -1
- package/frontend-vue/layers/dms-layout/app/composables/layout/usePageHeaderActions.ts +1 -1
- package/frontend-vue/package.json +1 -1
- package/frontend-vue/scripts/check-autoimport-boundaries.mjs +19 -3
- package/frontend-vue/scripts/test-autoimport-boundaries.mjs +19 -0
- package/package.json +5 -5
- package/skills/dms-project/SKILL.md +6 -3
- package/data/NOTICE.md +0 -12
- package/data/dbip-country-lite.mmdb +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { checkMap, planFor } from "./map.mjs";
|
|
8
|
+
import { renderVerdict } from "./verdict.mjs";
|
|
9
|
+
|
|
10
|
+
const JOURNEYS = (/** @type {string} */ id) =>
|
|
11
|
+
`export const journeys = [{ id: "${id}", title: "t", entryPoint: "e", async run() {} }];\n`;
|
|
12
|
+
const FEATURE = (/** @type {string} */ id, /** @type {string[]} */ covers) =>
|
|
13
|
+
`---\ncovers:\n${covers.map((glob) => ` - ${glob}`).join("\n")}\n---\n\`${id}\`\n`;
|
|
14
|
+
|
|
15
|
+
const BASE_FILES = {
|
|
16
|
+
"package.json": "{}\n",
|
|
17
|
+
"pnpm-lock.yaml": "lock: 1\n",
|
|
18
|
+
"src/a/x.ts": "export const x = 1;\n",
|
|
19
|
+
"src/b/y.ts": "export const y = 1;\n",
|
|
20
|
+
"fixtures/host/package.json": "{}\n",
|
|
21
|
+
"skill/features/smoke.md": "---\ncovers:\n---\n`smoke`\n",
|
|
22
|
+
"skill/features/a.md": FEATURE("a-journey", ["src/a/**"]),
|
|
23
|
+
"skill/features/b.md": FEATURE("b-journey", ["src/b/**"]),
|
|
24
|
+
"skill/journeys/smoke.mjs": JOURNEYS("smoke"),
|
|
25
|
+
"skill/journeys/a.mjs": JOURNEYS("a-journey"),
|
|
26
|
+
"skill/journeys/b.mjs": JOURNEYS("b-journey"),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} repo
|
|
31
|
+
* @param {...string} args
|
|
32
|
+
* @returns {string}
|
|
33
|
+
*/
|
|
34
|
+
function git(repo, ...args) {
|
|
35
|
+
return execFileSync("git", args, { cwd: repo, encoding: "utf8" }).trim();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {string} repo
|
|
40
|
+
* @param {Record<string, string>} files
|
|
41
|
+
* @returns {string} The new HEAD
|
|
42
|
+
*/
|
|
43
|
+
function commit(repo, files) {
|
|
44
|
+
for (const [path, content] of Object.entries(files)) {
|
|
45
|
+
mkdirSync(dirname(join(repo, path)), { recursive: true });
|
|
46
|
+
writeFileSync(join(repo, path), content);
|
|
47
|
+
}
|
|
48
|
+
git(repo, "add", "-A");
|
|
49
|
+
git(
|
|
50
|
+
repo,
|
|
51
|
+
"-c",
|
|
52
|
+
"user.name=t",
|
|
53
|
+
"-c",
|
|
54
|
+
"user.email=t@example.com",
|
|
55
|
+
"-c",
|
|
56
|
+
"commit.gpgsign=false",
|
|
57
|
+
"commit",
|
|
58
|
+
"-q",
|
|
59
|
+
"-m",
|
|
60
|
+
"change",
|
|
61
|
+
);
|
|
62
|
+
return git(repo, "rev-parse", "HEAD");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A repository with two features beside the smoke one, committed once, then
|
|
67
|
+
* changed by `changes` in a second commit.
|
|
68
|
+
*
|
|
69
|
+
* @param {import("node:test").TestContext} t
|
|
70
|
+
* @param {Record<string, string>} changes
|
|
71
|
+
* @param {Partial<import("./skill.mjs").SkillConfig>} [config]
|
|
72
|
+
*/
|
|
73
|
+
function fixture(t, changes, config = {}) {
|
|
74
|
+
const repo = mkdtempSync(join(tmpdir(), "dms-control-map-test-"));
|
|
75
|
+
t.after(() => rmSync(repo, { recursive: true, force: true }));
|
|
76
|
+
git(repo, "init", "-q");
|
|
77
|
+
git(repo, "remote", "add", "origin", "https://github.com/o/r.git");
|
|
78
|
+
const base = commit(repo, BASE_FILES);
|
|
79
|
+
const head = commit(repo, changes);
|
|
80
|
+
/** @type {import("./skill.mjs").Skill} */
|
|
81
|
+
const skill = {
|
|
82
|
+
dir: join(repo, "skill"),
|
|
83
|
+
name: "verify-x",
|
|
84
|
+
repo,
|
|
85
|
+
featuresDir: join(repo, "skill", "features"),
|
|
86
|
+
journeysDir: join(repo, "skill", "journeys"),
|
|
87
|
+
config: {
|
|
88
|
+
playground: "p",
|
|
89
|
+
prepare: [],
|
|
90
|
+
userFacing: ["src/**"],
|
|
91
|
+
notUserFacing: [],
|
|
92
|
+
shared: ["**/package.json", "pnpm-lock.yaml"],
|
|
93
|
+
notShared: ["fixtures/**"],
|
|
94
|
+
smoke: "smoke",
|
|
95
|
+
smokeJourney: "",
|
|
96
|
+
doors: {},
|
|
97
|
+
formal: [],
|
|
98
|
+
...config,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
return { repo, base, head, skill };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
await test("a changed lockfile runs smoke and then every feature and names the file; a planner that maps only covers globs runs smoke alone", (t) => {
|
|
105
|
+
const { skill, base } = fixture(t, { "pnpm-lock.yaml": "lock: 2\n" });
|
|
106
|
+
const plan = planFor(skill, base);
|
|
107
|
+
assert.deepEqual(plan.run, ["smoke", "a", "b"]);
|
|
108
|
+
assert.deepEqual(plan.shared, ["pnpm-lock.yaml"]);
|
|
109
|
+
assert.deepEqual(plan.touched, []);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
await test("a nested manifest is shared too; a root-only package.json glob leaves it to the covers", (t) => {
|
|
113
|
+
const { skill, base } = fixture(t, { "src/a/package.json": "{ }\n" });
|
|
114
|
+
const plan = planFor(skill, base);
|
|
115
|
+
assert.deepEqual(plan.run, ["smoke", "a", "b"]);
|
|
116
|
+
assert.deepEqual(plan.shared, ["src/a/package.json"]);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
await test("a diff of covered files runs those features beside smoke; escalating on every change would run b too", (t) => {
|
|
120
|
+
const { skill, base } = fixture(t, { "src/a/x.ts": "export const x = 2;\n" });
|
|
121
|
+
const plan = planFor(skill, base);
|
|
122
|
+
assert.deepEqual(plan.run, ["smoke", "a"]);
|
|
123
|
+
assert.deepEqual(plan.shared, []);
|
|
124
|
+
assert.deepEqual(plan.touched, [{ feature: "a", files: ["src/a/x.ts"] }]);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
await test("a shared file next to a covered one keeps touched and shared apart; dropping touched on escalation loses the diff-to-feature evidence", (t) => {
|
|
128
|
+
const { skill, base } = fixture(t, {
|
|
129
|
+
"src/b/y.ts": "export const y = 2;\n",
|
|
130
|
+
"package.json": '{ "name": "x" }\n',
|
|
131
|
+
});
|
|
132
|
+
const plan = planFor(skill, base);
|
|
133
|
+
assert.deepEqual(plan.run, ["smoke", "a", "b"]);
|
|
134
|
+
assert.deepEqual(plan.shared, ["package.json"]);
|
|
135
|
+
assert.deepEqual(plan.touched, [{ feature: "b", files: ["src/b/y.ts"] }]);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
await test("a shared file renamed out of its shared path still runs every feature; a diff with rename detection lists only the new path and runs smoke alone", (t) => {
|
|
139
|
+
const { repo, skill, base } = fixture(t, { "README.md": "x\n" });
|
|
140
|
+
git(repo, "mv", "pnpm-lock.yaml", "moved-lock.txt");
|
|
141
|
+
commit(repo, {});
|
|
142
|
+
const plan = planFor(skill, base);
|
|
143
|
+
assert.deepEqual(plan.run, ["smoke", "a", "b"]);
|
|
144
|
+
assert.deepEqual(plan.shared, ["pnpm-lock.yaml"]);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
await test("a fixture manifest under notShared stays on smoke; a planner that ignores notShared escalates on test fixtures", (t) => {
|
|
148
|
+
const { skill, base } = fixture(t, {
|
|
149
|
+
"fixtures/host/package.json": '{ "name": "host" }\n',
|
|
150
|
+
});
|
|
151
|
+
const plan = planFor(skill, base);
|
|
152
|
+
assert.deepEqual(plan.run, ["smoke"]);
|
|
153
|
+
assert.deepEqual(plan.shared, []);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
await test("a skill without shared globs still plans from covers alone; a planner that treats every package.json as shared breaks the other dms-* repositories", (t) => {
|
|
157
|
+
const { skill, base } = fixture(
|
|
158
|
+
t,
|
|
159
|
+
{ "pnpm-lock.yaml": "lock: 2\n" },
|
|
160
|
+
{ shared: [], notShared: [] },
|
|
161
|
+
);
|
|
162
|
+
assert.deepEqual(planFor(skill, base).run, ["smoke"]);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
await test("all runs every feature on a diff that touches none and lists no shared file; ignoring the flag runs smoke alone", (t) => {
|
|
166
|
+
const { skill, base } = fixture(t, { "README.md": "x\n" });
|
|
167
|
+
const plan = planFor(skill, base, true);
|
|
168
|
+
assert.deepEqual(plan.run, ["smoke", "a", "b"]);
|
|
169
|
+
assert.deepEqual(plan.shared, []);
|
|
170
|
+
assert.deepEqual(planFor(skill, base).run, ["smoke"]);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
await test("map fails a shared glob that matches no tracked file or only notShared ones; a checkMap blind to shared globs lets a renamed lockfile glob rot", async (t) => {
|
|
174
|
+
const { skill } = fixture(
|
|
175
|
+
t,
|
|
176
|
+
{ "README.md": "x\n" },
|
|
177
|
+
{
|
|
178
|
+
shared: ["**/package.json", "gone/**", "fixtures/**"],
|
|
179
|
+
},
|
|
180
|
+
);
|
|
181
|
+
const problems = (await checkMap(skill)).filter((line) =>
|
|
182
|
+
line.includes("shared glob"),
|
|
183
|
+
);
|
|
184
|
+
assert.deepEqual(problems, [
|
|
185
|
+
"verify.config.ts: shared glob gone/** matches no tracked file",
|
|
186
|
+
"verify.config.ts: shared glob fixtures/** matches no tracked file",
|
|
187
|
+
]);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @param {string} evidence
|
|
192
|
+
* @param {string[]} features
|
|
193
|
+
*/
|
|
194
|
+
function recordPassing(evidence, features) {
|
|
195
|
+
for (const feature of features) {
|
|
196
|
+
mkdirSync(join(evidence, feature), { recursive: true });
|
|
197
|
+
const journey = feature === "smoke" ? "smoke" : `${feature}-journey`;
|
|
198
|
+
writeFileSync(
|
|
199
|
+
join(evidence, feature, "feature.json"),
|
|
200
|
+
JSON.stringify([
|
|
201
|
+
{
|
|
202
|
+
feature,
|
|
203
|
+
journey,
|
|
204
|
+
title: "t",
|
|
205
|
+
entryPoint: "e",
|
|
206
|
+
status: "PASS",
|
|
207
|
+
database: "d",
|
|
208
|
+
steps: [],
|
|
209
|
+
error: null,
|
|
210
|
+
folder: `${feature}/${journey}`,
|
|
211
|
+
},
|
|
212
|
+
]),
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const JUDGEMENT = {
|
|
218
|
+
notVerified: [],
|
|
219
|
+
attention: [],
|
|
220
|
+
docs: [],
|
|
221
|
+
doorsNone: "none",
|
|
222
|
+
doors: [],
|
|
223
|
+
falsePositives: [],
|
|
224
|
+
verifier: "v",
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
await test("the verdict fails a run that skipped features the shared-file plan required; a verdict that requires only the touched features passes the smoke-only run", async (t) => {
|
|
228
|
+
const { skill, base, head } = fixture(t, { "pnpm-lock.yaml": "lock: 2\n" });
|
|
229
|
+
const evidence = mkdtempSync(join(tmpdir(), "dms-control-evidence-test-"));
|
|
230
|
+
t.after(() => rmSync(evidence, { recursive: true, force: true }));
|
|
231
|
+
const state = /** @type {import("../run-state.mjs").RunState} */ (
|
|
232
|
+
/** @type {unknown} */ ({ baseRef: base, headSha: head, evidence })
|
|
233
|
+
);
|
|
234
|
+
recordPassing(evidence, ["smoke"]);
|
|
235
|
+
const skipped = await renderVerdict(skill, state, 1, JUDGEMENT);
|
|
236
|
+
assert.equal(skipped.result, "FAIL");
|
|
237
|
+
assert.deepEqual(skipped.reasons, [
|
|
238
|
+
"a/a-journey was not run",
|
|
239
|
+
"b/b-journey was not run",
|
|
240
|
+
]);
|
|
241
|
+
recordPassing(evidence, ["a", "b"]);
|
|
242
|
+
assert.equal(
|
|
243
|
+
(await renderVerdict(skill, state, 1, JUDGEMENT)).result,
|
|
244
|
+
"PASS",
|
|
245
|
+
);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
await test("the verdict of a covered-only diff needs the other features only when all is set; a verdict that drops all passes an incomplete release run", async (t) => {
|
|
249
|
+
const { skill, base, head } = fixture(t, {
|
|
250
|
+
"src/a/x.ts": "export const x = 2;\n",
|
|
251
|
+
});
|
|
252
|
+
const evidence = mkdtempSync(join(tmpdir(), "dms-control-evidence-test-"));
|
|
253
|
+
t.after(() => rmSync(evidence, { recursive: true, force: true }));
|
|
254
|
+
const state = /** @type {import("../run-state.mjs").RunState} */ (
|
|
255
|
+
/** @type {unknown} */ ({ baseRef: base, headSha: head, evidence })
|
|
256
|
+
);
|
|
257
|
+
recordPassing(evidence, ["smoke", "a"]);
|
|
258
|
+
assert.equal(
|
|
259
|
+
(await renderVerdict(skill, state, 1, JUDGEMENT)).result,
|
|
260
|
+
"PASS",
|
|
261
|
+
);
|
|
262
|
+
const release = await renderVerdict(skill, state, 1, JUDGEMENT, true);
|
|
263
|
+
assert.deepEqual(release.reasons, ["b/b-journey was not run"]);
|
|
264
|
+
});
|
|
@@ -4,6 +4,7 @@ import { basename, join, relative, resolve } from "node:path";
|
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { checkoutOf } from "../git.mjs";
|
|
6
6
|
import { isRecord } from "../json.mjs";
|
|
7
|
+
import { stopwatch } from "../timing.mjs";
|
|
7
8
|
import { decodeSkillConfig } from "./decode.mjs";
|
|
8
9
|
|
|
9
10
|
const CONFIG_FILE = "verify.config.ts";
|
|
@@ -11,7 +12,7 @@ const OUTPUT_LIMIT = 64 * 1024 * 1024;
|
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* @typedef {{ dir: string, name: string, repo: string, config: SkillConfig, featuresDir: string, journeysDir: string }} Skill
|
|
14
|
-
* @typedef {{ playground: string, renderer?: string, prepare: string[][], userFacing: string[], notUserFacing: string[], smoke: string, smokeJourney: string, doors: Record<string, { globs: string[], funnels: string[], why: string } | null>, formal: import("./types.mjs").FormalCheck[] }} SkillConfig
|
|
15
|
+
* @typedef {{ playground: string, renderer?: string, prepare: string[][], userFacing: string[], notUserFacing: string[], shared: string[], notShared: string[], smoke: string, smokeJourney: string, doors: Record<string, { globs: string[], funnels: string[], why: string } | null>, formal: import("./types.mjs").FormalCheck[] }} SkillConfig
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -130,10 +131,12 @@ export function journeysFile(skill, feature) {
|
|
|
130
131
|
*
|
|
131
132
|
* @param {Skill} skill The skill
|
|
132
133
|
* @param {string} cwd The checkout
|
|
134
|
+
* @returns {import("../timing.mjs").TimingEntry[]} One timing entry per command, for the run folder that does not exist yet
|
|
133
135
|
* @throws When a command fails, with its output
|
|
134
136
|
*/
|
|
135
137
|
export function runPrepare(skill, cwd) {
|
|
136
|
-
|
|
138
|
+
return skill.config.prepare.map(([program, ...args]) => {
|
|
139
|
+
const stop = stopwatch();
|
|
137
140
|
const result = spawnSync(program, args, {
|
|
138
141
|
cwd,
|
|
139
142
|
encoding: "utf8",
|
|
@@ -145,5 +148,11 @@ export function runPrepare(skill, cwd) {
|
|
|
145
148
|
`${program} ${args.join(" ")} failed in ${cwd}:\n${result.stdout}${result.stderr}`,
|
|
146
149
|
);
|
|
147
150
|
}
|
|
148
|
-
|
|
151
|
+
return {
|
|
152
|
+
phase: "prepare",
|
|
153
|
+
...stop(),
|
|
154
|
+
ok: true,
|
|
155
|
+
command: [program, ...args].join(" "),
|
|
156
|
+
};
|
|
157
|
+
});
|
|
149
158
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typedef {{ exitCode: number | null, violated: string[], passing: string[] }} Rules
|
|
11
11
|
* @typedef {{ name: string, exitCode: number | null, violated: string[], passing: string[], folder: string, commits?: Commits, behaviour?: BehaviourChange, checkChanged?: boolean, base?: Rules | null, fixed?: string[], missing?: string[] }} FormalResult
|
|
12
12
|
* @typedef {{ feature: string, files: string[] }} TouchedFeature
|
|
13
|
-
* @typedef {{ baseRef: string, baseSha: string, headSha: string, changed: string[], touched: TouchedFeature[], unmapped: string[], docs: string[], run: string[] }} Plan
|
|
13
|
+
* @typedef {{ baseRef: string, baseSha: string, headSha: string, changed: string[], touched: TouchedFeature[], shared: string[], unmapped: string[], docs: string[], run: string[] }} Plan
|
|
14
14
|
* @typedef {{ kind?: string, location?: string, irreversible?: string, containment?: string }} RawDoorRow
|
|
15
15
|
* @typedef {{ kind?: string, location?: string, reason?: string }} RawFalsePositive
|
|
16
16
|
* @typedef {{ page: string, matches?: boolean, note?: string }} RawDocsJudgement
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* @typedef {{ page: string, matches: boolean, note: string }} DocsJudgement
|
|
21
21
|
* @typedef {{ notVerified: string[], attention: string[], docs: DocsJudgement[], doorsNone: string | null, doors: DoorRow[], falsePositives: FalsePositive[], verifier: string }} Judgement
|
|
22
22
|
* @typedef {{ name: string, pass: boolean, detail: string }} JourneyCheck
|
|
23
|
-
* @typedef {{ feature: string, journey: string, title: string, entryPoint: string, status: "PASS" | "FAIL", database: string, steps: { name: string, checks: JourneyCheck[] }[], error: string | null, folder: string }} FeatureResult
|
|
23
|
+
* @typedef {{ feature: string, journey: string, title: string, entryPoint: string, status: "PASS" | "FAIL", database: string, steps: { name: string, checks: JourneyCheck[] }[], error: string | null, folder: string, ms?: number }} FeatureResult
|
|
24
24
|
* @typedef {{ result: string, headSha: string, skillSha: string, pr: number, reasons: string[] }} VerdictCore
|
|
25
25
|
* @typedef {VerdictCore & { markdown: string }} Verdict
|
|
26
26
|
*/
|
|
@@ -2,6 +2,12 @@ import { existsSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { join, relative } from "node:path";
|
|
3
3
|
import { git } from "../git.mjs";
|
|
4
4
|
import { loadJourneys } from "../journey.mjs";
|
|
5
|
+
import {
|
|
6
|
+
formatSeconds,
|
|
7
|
+
markdownTimings,
|
|
8
|
+
readTimings,
|
|
9
|
+
summarize,
|
|
10
|
+
} from "../timing.mjs";
|
|
5
11
|
import { readFeatureResults } from "./decode.mjs";
|
|
6
12
|
import { flaggedDoors } from "./doors.mjs";
|
|
7
13
|
import {
|
|
@@ -82,8 +88,10 @@ async function journeyRows(skill, state, plan, link) {
|
|
|
82
88
|
if (result.status === "FAIL")
|
|
83
89
|
reasons.push(`${feature}/${result.journey} failed`);
|
|
84
90
|
const outcome = result.status === "PASS" ? "pass" : "**fail**";
|
|
91
|
+
const time =
|
|
92
|
+
result.ms === undefined ? "-" : `${formatSeconds(result.ms)} s`;
|
|
85
93
|
rows.push(
|
|
86
|
-
`| ${feature} | \`${result.journey}\`: ${result.entryPoint} | ${outcome}: ${result.title} | [${result.folder}](${link(result.folder)}) |`,
|
|
94
|
+
`| ${feature} | \`${result.journey}\`: ${result.entryPoint} | ${outcome}: ${result.title} | ${time} | [${result.folder}](${link(result.folder)}) |`,
|
|
87
95
|
);
|
|
88
96
|
}
|
|
89
97
|
}
|
|
@@ -204,11 +212,20 @@ function docsReasons(judgement, plan) {
|
|
|
204
212
|
/**
|
|
205
213
|
* @param {import("./skill.mjs").Skill} skill The skill
|
|
206
214
|
* @param {import("./types.mjs").VerdictCore} verdict The verdict
|
|
207
|
-
* @param {{ plan: import("./types.mjs").Plan, judgement: import("./types.mjs").Judgement, journeys: Awaited<ReturnType<typeof journeyRows>>, formal: ReturnType<typeof formalSection>, reasons: string[], attention: string[], link: (path: string) => string }} parts What the verdict is rendered from
|
|
215
|
+
* @param {{ plan: import("./types.mjs").Plan, judgement: import("./types.mjs").Judgement, journeys: Awaited<ReturnType<typeof journeyRows>>, formal: ReturnType<typeof formalSection>, timing: import("../timing.mjs").TimingSummary, reasons: string[], attention: string[], link: (path: string) => string }} parts What the verdict is rendered from
|
|
208
216
|
* @returns {string} The verdict as Markdown
|
|
209
217
|
*/
|
|
210
218
|
function markdown(skill, verdict, parts) {
|
|
211
|
-
const {
|
|
219
|
+
const {
|
|
220
|
+
plan,
|
|
221
|
+
judgement,
|
|
222
|
+
journeys,
|
|
223
|
+
formal,
|
|
224
|
+
timing,
|
|
225
|
+
reasons,
|
|
226
|
+
attention,
|
|
227
|
+
link,
|
|
228
|
+
} = parts;
|
|
212
229
|
const touched = plan.touched.map(
|
|
213
230
|
(entry) =>
|
|
214
231
|
`\`${entry.feature}\` (diff: ${entry.files.map((file) => `\`${file}\``).join(", ")})`,
|
|
@@ -229,6 +246,14 @@ function markdown(skill, verdict, parts) {
|
|
|
229
246
|
...bullets(touched, "none"),
|
|
230
247
|
`- ${skill.config.smoke}: ${skill.config.smokeJourney}`,
|
|
231
248
|
"",
|
|
249
|
+
...(plan.shared.length > 0
|
|
250
|
+
? [
|
|
251
|
+
"### Shared files",
|
|
252
|
+
`Every feature runs (${plan.run.length}), because the diff changes:`,
|
|
253
|
+
...plan.shared.map((file) => `- \`${file}\``),
|
|
254
|
+
"",
|
|
255
|
+
]
|
|
256
|
+
: []),
|
|
232
257
|
...(plan.unmapped.length > 0
|
|
233
258
|
? [
|
|
234
259
|
"### Unmapped surfaces",
|
|
@@ -243,10 +268,13 @@ function markdown(skill, verdict, parts) {
|
|
|
243
268
|
? ["### Why it fails", ...reasons.map((reason) => `- ${reason}`), ""]
|
|
244
269
|
: []),
|
|
245
270
|
"### Journeys",
|
|
246
|
-
"| Feature | Entry point | Result | Evidence |",
|
|
247
|
-
"
|
|
271
|
+
"| Feature | Entry point | Result | Time | Evidence |",
|
|
272
|
+
"|---|---|---|---|---|",
|
|
248
273
|
...journeys.rows,
|
|
249
274
|
"",
|
|
275
|
+
"### Timing",
|
|
276
|
+
...(timing.rows.length > 0 ? markdownTimings(timing) : ["None recorded."]),
|
|
277
|
+
"",
|
|
250
278
|
"### Formal checks",
|
|
251
279
|
...bullets(formal.lines, "None ran."),
|
|
252
280
|
"",
|
|
@@ -273,10 +301,11 @@ function markdown(skill, verdict, parts) {
|
|
|
273
301
|
* @param {import("../run-state.mjs").RunState} state The run
|
|
274
302
|
* @param {number} pr The pull request
|
|
275
303
|
* @param {import("./types.mjs").Judgement} judgement The verifier's judgement
|
|
304
|
+
* @param {boolean} [all] Require every feature, as `plan --all` does for a release
|
|
276
305
|
* @returns {Promise<import("./types.mjs").Verdict>} The verdict
|
|
277
306
|
*/
|
|
278
|
-
export async function renderVerdict(skill, state, pr, judgement) {
|
|
279
|
-
const plan = planFor(skill, state.baseRef);
|
|
307
|
+
export async function renderVerdict(skill, state, pr, judgement, all = false) {
|
|
308
|
+
const plan = planFor(skill, state.baseRef, all);
|
|
280
309
|
const skillSha =
|
|
281
310
|
git(
|
|
282
311
|
["log", "-1", "--format=%H", "--", relative(skill.repo, skill.dir)],
|
|
@@ -313,6 +342,7 @@ export async function renderVerdict(skill, state, pr, judgement) {
|
|
|
313
342
|
judgement,
|
|
314
343
|
journeys,
|
|
315
344
|
formal,
|
|
345
|
+
timing: summarize(readTimings(state.evidence)),
|
|
316
346
|
reasons,
|
|
317
347
|
attention,
|
|
318
348
|
link,
|
package/bin/dms-control.mjs
CHANGED
|
@@ -7,10 +7,15 @@ import { runVerifyCommand } from "./control/commands-verify.mjs";
|
|
|
7
7
|
const USAGE = `Usage: dms-control <command>
|
|
8
8
|
|
|
9
9
|
Drive an isolated DMS (run from the repository, or pass --playground):
|
|
10
|
-
up [--prepare] [--playground <dir>] [--renderer <dir>] [--runs <dir>] [--mongo-url <url>] [--env KEY=VALUE]... [--base <ref>] [--skill <dir>]
|
|
10
|
+
up [--prepare] [--playground <dir>] [--renderer <dir>] [--runs <dir>] [--mongo-url <url>] [--env KEY=VALUE]... [--base <ref>] [--skill <dir>] [--no-standby] [--no-build-cache]
|
|
11
11
|
build and start a playground copy on free ports; print the run folder
|
|
12
12
|
(--prepare first runs the skill's install and build commands;
|
|
13
|
-
--renderer serves that built @antelopejs/dms-frontend checkout
|
|
13
|
+
--renderer serves that built @antelopejs/dms-frontend checkout;
|
|
14
|
+
--no-standby, or DMS_CONTROL_NO_STANDBY=1, starts each fresh database's
|
|
15
|
+
backend when it is needed instead of one ahead: about 160 MB less while
|
|
16
|
+
journeys run, about 5 s more per journey;
|
|
17
|
+
the frontend build of the same inputs comes from $XDG_CACHE_HOME/dms-control/frontend,
|
|
18
|
+
--no-build-cache runs ajs dms build as it is)
|
|
14
19
|
doctor <run> [--verbose] check the run is worth driving; print the failing checks
|
|
15
20
|
onboard <run> [--platform-name <name>]
|
|
16
21
|
create the run's administrator through POST /api/onboarding/register
|
|
@@ -21,17 +26,20 @@ Drive an isolated DMS (run from the repository, or pass --playground):
|
|
|
21
26
|
api <run> <method> <path> [--as <account>|anon] [--body <json>]
|
|
22
27
|
an authenticated request; prints the status and the body
|
|
23
28
|
mail <run> the messages the run's mail sink captured
|
|
24
|
-
reset <run>
|
|
29
|
+
reset <run> move the run onto an empty database and a backend that served nothing
|
|
25
30
|
down <run> stop the run, drop its databases, keep its evidence
|
|
31
|
+
timings <run> the time each phase of the run took, from evidence/timings.jsonl
|
|
26
32
|
|
|
27
33
|
Verify a change (the .agents/skills/verify-* folder of the checkout, or --skill <dir>):
|
|
28
34
|
map check the feature map covers every user-facing file
|
|
29
|
-
plan [--base <ref>]
|
|
35
|
+
plan [--base <ref>] [--all] map the diff to features; list shared files and unmapped surfaces
|
|
36
|
+
(a shared file, or --all for a release, runs every feature)
|
|
30
37
|
journey <run> <feature> [ids...] run a feature's journeys and record evidence
|
|
31
38
|
doors [patch] [--base <ref>] print the One-way-door line for a patch, or for the diff
|
|
32
39
|
formal <run> [--all] run the formal checks that cover the diff (or every one)
|
|
33
|
-
verdict <run> --pr <n>
|
|
34
|
-
|
|
40
|
+
verdict <run> --pr <n> [--all] render evidence/verdict.md from the results and evidence/judgement.json
|
|
41
|
+
(--all requires every feature, for a release)
|
|
42
|
+
publish <run> --pr <n> [--all] push the evidence, comment the verdict, set the verify status
|
|
35
43
|
`;
|
|
36
44
|
|
|
37
45
|
/**
|
|
@@ -12,8 +12,8 @@ export interface OAuthConfig {
|
|
|
12
12
|
callbackBaseUrl?: string;
|
|
13
13
|
}
|
|
14
14
|
export interface SignInCountryConfig {
|
|
15
|
-
header?: string;
|
|
16
|
-
database?: string
|
|
15
|
+
header?: string | false;
|
|
16
|
+
database?: string;
|
|
17
17
|
}
|
|
18
18
|
export interface AuthConfig {
|
|
19
19
|
jwtSecret: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/config/internal/state.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/config/internal/state.ts"],"names":[],"mappings":";;;AAqRA,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AE,CAAC;AAClC,CAAC;AAMD,SAAgB,WAAW,CAAC,MAAc;IACxC,YAAY,GAAG,IAAA,WAAI,EAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAE1C,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,gBAAgB,GAAG,IAAA,WAAI,EAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACzD,CAAC;IAED,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,sBAAsB,GAAG,IAAA,WAAI,EAAC,MAAM,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,mBAAmB,GAAG,IAAA,WAAI,EAAC,MAAM,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,oBAAoB,GAAG,IAAA,WAAI,EAAC,MAAM,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IACrE,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BUNDLED_COUNTRY_DATABASE = void 0;
|
|
7
3
|
exports.resetCountryLookup = resetCountryLookup;
|
|
8
4
|
exports.normalizeCountryCode = normalizeCountryCode;
|
|
9
5
|
exports.lookupCountry = lookupCountry;
|
|
@@ -11,34 +7,27 @@ exports.resolveClientOrigin = resolveClientOrigin;
|
|
|
11
7
|
exports.countryDisplayName = countryDisplayName;
|
|
12
8
|
const own_value_1 = require("./own-value");
|
|
13
9
|
const node_fs_1 = require("node:fs");
|
|
14
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
15
10
|
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
16
11
|
const mmdb_lib_1 = require("mmdb-lib");
|
|
17
12
|
const config_1 = require("../config");
|
|
18
13
|
const FALLBACK_LANGUAGE = "en";
|
|
19
14
|
const COUNTRY_CODE_PATTERN = /^[A-Z]{2}$/;
|
|
20
15
|
const NON_COUNTRY_CODES = new Set(["XX", "T1"]);
|
|
21
|
-
|
|
16
|
+
const DEFAULT_COUNTRY_HEADER = "CF-IPCountry";
|
|
22
17
|
let cachedLookup;
|
|
23
|
-
function databasePath() {
|
|
24
|
-
const configured = (0, config_1.getAuthConfig)().signInCountry?.database;
|
|
25
|
-
if (configured === false)
|
|
26
|
-
return undefined;
|
|
27
|
-
return configured ?? exports.BUNDLED_COUNTRY_DATABASE;
|
|
28
|
-
}
|
|
29
18
|
function openDatabase(file) {
|
|
30
19
|
try {
|
|
31
20
|
return new mmdb_lib_1.Reader((0, node_fs_1.readFileSync)(file));
|
|
32
21
|
}
|
|
33
22
|
catch (error) {
|
|
34
|
-
logging_1.Logging.Warn(`[DMS]
|
|
23
|
+
logging_1.Logging.Warn(`[DMS] Cannot read the sign-in country database \`auth.signInCountry.database\` names ("${file}"): without the header, sign-ins are told apart by device only (${String(error)})`);
|
|
35
24
|
return null;
|
|
36
25
|
}
|
|
37
26
|
}
|
|
38
27
|
function countryLookup() {
|
|
39
28
|
if (cachedLookup !== undefined)
|
|
40
29
|
return cachedLookup;
|
|
41
|
-
const file =
|
|
30
|
+
const file = (0, config_1.getAuthConfig)().signInCountry?.database;
|
|
42
31
|
cachedLookup = file ? openDatabase(file) : null;
|
|
43
32
|
return cachedLookup;
|
|
44
33
|
}
|
|
@@ -66,9 +55,10 @@ function lookupCountry(ip, lookup = countryLookup()) {
|
|
|
66
55
|
}
|
|
67
56
|
}
|
|
68
57
|
function resolveClientOrigin(ip, headers) {
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
|
|
58
|
+
const config = (0, config_1.getAuthConfig)().signInCountry;
|
|
59
|
+
const header = config?.header ?? (config?.database ? undefined : DEFAULT_COUNTRY_HEADER);
|
|
60
|
+
const country = (header
|
|
61
|
+
? normalizeCountryCode((0, own_value_1.ownValue)(headers, header.toLowerCase()))
|
|
72
62
|
: undefined) ?? lookupCountry(ip);
|
|
73
63
|
return { ip, country };
|
|
74
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in-country.js","sourceRoot":"","sources":["../../src/utils/sign-in-country.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign-in-country.js","sourceRoot":"","sources":["../../src/utils/sign-in-country.ts"],"names":[],"mappings":";;AAoDA,gDAEC;AAID,oDASC;AAQD,sCAUC;AAUD,kDAYC;AAiBD,gDAKC;AAjID,2CAAuC;AACvC,qCAAuC;AACvC,gEAA6D;AAC7D,uCAAwD;AACxD,sCAA0C;AAE1C,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAE1C,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAMrE,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAe9C,IAAI,YAA8C,CAAC;AAEnD,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,CAAC;QACH,OAAO,IAAI,iBAAM,CAAkB,IAAA,sBAAY,EAAC,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,iBAAO,CAAC,IAAI,CACV,0FAA0F,IAAI,mEAAmE,MAAM,CAAC,KAAK,CAAC,GAAG,CAClL,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAGD,SAAS,aAAa;IACpB,IAAI,YAAY,KAAK,SAAS;QAAE,OAAO,YAAY,CAAC;IACpD,MAAM,IAAI,GAAG,IAAA,sBAAa,GAAE,CAAC,aAAa,EAAE,QAAQ,CAAC;IACr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CAAC;IAC5E,MAAM,OAAO,GACX,CAAC,MAAM;QACL,CAAC,CAAC,oBAAoB,CAAC,IAAA,oBAAQ,EAAC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAC/D,CAAC,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,EAAE,CAAC,CAAC;IACtC,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACzB,CAAC;AAED,SAAS,cAAc,CAAC,QAA4B;IAClD,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,iBAAiB,CAAC,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AASD,SAAgB,kBAAkB,CAAC,IAAY,EAAE,QAAiB;IAChE,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QAC5D,IAAI,EAAE,QAAQ;KACf,CAAC,CAAC;IACH,OAAO,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAChC,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
nextTick,
|
|
5
|
+
onBeforeUnmount,
|
|
6
|
+
onMounted,
|
|
7
|
+
useTemplateRef,
|
|
8
|
+
} from "vue";
|
|
3
9
|
import CommandPaletteAssistantAnswer from "../../build/components/layout/CommandPaletteAssistantAnswer.vue";
|
|
4
10
|
import { ASSISTANT_MODE_KEY } from "../../build/composables/command-palette/assistantGroups";
|
|
5
11
|
import { useCommandPaletteAssistantMode } from "../../build/composables/command-palette/useCommandPaletteAssistantMode";
|
|
@@ -54,6 +60,23 @@ function switchMode(): void {
|
|
|
54
60
|
function close(): void {
|
|
55
61
|
isOpen.value = false;
|
|
56
62
|
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Set on `<html>` while the palette is mounted, which is while its ⌘ K /
|
|
66
|
+
* Ctrl K shortcut listens. The palette renders nothing until opened and
|
|
67
|
+
* loads after the dashboard around it, so nothing else on the page shows
|
|
68
|
+
* when the shortcut starts to work: a browser test waits for this attribute
|
|
69
|
+
* before it presses the keys.
|
|
70
|
+
*/
|
|
71
|
+
const MOUNTED_ATTRIBUTE = "data-dms-command-palette";
|
|
72
|
+
|
|
73
|
+
onMounted(() => {
|
|
74
|
+
document.documentElement.setAttribute(MOUNTED_ATTRIBUTE, "");
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
onBeforeUnmount(() => {
|
|
78
|
+
document.documentElement.removeAttribute(MOUNTED_ATTRIBUTE);
|
|
79
|
+
});
|
|
57
80
|
</script>
|
|
58
81
|
|
|
59
82
|
<template>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "../../../../dms-ui/app/composables/layout/usePageHeaderActions";
|