@antelopejs/dms 0.18.1 → 0.19.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 +78 -0
- package/README.md +2 -2
- package/bin/control/backend.mjs +1 -1
- package/bin/control/base.mjs +24 -9
- package/bin/control/base.test.mjs +88 -0
- package/bin/control/browser-client.mjs +1 -1
- package/bin/control/commands-stack.mjs +3 -1
- package/bin/control/commands-verify.mjs +5 -23
- package/bin/control/consumer-install.test.mjs +73 -0
- package/bin/control/database.mjs +66 -0
- package/bin/control/doctor.mjs +7 -0
- package/bin/control/frontend-check.mjs +2 -1
- package/bin/control/frontend-mode.test.mjs +24 -0
- package/bin/control/identity.mjs +45 -16
- package/bin/control/journey.mjs +31 -3
- package/bin/control/journey.test.mjs +207 -2
- package/bin/control/launch.mjs +123 -0
- package/bin/control/module-root.mjs +40 -0
- package/bin/control/module-root.test.mjs +67 -0
- package/bin/control/mongo-server.test.mjs +91 -0
- package/bin/control/mongo.mjs +125 -12
- package/bin/control/options.mjs +1 -0
- package/bin/control/pid-reuse.test.mjs +278 -0
- package/bin/control/processes.mjs +91 -29
- package/bin/control/renderer.test.mjs +1 -1
- package/bin/control/run-copy.mjs +6 -1
- package/bin/control/run-state.mjs +4 -1
- package/bin/control/stack.mjs +78 -165
- package/bin/control/verify/behaviour.test.mjs +36 -23
- package/bin/control/verify/decode.mjs +1 -15
- package/bin/control/verify/decode.test.mjs +1 -14
- package/bin/control/verify/emit.mjs +11 -11
- package/bin/control/verify/formal.mjs +28 -14
- package/bin/control/verify/formal.test.mjs +15 -0
- package/bin/control/verify/types.mjs +1 -1
- package/bin/control/verify/verdict.mjs +9 -42
- package/bin/dms-control.mjs +4 -3
- package/dist/db/models/userNotifications.model.js +14 -8
- package/dist/db/models/userNotifications.model.js.map +1 -1
- package/dist/pages/public/auth/not-a-member.d.ts +9 -0
- package/dist/pages/public/auth/not-a-member.js +27 -0
- package/dist/pages/public/auth/not-a-member.js.map +1 -0
- package/dist/pages/public/index.d.ts +1 -0
- package/dist/pages/public/index.js +1 -0
- package/dist/pages/public/index.js.map +1 -1
- package/dist/routes/auth/oauth/identity-resolution.js +10 -0
- package/dist/routes/auth/oauth/identity-resolution.js.map +1 -1
- package/dist/routes/onboarding.js +1 -5
- package/dist/routes/onboarding.js.map +1 -1
- package/dist/utils/ensure-default-tenant.js +23 -3
- package/dist/utils/ensure-default-tenant.js.map +1 -1
- package/frontend-vue/layers/dms-auth/app/build/utils/noWorkspaceRoute.ts +19 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +4 -6
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/not-a-member.vue +21 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/oauth-complete.vue +2 -4
- package/frontend-vue/layers/dms-auth/i18n/locales/auth-en-GB.json +6 -0
- package/frontend-vue/layers/dms-auth/i18n/locales/auth-fr-FR.json +6 -0
- package/frontend-vue/layers/dms-core/app/types/live.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +9 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/live/currentPageLive.ts +7 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/live/pageLiveController.ts +23 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/live/usePageDataRefresh.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +21 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableLiveHold.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/accessibilityPreferences.ts +1 -21
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +8 -4
- package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +35 -7
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +51 -8
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/utils/reducedMotion.ts +22 -0
- package/package.json +4 -4
- package/skills/dms-pages/REFERENCE.md +1 -1
- package/bin/control/verify/publish.mjs +0 -186
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.19.0
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.18.2...v0.19.0)
|
|
6
|
+
|
|
7
|
+
### 🚀 Enhancements
|
|
8
|
+
|
|
9
|
+
- **dms-control:** Serve the dashboard with ajs dms dev under up --dev-frontend ([#829](https://github.com/AntelopeJS/dms/pull/829))
|
|
10
|
+
- **table-view:** Add liveHold.whileOnScreen to let a live table follow its feed on screen ([#808](https://github.com/AntelopeJS/dms/pull/808))
|
|
11
|
+
|
|
12
|
+
### 🩹 Fixes
|
|
13
|
+
|
|
14
|
+
- **verify-dms:** Expect the assistant ask item in the palette no-match journey ([#799](https://github.com/AntelopeJS/dms/pull/799))
|
|
15
|
+
- **notifications:** Undo mark-all-read in one bulk update ([#826](https://github.com/AntelopeJS/dms/pull/826))
|
|
16
|
+
- **dms:** Auto-import isReducedMotionActive for frontend modules ([#823](https://github.com/AntelopeJS/dms/pull/823))
|
|
17
|
+
- **dms-control:** Resolve moduleRoot to the module above a skill playground ([#827](https://github.com/AntelopeJS/dms/pull/827))
|
|
18
|
+
- **preview:** Draw a serialized resource form that reads any path of the site ([#820](https://github.com/AntelopeJS/dms/pull/820))
|
|
19
|
+
- **dms-control:** Key a non-literal module specifier by its structure in the emit fingerprint ([#816](https://github.com/AntelopeJS/dms/pull/816))
|
|
20
|
+
- **dms:** Keep the newest row read when two table row updates answer out of order ([#812](https://github.com/AntelopeJS/dms/pull/812))
|
|
21
|
+
- **dms-ui:** Keep query-only block action links in the browser ([#832](https://github.com/AntelopeJS/dms/pull/832))
|
|
22
|
+
- **chart:** Stop a donut redrawing itself through its parent resize observer ([#835](https://github.com/AntelopeJS/dms/pull/835))
|
|
23
|
+
- **release:** Decide the interface range check as semver does ([#813](https://github.com/AntelopeJS/dms/pull/813))
|
|
24
|
+
- **dms-control:** Let journeys stop and restart the run's mongod ([#831](https://github.com/AntelopeJS/dms/pull/831))
|
|
25
|
+
- **dms-control:** Start the base backend when the base ref has no playground ([#818](https://github.com/AntelopeJS/dms/pull/818))
|
|
26
|
+
- **dms-control:** Start the run's mongod as a single-node replica set ([#830](https://github.com/AntelopeJS/dms/pull/830))
|
|
27
|
+
- **realtime:** Read a page's data again once its subscription is in place ([#810](https://github.com/AntelopeJS/dms/pull/810))
|
|
28
|
+
- **dms-control:** Ship playwright-core as an optional dependency of @antelopejs/dms ([#817](https://github.com/AntelopeJS/dms/pull/817))
|
|
29
|
+
- **auth:** Show a no-workspace screen when no module serves /auth/no-workspace ([#800](https://github.com/AntelopeJS/dms/pull/800))
|
|
30
|
+
- **dms-control:** Fail a formal finding dropped by a check edit instead of counting it fixed ([#821](https://github.com/AntelopeJS/dms/pull/821))
|
|
31
|
+
- **playground:** Load an api that reads RouteHandler.controller ([#819](https://github.com/AntelopeJS/dms/pull/819))
|
|
32
|
+
- **dms-ui:** Build a module drawer's provides from the raw caller provides ([#809](https://github.com/AntelopeJS/dms/pull/809))
|
|
33
|
+
- **dms-control:** Identify each process from the read that finds it, and check it again before each signal ([#801](https://github.com/AntelopeJS/dms/pull/801))
|
|
34
|
+
- **interface-dms:** Answer 400 to a guarded confirmation body that is not a JSON object ([#828](https://github.com/AntelopeJS/dms/pull/828))
|
|
35
|
+
- **interface-dms:** Accept a model row or a PromiseLike from PageRecordLoader ([#815](https://github.com/AntelopeJS/dms/pull/815))
|
|
36
|
+
- **interface-dms:** Refuse upload field options that are not an object ([#825](https://github.com/AntelopeJS/dms/pull/825))
|
|
37
|
+
- **oauth:** Create no account before the platform has its owner ([#807](https://github.com/AntelopeJS/dms/pull/807))
|
|
38
|
+
- **dms:** Stop without waiting for a default tenant provisioning run in progress ([#804](https://github.com/AntelopeJS/dms/pull/804))
|
|
39
|
+
- **tenant-lifecycle:** Name a blocked release and give operators a way to retire it ([#822](https://github.com/AntelopeJS/dms/pull/822))
|
|
40
|
+
- **onboarding:** Keep the register as the one writer of has_onboarded ([#806](https://github.com/AntelopeJS/dms/pull/806))
|
|
41
|
+
|
|
42
|
+
### 💅 Refactors
|
|
43
|
+
|
|
44
|
+
- **iface:** Drop the shape-name suppressions in block-registry describe ([#803](https://github.com/AntelopeJS/dms/pull/803))
|
|
45
|
+
|
|
46
|
+
### 📖 Documentation
|
|
47
|
+
|
|
48
|
+
- Refresh the stale block screenshots ([#802](https://github.com/AntelopeJS/dms/pull/802))
|
|
49
|
+
|
|
50
|
+
### 🏡 Chore
|
|
51
|
+
|
|
52
|
+
- **release:** @antelopejs/interface-dms v0.13.0 ([187e2598](https://github.com/AntelopeJS/dms/commit/187e2598))
|
|
53
|
+
- **dms:** Depend on @antelopejs/interface-dms 0.13 ([#839](https://github.com/AntelopeJS/dms/pull/839))
|
|
54
|
+
|
|
55
|
+
### ✅ Tests
|
|
56
|
+
|
|
57
|
+
- **frontend:** Import the table row actions subject at file load ([#805](https://github.com/AntelopeJS/dms/pull/805))
|
|
58
|
+
|
|
59
|
+
### ❤️ Contributors
|
|
60
|
+
|
|
61
|
+
- Antony Rizzitelli ([@Upd4ting](http://github.com/Upd4ting))
|
|
62
|
+
|
|
63
|
+
## v0.18.2
|
|
64
|
+
|
|
65
|
+
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.18.1...v0.18.2)
|
|
66
|
+
|
|
67
|
+
### 💅 Refactors
|
|
68
|
+
|
|
69
|
+
- **dms-control:** Remove publish, its evidence branch, comment and status ([#838](https://github.com/AntelopeJS/dms/pull/838))
|
|
70
|
+
|
|
71
|
+
### 📖 Documentation
|
|
72
|
+
|
|
73
|
+
- **readme:** Lead with the problem and add animated section banners ([#833](https://github.com/AntelopeJS/dms/pull/833))
|
|
74
|
+
- **readme:** Open on the Helio tour and explain the Connect flow ([#834](https://github.com/AntelopeJS/dms/pull/834))
|
|
75
|
+
- **getting-started:** Title the starter guide "Quickstart" ([#837](https://github.com/AntelopeJS/dms/pull/837))
|
|
76
|
+
|
|
77
|
+
### ❤️ Contributors
|
|
78
|
+
|
|
79
|
+
- Antony Rizzitelli ([@Upd4ting](http://github.com/Upd4ting))
|
|
80
|
+
|
|
3
81
|
## v0.18.1
|
|
4
82
|
|
|
5
83
|
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.18.0...v0.18.1)
|
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ When the backend answers, start the dashboard in a second terminal, from the sam
|
|
|
57
57
|
pnpm frontend:dev # dashboard on http://localhost:3001
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
Open the address that the backend logs after `No owner exists yet`, and create the first administrator. The [Tutorial](https://dms.antelopejs.com/docs/getting-started/tutorial) builds on this project. To start your own project instead, see [
|
|
60
|
+
Open the address that the backend logs after `No owner exists yet`, and create the first administrator. The [Tutorial](https://dms.antelopejs.com/docs/getting-started/tutorial) builds on this project. To start your own project instead, see [Quickstart](https://dms.antelopejs.com/docs/getting-started/quickstart). A page is a class whose static fields are blocks:
|
|
61
61
|
|
|
62
62
|
```ts
|
|
63
63
|
import { PageController, RegisterPage, pagesCategory } from "@antelopejs/interface-dms/page";
|
|
@@ -86,7 +86,7 @@ export class SalesPage extends PageController("sales", {
|
|
|
86
86
|
| `@antelopejs/interface-data-api` | `>=0.6.0 <1.0.0` | `0.6.0` |
|
|
87
87
|
| `@antelopejs/interface-database` | `>=0.3.0 <1.0.0` | `0.3.1` |
|
|
88
88
|
| `@antelopejs/interface-database-decorators` | `>=0.2.0 <1.0.0` | `0.2.1` |
|
|
89
|
-
| `@antelopejs/interface-dms` | `>=0.
|
|
89
|
+
| `@antelopejs/interface-dms` | `>=0.13.0 <0.14.0` | `0.13.0` |
|
|
90
90
|
| `@antelopejs/interface-dms-automation` | `>=0.6.0 <1.0.0` | `0.6.1` |
|
|
91
91
|
| `@antelopejs/interface-email` | `>=0.0.6 <1.0.0` | `0.0.6` |
|
|
92
92
|
| `@antelopejs/interface-file-storage` | `>=0.1.4 <1.0.0` | `0.1.4` |
|
package/bin/control/backend.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { buildChangedSince, missingBuildRoot } from "./build-inputs.mjs";
|
|
2
2
|
import { apiTargetFile, readTarget, writeTarget } from "./forwarder.mjs";
|
|
3
3
|
import { dropDatabase } from "./mongo.mjs";
|
|
4
|
+
import { resolutionFolders } from "./launch.mjs";
|
|
4
5
|
import { killRecorded, stopRecorded } from "./processes.mjs";
|
|
5
6
|
import {
|
|
6
7
|
ensureApi,
|
|
7
8
|
launchBackend,
|
|
8
9
|
liveBackends,
|
|
9
10
|
record,
|
|
10
|
-
resolutionFolders,
|
|
11
11
|
startBackend,
|
|
12
12
|
waitForBackend,
|
|
13
13
|
} from "./stack.mjs";
|
package/bin/control/base.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
|
-
import { join, relative } from "node:path";
|
|
3
|
+
import { basename, join, relative } from "node:path";
|
|
4
4
|
import { git } from "./git.mjs";
|
|
5
5
|
import { runToEnd } from "./processes.mjs";
|
|
6
6
|
import { saveRun } from "./run-state.mjs";
|
|
7
7
|
import { runPrepare } from "./verify/skill.mjs";
|
|
8
|
-
import { layOutCopy } from "./run-copy.mjs";
|
|
9
|
-
import { cliPaths, ENVIRONMENT, spec } from "./
|
|
8
|
+
import { COPY_SKIPPED, layOutCopy } from "./run-copy.mjs";
|
|
9
|
+
import { cliPaths, ENVIRONMENT, spec } from "./launch.mjs";
|
|
10
10
|
import { restartBackend } from "./backend.mjs";
|
|
11
11
|
|
|
12
12
|
const READY_MARK = ".dms-control-ready";
|
|
@@ -19,22 +19,37 @@ function baseCache() {
|
|
|
19
19
|
/**
|
|
20
20
|
* A prepared worktree of the run's base ref, built once per commit under
|
|
21
21
|
* `~/.cache/dms-control/base/<sha>` with the skill's `prepare` commands.
|
|
22
|
+
* When the base ref has no playground folder, as in the change that adds
|
|
23
|
+
* it, the worktree gets a copy of the run's playground before `prepare`,
|
|
24
|
+
* and is built again on every call so the copy follows the run's.
|
|
22
25
|
*
|
|
23
26
|
* @param {import("./run-state.mjs").RunState} state The run
|
|
24
27
|
* @param {import("./verify/skill.mjs").Skill} skill The skill
|
|
25
|
-
* @returns {{ sha: string, dir: string }} The base commit and its
|
|
28
|
+
* @returns {{ sha: string, dir: string, playground: string }} The base commit, its worktree and its playground
|
|
26
29
|
*/
|
|
27
|
-
function baseCheckout(state, skill) {
|
|
30
|
+
export function baseCheckout(state, skill) {
|
|
28
31
|
const sha = git(["rev-parse", `${state.baseRef}^{commit}`], state.repo);
|
|
29
32
|
const dir = join(baseCache(), sha);
|
|
30
|
-
|
|
33
|
+
const path = relative(state.repo, state.playground);
|
|
34
|
+
const playground = join(dir, path);
|
|
35
|
+
const copied =
|
|
36
|
+
git(["ls-tree", "-d", "--name-only", sha, "--", path], state.repo) === "";
|
|
37
|
+
if (!copied && existsSync(join(dir, READY_MARK))) {
|
|
38
|
+
return { sha, dir, playground };
|
|
39
|
+
}
|
|
31
40
|
rmSync(dir, { recursive: true, force: true });
|
|
32
41
|
mkdirSync(baseCache(), { recursive: true });
|
|
33
42
|
git(["worktree", "prune"], state.repo);
|
|
34
43
|
git(["worktree", "add", "--detach", "--force", dir, sha], state.repo);
|
|
44
|
+
if (copied) {
|
|
45
|
+
cpSync(state.playground, playground, {
|
|
46
|
+
recursive: true,
|
|
47
|
+
filter: (source) => !COPY_SKIPPED.has(basename(source)),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
35
50
|
runPrepare(skill, dir);
|
|
36
51
|
writeFileSync(join(dir, READY_MARK), `${sha}\n`);
|
|
37
|
-
return { sha, dir };
|
|
52
|
+
return { sha, dir, playground };
|
|
38
53
|
}
|
|
39
54
|
|
|
40
55
|
/**
|
|
@@ -55,7 +70,7 @@ export async function withBaseBackend(state, skill, action) {
|
|
|
55
70
|
);
|
|
56
71
|
}
|
|
57
72
|
const base = baseCheckout(state, skill);
|
|
58
|
-
const playground =
|
|
73
|
+
const { playground } = base;
|
|
59
74
|
state.baseRoot = join(state.dir, "base-root");
|
|
60
75
|
rmSync(state.baseRoot, { recursive: true, force: true });
|
|
61
76
|
const cwd = layOutCopy(playground, base.dir, state.baseRoot);
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import {
|
|
3
|
+
existsSync,
|
|
4
|
+
mkdirSync,
|
|
5
|
+
mkdtempSync,
|
|
6
|
+
realpathSync,
|
|
7
|
+
rmSync,
|
|
8
|
+
} from "node:fs";
|
|
9
|
+
import { tmpdir } from "node:os";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import test from "node:test";
|
|
12
|
+
import { baseCheckout } from "./base.mjs";
|
|
13
|
+
import { git } from "./git.mjs";
|
|
14
|
+
import { setEnv } from "./helpers/env.mjs";
|
|
15
|
+
import { write } from "./helpers/repo.mjs";
|
|
16
|
+
|
|
17
|
+
const PLAYGROUND = join(".agents", "skills", "verify", "playground");
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A repository whose commit `base` has no playground and whose HEAD adds
|
|
21
|
+
* one, with installed modules left untracked. The base cache is scratch.
|
|
22
|
+
*
|
|
23
|
+
* @param {import("node:test").TestContext} t The test
|
|
24
|
+
* @returns {{ repo: string, playground: string }} Its paths
|
|
25
|
+
*/
|
|
26
|
+
function repoWithNewPlayground(t) {
|
|
27
|
+
const root = realpathSync(
|
|
28
|
+
mkdtempSync(join(tmpdir(), "dms-control-base-test-")),
|
|
29
|
+
);
|
|
30
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
31
|
+
setEnv(t, { XDG_CACHE_HOME: join(root, "cache") });
|
|
32
|
+
const repo = join(root, "repo");
|
|
33
|
+
mkdirSync(repo);
|
|
34
|
+
git(["init", "-q", "-b", "main"], repo);
|
|
35
|
+
git(["config", "user.email", "test@example.com"], repo);
|
|
36
|
+
git(["config", "user.name", "test"], repo);
|
|
37
|
+
write(join(repo, "README.md"), "base\n");
|
|
38
|
+
git(["add", "."], repo);
|
|
39
|
+
git(["commit", "-q", "-m", "base"], repo);
|
|
40
|
+
git(["tag", "base"], repo);
|
|
41
|
+
const playground = join(repo, PLAYGROUND);
|
|
42
|
+
write(join(playground, "antelope.config.ts"), "head\n");
|
|
43
|
+
write(join(playground, ".gitignore"), "node_modules\n");
|
|
44
|
+
write(join(playground, "node_modules", "zod", "package.json"), "{}");
|
|
45
|
+
git(["add", "."], repo);
|
|
46
|
+
git(["commit", "-q", "-m", "add the playground"], repo);
|
|
47
|
+
return { repo, playground };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
await test("a base ref without the playground prepares a copy of the run's playground", (t) => {
|
|
51
|
+
const { repo, playground } = repoWithNewPlayground(t);
|
|
52
|
+
const prepare = [
|
|
53
|
+
["grep", "-qx", "head", join(PLAYGROUND, "antelope.config.ts")],
|
|
54
|
+
["grep", "-qx", "base", "README.md"],
|
|
55
|
+
];
|
|
56
|
+
const base = baseCheckout(
|
|
57
|
+
{ repo, playground, baseRef: "base" },
|
|
58
|
+
{ config: { prepare } },
|
|
59
|
+
);
|
|
60
|
+
assert.equal(base.sha, git(["rev-parse", "base"], repo));
|
|
61
|
+
assert.equal(base.playground, join(base.dir, PLAYGROUND));
|
|
62
|
+
assert.equal(existsSync(join(base.playground, "node_modules")), false);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
await test("a copied base playground follows the run's playground from one run to the next", (t) => {
|
|
66
|
+
const { repo, playground } = repoWithNewPlayground(t);
|
|
67
|
+
const state = { repo, playground, baseRef: "base" };
|
|
68
|
+
baseCheckout(state, { config: { prepare: [] } });
|
|
69
|
+
write(join(playground, "antelope.config.ts"), "edited\n");
|
|
70
|
+
const base = baseCheckout(state, {
|
|
71
|
+
config: {
|
|
72
|
+
prepare: [
|
|
73
|
+
["grep", "-qx", "edited", join(PLAYGROUND, "antelope.config.ts")],
|
|
74
|
+
["touch", "prepared"],
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
assert.equal(existsSync(join(base.dir, "prepared")), true);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
await test("a base ref that has the playground is built once", (t) => {
|
|
82
|
+
const { repo, playground } = repoWithNewPlayground(t);
|
|
83
|
+
const state = { repo, playground, baseRef: "HEAD" };
|
|
84
|
+
const first = baseCheckout(state, { config: { prepare: [] } });
|
|
85
|
+
write(join(first.playground, "prepared"), "");
|
|
86
|
+
const second = baseCheckout(state, { config: { prepare: [["false"]] } });
|
|
87
|
+
assert.equal(existsSync(join(second.playground, "prepared")), true);
|
|
88
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isOutcome } from "./browser-wire.mjs";
|
|
2
2
|
import { decode } from "./json.mjs";
|
|
3
|
-
import { CONTROL_BIN } from "./
|
|
3
|
+
import { CONTROL_BIN } from "./launch.mjs";
|
|
4
4
|
import { isSameProcess } from "./identity.mjs";
|
|
5
5
|
import { freePort, startDetached, waitForOk } from "./processes.mjs";
|
|
6
6
|
import { saveRun } from "./run-state.mjs";
|
|
@@ -7,7 +7,8 @@ import { setUpFrontendWorkspace } from "./frontend-workspace.mjs";
|
|
|
7
7
|
import { capturedMail, serveMail } from "./mail.mjs";
|
|
8
8
|
import { loadRun } from "./run-state.mjs";
|
|
9
9
|
import { apiRequest, isOk, onboard } from "./session.mjs";
|
|
10
|
-
import {
|
|
10
|
+
import { resolutionFolders } from "./launch.mjs";
|
|
11
|
+
import { down, up } from "./stack.mjs";
|
|
11
12
|
import { freshDatabase } from "./backend.mjs";
|
|
12
13
|
import { apiTargetFile, serveForwarder } from "./forwarder.mjs";
|
|
13
14
|
import { formatTimings, readTimings, summarize, timed } from "./timing.mjs";
|
|
@@ -72,6 +73,7 @@ async function commandUp(values) {
|
|
|
72
73
|
values["no-standby"] === true ||
|
|
73
74
|
process.env.DMS_CONTROL_NO_STANDBY === "1",
|
|
74
75
|
buildCache: !values["no-build-cache"],
|
|
76
|
+
frontendMode: values["dev-frontend"] ? "dev" : "build",
|
|
75
77
|
});
|
|
76
78
|
if (state.frontendBuild?.reason) {
|
|
77
79
|
process.stderr.write(
|
|
@@ -11,12 +11,6 @@ import {
|
|
|
11
11
|
} from "./verify/formal.mjs";
|
|
12
12
|
import { readJudgement } from "./verify/judgement.mjs";
|
|
13
13
|
import { checkMap, planFor } from "./verify/map.mjs";
|
|
14
|
-
import {
|
|
15
|
-
postComment,
|
|
16
|
-
pushEvidence,
|
|
17
|
-
readStatus,
|
|
18
|
-
setStatus,
|
|
19
|
-
} from "./verify/publish.mjs";
|
|
20
14
|
import { journeysFile, loadSkill } from "./verify/skill.mjs";
|
|
21
15
|
import { renderVerdict } from "./verify/verdict.mjs";
|
|
22
16
|
|
|
@@ -146,15 +140,14 @@ async function commandFormal(dir, values) {
|
|
|
146
140
|
}
|
|
147
141
|
|
|
148
142
|
/**
|
|
149
|
-
* @param {string} command `verdict` or `publish`
|
|
150
143
|
* @param {string} dir The run root
|
|
151
144
|
* @param {Values} values The options of the command line
|
|
152
145
|
* @returns {Promise<number>} The exit code
|
|
153
146
|
*/
|
|
154
|
-
async function
|
|
147
|
+
async function commandVerdict(dir, values) {
|
|
155
148
|
const pr = Number(values.pr);
|
|
156
149
|
if (!Number.isInteger(pr) || pr <= 0) {
|
|
157
|
-
print(
|
|
150
|
+
print("verdict needs --pr <number>");
|
|
158
151
|
return 2;
|
|
159
152
|
}
|
|
160
153
|
const state = loadRun(dir);
|
|
@@ -167,22 +160,12 @@ async function commandJudge(command, dir, values) {
|
|
|
167
160
|
values.all,
|
|
168
161
|
);
|
|
169
162
|
print(verdict.markdown);
|
|
170
|
-
|
|
171
|
-
print(`evidence commit ${pushEvidence(skill, state, verdict)}`);
|
|
172
|
-
const comment = postComment(skill, verdict);
|
|
173
|
-
print(`comment ${comment}`);
|
|
174
|
-
const error = setStatus(skill, verdict, comment);
|
|
175
|
-
if (error)
|
|
176
|
-
print(`FAIL status verify on ${verdict.headSha} not set: ${error}`);
|
|
177
|
-
print(
|
|
178
|
-
`status verify on ${verdict.headSha}: ${readStatus(skill, verdict.headSha)}`,
|
|
179
|
-
);
|
|
180
|
-
return error || verdict.result === "FAIL" ? 1 : 0;
|
|
163
|
+
return verdict.result === "FAIL" ? 1 : 0;
|
|
181
164
|
}
|
|
182
165
|
|
|
183
166
|
/**
|
|
184
167
|
* Runs a command of the verification harness: `map`, `plan`, `journey`,
|
|
185
|
-
* `doors`, `formal
|
|
168
|
+
* `doors`, `formal` and `verdict`.
|
|
186
169
|
*
|
|
187
170
|
* @param {string} command The command
|
|
188
171
|
* @param {string[]} rest Its positional arguments
|
|
@@ -202,8 +185,7 @@ export function runVerifyCommand(command, rest, values) {
|
|
|
202
185
|
case "formal":
|
|
203
186
|
return commandFormal(rest[0], values);
|
|
204
187
|
case "verdict":
|
|
205
|
-
|
|
206
|
-
return commandJudge(command, rest[0], values);
|
|
188
|
+
return commandVerdict(rest[0], values);
|
|
207
189
|
default:
|
|
208
190
|
return Promise.resolve(undefined);
|
|
209
191
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { cpSync, mkdirSync, mkdtempSync, rmSync, symlinkSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
import manifest from "../../package.json" with { type: "json" };
|
|
9
|
+
import { PACKAGE_ROOT } from "./launch.mjs";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A module repository that depends on `@antelopejs/dms` and declares nothing
|
|
13
|
+
* else: the installed copy gets the `bin` folder it publishes and, beside it,
|
|
14
|
+
* the dependencies an install of that kind gives a dependency.
|
|
15
|
+
*
|
|
16
|
+
* @param {import("node:test").TestContext} t
|
|
17
|
+
* @param {Record<string, string>[]} installed Each dependency list of the manifest the install honours
|
|
18
|
+
* @returns {string} The output of resolving playwright-core the way dms-control does, or its error
|
|
19
|
+
*/
|
|
20
|
+
function resolveFromConsumer(t, installed) {
|
|
21
|
+
const moduleRoot = mkdtempSync(join(tmpdir(), "dms-control-consumer-"));
|
|
22
|
+
t.after(() => rmSync(moduleRoot, { recursive: true, force: true }));
|
|
23
|
+
const dms = join(moduleRoot, "node_modules", "@antelopejs", "dms");
|
|
24
|
+
mkdirSync(dms, { recursive: true });
|
|
25
|
+
cpSync(join(PACKAGE_ROOT, "bin"), join(dms, "bin"), { recursive: true });
|
|
26
|
+
cpSync(join(PACKAGE_ROOT, "package.json"), join(dms, "package.json"));
|
|
27
|
+
for (const name of installed.flatMap((list) => Object.keys(list))) {
|
|
28
|
+
const link = join(dms, "node_modules", name);
|
|
29
|
+
mkdirSync(join(link, ".."), { recursive: true });
|
|
30
|
+
symlinkSync(join(PACKAGE_ROOT, "node_modules", name), link, "dir");
|
|
31
|
+
}
|
|
32
|
+
const mongo = pathToFileURL(join(dms, "bin", "control", "mongo.mjs"));
|
|
33
|
+
const from = [join(moduleRoot, ".agents", "playground"), moduleRoot, dms];
|
|
34
|
+
const run = spawnSync(
|
|
35
|
+
process.execPath,
|
|
36
|
+
[
|
|
37
|
+
"--input-type=module",
|
|
38
|
+
"--eval",
|
|
39
|
+
`const { importFrom } = await import(${JSON.stringify(mongo.href)});
|
|
40
|
+
try {
|
|
41
|
+
const { chromium } = await importFrom("playwright-core", ${JSON.stringify(from)});
|
|
42
|
+
process.stdout.write(chromium.name());
|
|
43
|
+
} catch (error) {
|
|
44
|
+
process.stdout.write(error.message);
|
|
45
|
+
}`,
|
|
46
|
+
],
|
|
47
|
+
{ cwd: moduleRoot, encoding: "utf8" },
|
|
48
|
+
);
|
|
49
|
+
return run.stdout;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
await test("dms-control resolves playwright-core for a module whose install of @antelopejs/dms keeps optional dependencies", (t) => {
|
|
53
|
+
assert.equal(
|
|
54
|
+
resolveFromConsumer(t, [
|
|
55
|
+
manifest.dependencies,
|
|
56
|
+
manifest.optionalDependencies,
|
|
57
|
+
]),
|
|
58
|
+
"chromium",
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
await test("dms-control names the install command when the install of @antelopejs/dms omitted optional dependencies", (t) => {
|
|
63
|
+
const spec = `playwright-core@${manifest.optionalDependencies["playwright-core"]}`;
|
|
64
|
+
const message = resolveFromConsumer(t, [manifest.dependencies]);
|
|
65
|
+
assert.ok(
|
|
66
|
+
message.includes(`npm install --save-dev ${spec}`),
|
|
67
|
+
`the error names the npm command: ${message}`,
|
|
68
|
+
);
|
|
69
|
+
assert.ok(
|
|
70
|
+
message.includes(`pnpm add --save-dev ${spec}`),
|
|
71
|
+
`the error names the pnpm command: ${message}`,
|
|
72
|
+
);
|
|
73
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { apiTargetFile, readTarget } from "./forwarder.mjs";
|
|
2
|
+
import { isSameProcess } from "./identity.mjs";
|
|
3
|
+
import { startMongod } from "./mongo.mjs";
|
|
4
|
+
import { killRecorded, stopRecorded } from "./processes.mjs";
|
|
5
|
+
import { resolutionFolders } from "./launch.mjs";
|
|
6
|
+
import { liveBackends, record } from "./stack.mjs";
|
|
7
|
+
|
|
8
|
+
/** @typedef {import("./run-state.mjs").RunState} RunState */
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {RunState} state The run
|
|
12
|
+
* @returns {import("./run-state.mjs").ServerRecord} The mongod the run started
|
|
13
|
+
* @throws When the run uses a server it does not own (`--mongo-url`) or recorded no mongod
|
|
14
|
+
*/
|
|
15
|
+
function ownedMongod(state) {
|
|
16
|
+
if (!state.ownsMongo) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"this run uses --mongo-url: it does not own the server, so it neither stops nor starts it",
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
const mongod = state.processes.find((entry) => entry.name === "mongod");
|
|
22
|
+
if (mongod?.port === undefined) {
|
|
23
|
+
throw new Error("this run recorded no mongod");
|
|
24
|
+
}
|
|
25
|
+
return { ...mongod, port: mongod.port };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Stops the run's mongod, as a crash of the database would: the backend the
|
|
30
|
+
* API forwards to loses its connection until {@link startDatabase}. Every
|
|
31
|
+
* other backend, such as the next database's standby, is killed first, so
|
|
32
|
+
* none that booted without its database is ever promoted. The mongod's
|
|
33
|
+
* record stays, and stopping a mongod that no longer runs signals nothing.
|
|
34
|
+
*
|
|
35
|
+
* @param {RunState} state The run
|
|
36
|
+
* @returns {Promise<void>} Resolves once mongod no longer runs
|
|
37
|
+
* @throws When the run does not own its server, before it stops anything
|
|
38
|
+
*/
|
|
39
|
+
export async function stopDatabase(state) {
|
|
40
|
+
const mongod = ownedMongod(state);
|
|
41
|
+
const target = readTarget(apiTargetFile(state.dir));
|
|
42
|
+
await killRecorded(
|
|
43
|
+
liveBackends(state).filter((backend) => backend.port !== target),
|
|
44
|
+
);
|
|
45
|
+
await stopRecorded([mongod]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Starts the run's mongod again on its port and data folder, so the URL the
|
|
50
|
+
* backend holds reaches it and the data written before is still there. A
|
|
51
|
+
* mongod that still runs is kept.
|
|
52
|
+
*
|
|
53
|
+
* @param {RunState} state The run
|
|
54
|
+
* @returns {Promise<void>} Resolves once mongod listens
|
|
55
|
+
* @throws When the run does not own its server
|
|
56
|
+
*/
|
|
57
|
+
export async function startDatabase(state) {
|
|
58
|
+
const mongod = ownedMongod(state);
|
|
59
|
+
if (isSameProcess(mongod)) return;
|
|
60
|
+
const started = await startMongod(
|
|
61
|
+
state,
|
|
62
|
+
resolutionFolders(state),
|
|
63
|
+
mongod.port,
|
|
64
|
+
);
|
|
65
|
+
record(state, started.record);
|
|
66
|
+
}
|
package/bin/control/doctor.mjs
CHANGED
|
@@ -203,6 +203,13 @@ async function freshnessLines(state) {
|
|
|
203
203
|
* @param {number} frontendSources
|
|
204
204
|
*/
|
|
205
205
|
async function frontendBuildLine(state, frontendBuild, frontendSources) {
|
|
206
|
+
if (state.frontendMode === "dev") {
|
|
207
|
+
return line(
|
|
208
|
+
"frontend serves the sources with ajs dms dev",
|
|
209
|
+
true,
|
|
210
|
+
"no build to compare",
|
|
211
|
+
);
|
|
212
|
+
}
|
|
206
213
|
const recorded = state.frontendBuild;
|
|
207
214
|
if (!recorded?.key) {
|
|
208
215
|
return line(
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
WORKSPACE_FOLDER,
|
|
9
9
|
} from "./build-key.mjs";
|
|
10
10
|
import { layOutCopy } from "./run-copy.mjs";
|
|
11
|
-
import { frontendPackage
|
|
11
|
+
import { frontendPackage } from "./launch.mjs";
|
|
12
|
+
import { workspaceSetup } from "./stack.mjs";
|
|
12
13
|
|
|
13
14
|
const SUFFIX_BYTES = 4;
|
|
14
15
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { newRun } from "./helpers/fake-run.mjs";
|
|
4
|
+
import { loadRun, saveRun } from "./run-state.mjs";
|
|
5
|
+
import { cliPaths } from "./launch.mjs";
|
|
6
|
+
import { frontendSpec } from "./stack.mjs";
|
|
7
|
+
|
|
8
|
+
await test("a run in dev mode serves its dashboard with ajs dms dev on its web port against its API, after a reload of run.json", async (t) => {
|
|
9
|
+
const state = await newRun(t);
|
|
10
|
+
state.frontendMode = "dev";
|
|
11
|
+
state.webPort = 4321;
|
|
12
|
+
saveRun(state);
|
|
13
|
+
const loaded = loadRun(state.dir);
|
|
14
|
+
assert.deepEqual(frontendSpec(loaded).args, [
|
|
15
|
+
cliPaths(state.playground).dms,
|
|
16
|
+
"dev",
|
|
17
|
+
"-e",
|
|
18
|
+
"docs",
|
|
19
|
+
"-b",
|
|
20
|
+
state.apiUrl,
|
|
21
|
+
"-p",
|
|
22
|
+
"4321",
|
|
23
|
+
]);
|
|
24
|
+
});
|