@intentius/chant 0.123.0 → 0.124.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/dist/cli/commands/check-lexicon.d.ts.map +1 -1
- package/dist/config-import.d.ts +1 -1
- package/dist/lint/policy-import.d.ts +1 -1
- package/dist/notify-verify.js +76 -0
- package/dist/notify.js +307 -0
- package/dist/op/__fixtures__/decide-stub-backend.d.ts +1 -1
- package/dist/op/index.d.ts +4 -4
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/op-waves-run.d.ts +134 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves.d.ts +14 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/pr-forge.d.ts +30 -3
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/workspace/conformance/__fixtures__/reference-broker.d.ts +1 -1
- package/dist/workspace/conformance/broker.d.ts +1 -1
- package/package.json +14 -2
- package/src/cli/commands/check-lexicon.ts +3 -1
- package/src/cli/commands/lint-post-synth.e2e.test.ts +117 -0
- package/src/cli/commands/lint.test.ts +4 -109
- package/src/cli/discovery-skip.e2e.test.ts +18 -3
- package/src/config-import.ts +1 -1
- package/src/discovery/sandbox/run.test.ts +1 -1
- package/src/lint/policy-import.ts +1 -1
- package/src/notify-plain-node.e2e.test.ts +68 -0
- package/src/op/__fixtures__/decide-stub-backend.ts +1 -1
- package/src/op/index.ts +18 -2
- package/src/op/op-waves-run.ts +454 -83
- package/src/op/op-waves.test.ts +191 -1
- package/src/op/op-waves.ts +29 -1
- package/src/pr-forge.test.ts +76 -1
- package/src/pr-forge.ts +52 -8
- package/src/workspace/conformance/__fixture__/decisions/decision.kind.mjs +1 -1
- package/src/workspace/conformance/__fixtures__/reference-broker.ts +1 -1
- package/src/workspace/conformance/broker.ts +1 -1
- package/src/workspace/records-write.e2e.test.ts +1 -1
- /package/src/audit/{catalog.test.ts → catalog.e2e.test.ts} +0 -0
- /package/src/audit/{discover.test.ts → discover.e2e.test.ts} +0 -0
- /package/src/audit/{remote-discovery.test.ts → remote-discovery.e2e.test.ts} +0 -0
- /package/src/audit/{rules-doc.test.ts → rules-doc.e2e.test.ts} +0 -0
- /package/src/{bench.test.ts → bench.e2e.test.ts} +0 -0
- /package/src/cli/commands/{check-lexicon-doc-drift.test.ts → check-lexicon-doc-drift.e2e.test.ts} +0 -0
- /package/src/cli/commands/{import.test.ts → import.e2e.test.ts} +0 -0
- /package/src/cli/{component-security-boundary.test.ts → component-security-boundary.e2e.test.ts} +0 -0
- /package/src/cli/mcp/{workspace-tools.test.ts → workspace-tools.e2e.test.ts} +0 -0
- /package/src/cli/{security-boundary.test.ts → security-boundary.e2e.test.ts} +0 -0
- /package/src/cli/{serve-mcp-workspace.test.ts → serve-mcp-workspace.e2e.test.ts} +0 -0
- /package/src/cli/{static-config-read.test.ts → static-config-read.e2e.test.ts} +0 -0
- /package/src/codegen/{json-schema-to-ts.test.ts → json-schema-to-ts.e2e.test.ts} +0 -0
- /package/src/{lexicon-seams.test.ts → lexicon-seams.e2e.test.ts} +0 -0
- /package/src/meta/{declared-imports.test.ts → declared-imports.e2e.test.ts} +0 -0
- /package/src/op/{command-gate.test.ts → command-gate.e2e.test.ts} +0 -0
- /package/src/op/{steward-beside.test.ts → steward-beside.e2e.test.ts} +0 -0
- /package/src/op/{steward-points.test.ts → steward-points.e2e.test.ts} +0 -0
- /package/src/workspace/{checks.test.ts → checks.e2e.test.ts} +0 -0
- /package/src/workspace/{intent-reviews.test.ts → intent-reviews.e2e.test.ts} +0 -0
- /package/src/workspace/{profiles.test.ts → profiles.e2e.test.ts} +0 -0
- /package/src/workspace/{read-contract.test.ts → read-contract.e2e.test.ts} +0 -0
- /package/src/workspace/{records-contract.test.ts → records-contract.e2e.test.ts} +0 -0
- /package/src/workspace/{records-since.test.ts → records-since.e2e.test.ts} +0 -0
- /package/src/workspace/{records-write.test.ts → records-write-commands.e2e.test.ts} +0 -0
- /package/src/workspace/{work-size.test.ts → work-size.e2e.test.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"op-waves-run.d.ts","sourceRoot":"","sources":["../../src/op/op-waves-run.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"op-waves-run.d.ts","sourceRoot":"","sources":["../../src/op/op-waves-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAKH,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EAAmD,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE9F,OAAO,KAAK,EAAE,SAAS,EAAgB,YAAY,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAWL,KAAK,kBAAkB,EAEvB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,gBAAgB,EAErB,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAEpB,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gCAAgC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,4HAA4H;AAC5H,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,CAAC,cAAc,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAED,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe;IACf,MAAM,EAAE,MAAM,CAAC;IACf,oHAAoH;IACpH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,IAAI,EAAE,KAAK,CAAC;QAAE,MAAM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AKvG;AAWD,mEAAmE;AACnE,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAiHnF;AA6XD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,+HAA+H;IAC/H,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC,CAmB/F"}
|
package/dist/op/op-waves.d.ts
CHANGED
|
@@ -95,6 +95,14 @@ export type OpWaveHookStage = "plan" | "apply";
|
|
|
95
95
|
/** When a hook runs. */
|
|
96
96
|
export type OpWaveHookMoment = "before-plan" | "after-plan" | "before-apply" | "after-apply";
|
|
97
97
|
export declare const OP_WAVE_HOOK_MOMENTS: readonly OpWaveHookMoment[];
|
|
98
|
+
/**
|
|
99
|
+
* Who runs the `before.apply` and `after.apply` hooks (#3804). `chant`: the
|
|
100
|
+
* wave job, around the apply command. `apply`: the apply command itself,
|
|
101
|
+
* under its own lock, through `runOpWaveApplyHooks` and the file named by
|
|
102
|
+
* `CHANT_HOOKS`; it writes the outcomes back to `CHANT_HOOKS_RESULT`.
|
|
103
|
+
*/
|
|
104
|
+
export type OpWaveApplyHooksRunner = "chant" | "apply";
|
|
105
|
+
export declare const OP_WAVE_APPLY_HOOKS_RUNNERS: readonly OpWaveApplyHooksRunner[];
|
|
98
106
|
/** Stage hooks (#3762), read from the spec at the base commit like the gate policy. */
|
|
99
107
|
export interface OpWaveHooks {
|
|
100
108
|
before?: {
|
|
@@ -105,6 +113,10 @@ export interface OpWaveHooks {
|
|
|
105
113
|
plan?: OpWaveHook[];
|
|
106
114
|
apply?: OpWaveHook[];
|
|
107
115
|
};
|
|
116
|
+
/** Who runs the apply-stage hooks (#3804). Default `{ runBy: "chant" }`. A wave's own setting wins over the spec's. */
|
|
117
|
+
apply?: {
|
|
118
|
+
runBy?: OpWaveApplyHooksRunner;
|
|
119
|
+
};
|
|
108
120
|
}
|
|
109
121
|
/** One Op run in a wave: an Op applied to one target (an environment, a database, a tenant). */
|
|
110
122
|
export interface OpWaveRun {
|
|
@@ -258,6 +270,8 @@ export declare function assertOpWavesSpec(spec: OpWavesSpec): void;
|
|
|
258
270
|
export declare function assertOpWaveHooks(where: string, hooks: OpWaveHooks | undefined): void;
|
|
259
271
|
/** The hooks of each moment for wave `name`: the spec's, then the wave's own. */
|
|
260
272
|
export declare function opWaveHooksAt(spec: Pick<OpWavesSpec, "hooks" | "waves">, name: string): Record<OpWaveHookMoment, OpWaveHook[]>;
|
|
273
|
+
/** Who runs wave `name`'s apply-stage hooks (#3804): the wave's `hooks.apply.runBy`, else the spec's, else `chant`. */
|
|
274
|
+
export declare function opWaveApplyHooksRunBy(spec: Pick<OpWavesSpec, "hooks" | "waves">, name: string): OpWaveApplyHooksRunner;
|
|
261
275
|
/**
|
|
262
276
|
* The runs share `share` (1-based) of `shares` applies: the wave's runs sorted
|
|
263
277
|
* by target, cut into contiguous slices whose sizes differ by at most one.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"op-waves.d.ts","sourceRoot":"","sources":["../../src/op/op-waves.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAEnE,yCAAyC;AACzC,MAAM,MAAM,gBAAgB;AAC1B,2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AE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,CA0B3E;AAED,iCAAiC;AACjC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,MAAM,CAEhF"}
|
package/dist/pr-forge.d.ts
CHANGED
|
@@ -72,6 +72,14 @@ export interface CommentResult {
|
|
|
72
72
|
/** Its web URL, when the forge's answer carries one (GitHub and Forgejo do; a GitLab note does not). */
|
|
73
73
|
url?: string;
|
|
74
74
|
}
|
|
75
|
+
/** A comment or note {@link PrForge.findComment} read back. */
|
|
76
|
+
export interface FoundComment {
|
|
77
|
+
/** The comment's or note's id. */
|
|
78
|
+
id: number;
|
|
79
|
+
body: string;
|
|
80
|
+
/** Its web URL, when the forge's answer carries one (GitHub and Forgejo do; a GitLab note does not). */
|
|
81
|
+
url?: string;
|
|
82
|
+
}
|
|
75
83
|
/** A finding to keep in a tracking issue. `body` carries the marker. */
|
|
76
84
|
export interface IssueFinding {
|
|
77
85
|
title: string;
|
|
@@ -87,6 +95,15 @@ export interface TrackIssueOptions extends MarkerMatch {
|
|
|
87
95
|
closeOnClear?: boolean;
|
|
88
96
|
/** Posted on the issue before it is closed. */
|
|
89
97
|
clearComment?: string;
|
|
98
|
+
/**
|
|
99
|
+
* When the open issue counts as already current, in place of an equal
|
|
100
|
+
* title and body, for a body that names something that changes on every
|
|
101
|
+
* run (the run's URL, a timestamp). A string: unchanged when the titles
|
|
102
|
+
* are equal and the open issue's body carries it, such as the finding's
|
|
103
|
+
* fingerprint. A function: unchanged when it returns true for the open
|
|
104
|
+
* issue and the finding. An unchanged issue is not edited.
|
|
105
|
+
*/
|
|
106
|
+
sameWhen?: string | ((open: IssueFinding, finding: IssueFinding) => boolean);
|
|
90
107
|
}
|
|
91
108
|
/** What {@link PrForge.trackIssue} did. */
|
|
92
109
|
export interface IssueResult {
|
|
@@ -122,6 +139,14 @@ export interface PrForge {
|
|
|
122
139
|
* comment's web URL. The pull-request loop's form.
|
|
123
140
|
*/
|
|
124
141
|
upsertNote(pr: number, marker: string, body: string): Promise<string | undefined>;
|
|
142
|
+
/**
|
|
143
|
+
* The comment on pull request `pr` (the note on merge request `pr`) that
|
|
144
|
+
* {@link upsertComment} would update for `marker`: the oldest one that
|
|
145
|
+
* {@link MarkerMatch} finds, `author` honoured, so a pull request's author
|
|
146
|
+
* cannot plant one. Undefined when there is none. Every page is read, and
|
|
147
|
+
* GitLab's system notes are skipped.
|
|
148
|
+
*/
|
|
149
|
+
findComment(pr: number, marker: string, opts?: MarkerMatch): Promise<FoundComment | undefined>;
|
|
125
150
|
setStatus(sha: string, status: ForgeStatus): Promise<void>;
|
|
126
151
|
/**
|
|
127
152
|
* Keep one OPEN tracking issue for `marker` in line with `finding`: open
|
|
@@ -253,9 +278,11 @@ export interface ForgeTargetOptions {
|
|
|
253
278
|
readFile?: (path: string) => string;
|
|
254
279
|
}
|
|
255
280
|
/**
|
|
256
|
-
* The token order guide/ops documents
|
|
257
|
-
* a chant-specific variable first, for posting to an instance other than
|
|
258
|
-
* one the job runs on, then what the job already carries.
|
|
281
|
+
* The token order {@link forgeTargetFromEnv} reads, as guide/ops documents
|
|
282
|
+
* it: a chant-specific variable first, for posting to an instance other than
|
|
283
|
+
* the one the job runs on, then what the job already carries (#3802). A
|
|
284
|
+
* Forgejo job reads `FORGEJO_TOKEN` before the `GITHUB_*` names, and the
|
|
285
|
+
* GitHub row has its own chant variable rather than the Forgejo one.
|
|
259
286
|
*/
|
|
260
287
|
export declare const FORGE_TOKEN_ORDER: Record<ForgeKind, readonly string[]>;
|
|
261
288
|
/**
|
package/dist/pr-forge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-forge.d.ts","sourceRoot":"","sources":["../src/pr-forge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,MAAM,MAAM,SAAS,GAAG,QAAQ,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AAK,MAAM,CAAC;CACrC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAIlE,CAAC;AAoBF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,GAAiB,EAAE,IAAI,GAAE,kBAAuB,GAAG,WAAW,CAuErG;AAED,8FAA8F;AAC9F,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,OAAO,CAgBhF"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* It is a test fixture and the package does not export it: chant never runs
|
|
10
10
|
* a broker or listens on a port (ws-052, ws-086), so it lives under
|
|
11
|
-
* `__fixtures__`, which test/no-listener.test.ts leaves out like a test file.
|
|
11
|
+
* `__fixtures__`, which test/no-listener.e2e.test.ts leaves out like a test file.
|
|
12
12
|
* `startReferenceBroker(env)` has the shape of the suite's `start`.
|
|
13
13
|
*/
|
|
14
14
|
import type { BrokerConformanceEnv, StartedBroker } from "../broker.js";
|
|
@@ -167,7 +167,7 @@ export type BrokerHttpHandler = (req: IncomingMessage, res: ServerResponse) => v
|
|
|
167
167
|
/**
|
|
168
168
|
* How the suite serves its upstreams: serve `handler` on a loopback port and
|
|
169
169
|
* return its URL and how to stop it. The caller passes it because chant
|
|
170
|
-
* itself never listens on a port (ws-052, ws-086, test/no-listener.test.ts);
|
|
170
|
+
* itself never listens on a port (ws-052, ws-086, test/no-listener.e2e.test.ts);
|
|
171
171
|
* the test that runs the suite does.
|
|
172
172
|
*/
|
|
173
173
|
export type BrokerListen = (handler: BrokerHttpHandler) => Promise<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.124.1",
|
|
4
4
|
"description": "Declarative infrastructure-as-code toolkit — TypeScript on Node.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -96,6 +96,18 @@
|
|
|
96
96
|
"types": "./dist/agents/index.d.ts",
|
|
97
97
|
"default": "./src/agents/index.ts"
|
|
98
98
|
},
|
|
99
|
+
"./notify-verify": {
|
|
100
|
+
"development": "./src/notify-verify.ts",
|
|
101
|
+
"types": "./dist/notify-verify.d.ts",
|
|
102
|
+
"import": "./dist/notify-verify.js",
|
|
103
|
+
"default": "./src/notify-verify.ts"
|
|
104
|
+
},
|
|
105
|
+
"./notify": {
|
|
106
|
+
"development": "./src/notify.ts",
|
|
107
|
+
"types": "./dist/notify.d.ts",
|
|
108
|
+
"import": "./dist/notify.js",
|
|
109
|
+
"default": "./src/notify.ts"
|
|
110
|
+
},
|
|
99
111
|
"./*": {
|
|
100
112
|
"development": "./src/*.ts",
|
|
101
113
|
"types": "./dist/*.d.ts",
|
|
@@ -103,7 +115,7 @@
|
|
|
103
115
|
}
|
|
104
116
|
},
|
|
105
117
|
"scripts": {
|
|
106
|
-
"build": "../../scripts/tsc7.sh -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && find dist -type f \\( -name \"*.js\" -o -name \"*.js.map\" \\) -delete",
|
|
118
|
+
"build": "../../scripts/tsc7.sh -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && find dist -type f \\( -name \"*.js\" -o -name \"*.js.map\" \\) ! -path dist/notify.js ! -path dist/notify-verify.js -delete",
|
|
107
119
|
"prepack": "npm run build"
|
|
108
120
|
},
|
|
109
121
|
"dependencies": {
|
|
@@ -709,7 +709,9 @@ export async function checkLexicon(dir: string): Promise<CheckResult> {
|
|
|
709
709
|
pass: hasTypecheckTest,
|
|
710
710
|
});
|
|
711
711
|
|
|
712
|
-
|
|
712
|
+
// A round trip over a large corpus can be an end-to-end test, kept out of the unit project's
|
|
713
|
+
// per-test budget under the e2e name.
|
|
714
|
+
const hasRoundtripTest = findFiles(join(dir, "src"), (n) => n === "roundtrip.test.ts" || n === "roundtrip.e2e.test.ts").length > 0;
|
|
713
715
|
items.push({
|
|
714
716
|
name: "roundtrip.test.ts exists",
|
|
715
717
|
tier: 3,
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { lintCommand, BUILD_FAILURE_RULE_ID } from "./lint";
|
|
3
|
+
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { mkdtempSync, realpathSync, symlinkSync } from "node:fs";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
// Each case builds a small project against the workspace's sql lexicon and runs its post-synth
|
|
10
|
+
// checks; the first loads the lexicon and took 3.1s on CI, near the unit project's 5s budget, so the
|
|
11
|
+
// block is an e2e file (#3793). The rest of lintCommand's tests are in lint.test.ts.
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* chant #3750 — `chant lint` runs each loaded lexicon's own post-synth checks
|
|
15
|
+
* over an in-memory build of the lint target, the ones `chant build` runs.
|
|
16
|
+
* The sql lexicon's SQLCH101 is the issue's repro: `ENGINE = MergeTre` failed
|
|
17
|
+
* the build and linted clean. The project imports the workspace's sql
|
|
18
|
+
* lexicon through a `node_modules` link, as an installed project would.
|
|
19
|
+
*/
|
|
20
|
+
describe("lintCommand — lexicon post-synth checks (#3750)", () => {
|
|
21
|
+
const repoNodeModules = resolve(fileURLToPath(new URL(".", import.meta.url)), "../../../../../node_modules");
|
|
22
|
+
let root: string;
|
|
23
|
+
|
|
24
|
+
const schema = (engine: string, idType = "UInt64") =>
|
|
25
|
+
'import { database, table } from "@intentius/chant-lexicon-sql/clickhouse";\n' +
|
|
26
|
+
"export const shopDb = database`CREATE DATABASE shop ENGINE = Atomic`;\n" +
|
|
27
|
+
"export const events = table`\n" +
|
|
28
|
+
` CREATE TABLE \${shopDb}.events (id ${idType}, kind String)\n` +
|
|
29
|
+
` ENGINE = ${engine}\n` +
|
|
30
|
+
" ORDER BY (kind, id)`;\n";
|
|
31
|
+
|
|
32
|
+
async function project(engine: string, rules?: Record<string, string>, idType?: string): Promise<void> {
|
|
33
|
+
await writeFile(
|
|
34
|
+
join(root, "chant.config.json"),
|
|
35
|
+
JSON.stringify({ lexicons: ["sql"], sql: { dialect: "clickhouse" }, ...(rules ? { lint: { rules } } : {}) }),
|
|
36
|
+
);
|
|
37
|
+
await writeFile(join(root, "src", "schema.ts"), schema(engine, idType));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
beforeEach(async () => {
|
|
41
|
+
root = realpathSync(mkdtempSync(join(tmpdir(), "chant-3750-")));
|
|
42
|
+
await mkdir(join(root, "src"), { recursive: true });
|
|
43
|
+
symlinkSync(repoNodeModules, join(root, "node_modules"), "dir");
|
|
44
|
+
process.env.NO_COLOR = "1";
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
afterEach(async () => {
|
|
48
|
+
await rm(root, { recursive: true, force: true });
|
|
49
|
+
delete process.env.NO_COLOR;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("a lexicon post-synth error fails the lint, at the project root and at src", async () => {
|
|
53
|
+
await project("MergeTre");
|
|
54
|
+
for (const path of [root, join(root, "src")]) {
|
|
55
|
+
const result = await lintCommand({ path, format: "stylish" });
|
|
56
|
+
expect(result.success).toBe(false);
|
|
57
|
+
const diag = result.diagnostics.find((d) => d.ruleId === "SQLCH101");
|
|
58
|
+
expect(diag, result.output).toBeDefined();
|
|
59
|
+
expect(diag!.severity).toBe("error");
|
|
60
|
+
expect(diag!.message).toContain('"MergeTre"');
|
|
61
|
+
// No line of its own: reported at 1:1 in the file that declared the table.
|
|
62
|
+
expect(diag!.file).toBe(join(root, "src", "schema.ts"));
|
|
63
|
+
expect([diag!.line, diag!.column]).toEqual([1, 1]);
|
|
64
|
+
expect(result.output).toContain("SQLCH101");
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("a column type the pinned server does not have is reported (SQLCH121)", async () => {
|
|
69
|
+
await project("MergeTree", undefined, "UInt46");
|
|
70
|
+
const result = await lintCommand({ path: root, format: "stylish" });
|
|
71
|
+
expect(result.success).toBe(false);
|
|
72
|
+
const diag = result.diagnostics.find((d) => d.ruleId === "SQLCH121");
|
|
73
|
+
expect(diag, result.output).toBeDefined();
|
|
74
|
+
expect(diag!.message).toContain("UInt46");
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test("postSynth: false lints source alone", async () => {
|
|
78
|
+
await project("MergeTre");
|
|
79
|
+
const result = await lintCommand({ path: root, format: "stylish", postSynth: false });
|
|
80
|
+
expect(result.diagnostics.some((d) => d.ruleId === "SQLCH101")).toBe(false);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("a clean project reports nothing from the post-synth pass", async () => {
|
|
84
|
+
await project("MergeTree");
|
|
85
|
+
const result = await lintCommand({ path: root, format: "stylish" });
|
|
86
|
+
expect(result.diagnostics.filter((d) => /^SQL|^LEX/.test(d.ruleId)), result.output).toEqual([]);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("lint.rules overrides a post-synth finding's severity, and turns it off", async () => {
|
|
90
|
+
await project("MergeTre", { SQLCH101: "warning" });
|
|
91
|
+
const warned = await lintCommand({ path: root, format: "stylish" });
|
|
92
|
+
expect(warned.diagnostics.find((d) => d.ruleId === "SQLCH101")?.severity).toBe("warning");
|
|
93
|
+
expect(warned.success).toBe(true);
|
|
94
|
+
|
|
95
|
+
await project("MergeTre", { SQLCH101: "off" });
|
|
96
|
+
const off = await lintCommand({ path: root, format: "stylish" });
|
|
97
|
+
expect(off.diagnostics.some((d) => d.ruleId === "SQLCH101")).toBe(false);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("a target that does not build reports the build error and skips the checks", async () => {
|
|
101
|
+
await project("MergeTre");
|
|
102
|
+
// A table interpolating a name that is not declared does not build.
|
|
103
|
+
await writeFile(
|
|
104
|
+
join(root, "src", "broken.ts"),
|
|
105
|
+
'import { table } from "@intentius/chant-lexicon-sql/clickhouse";\n' +
|
|
106
|
+
'import { events } from "./schema";\n' +
|
|
107
|
+
"export const copy = table`CREATE TABLE shop.copy (id UInt64) ENGINE = MergeTree ORDER BY ${(events as any).columns.nope}`;\n",
|
|
108
|
+
);
|
|
109
|
+
const result = await lintCommand({ path: root, format: "stylish" });
|
|
110
|
+
expect(result.success).toBe(false);
|
|
111
|
+
const failures = result.diagnostics.filter((d) => d.ruleId === BUILD_FAILURE_RULE_ID);
|
|
112
|
+
expect(failures.length, result.output).toBeGreaterThan(0);
|
|
113
|
+
expect(failures.every((d) => d.severity === "error")).toBe(true);
|
|
114
|
+
expect(failures.map((d) => d.message).join("\n")).toContain("is undefined");
|
|
115
|
+
expect(result.diagnostics.some((d) => d.ruleId === "SQLCH101")).toBe(false);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { describe, test, expect, beforeEach, afterEach, vi } from "vitest";
|
|
2
|
-
import { lintCommand, isLintRule, loadPluginRules, LEXICON_RESOLUTION_RULE_ID,
|
|
2
|
+
import { lintCommand, isLintRule, loadPluginRules, LEXICON_RESOLUTION_RULE_ID, type LintOptions } from "./lint";
|
|
3
3
|
import { loadPlugins, resolveProjectLexicons } from "../plugins";
|
|
4
4
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
5
5
|
import { join, resolve } from "node:path";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
7
7
|
import { execFileSync } from "node:child_process";
|
|
8
|
-
import { mkdtempSync, realpathSync, symlinkSync } from "node:fs";
|
|
9
|
-
import { fileURLToPath } from "node:url";
|
|
10
8
|
import { params, setBuildParams } from "../../params";
|
|
11
9
|
|
|
12
10
|
describe("lintCommand", () => {
|
|
@@ -887,7 +885,7 @@ describe("lintCommand — a declared lexicon that cannot be resolved (#2222)", (
|
|
|
887
885
|
* `lintCommand` has no flags to read and passed nothing, so `params` stayed
|
|
888
886
|
* empty and OPS012 reported the activity contract violated for source that
|
|
889
887
|
* lints clean from a shell. That is how the root-examples gate
|
|
890
|
-
* (examples/root-examples-gate.test.ts) went red on github-pr-preview while
|
|
888
|
+
* (examples/root-examples-gate.e2e.test.ts) went red on github-pr-preview while
|
|
891
889
|
* `chant lint .` in the same directory exited 0, and it applied equally to
|
|
892
890
|
* `handleLint` over MCP and to test-utils' example harness.
|
|
893
891
|
*
|
|
@@ -962,108 +960,5 @@ describe("lintCommand build-time parameters (#2249)", () => {
|
|
|
962
960
|
});
|
|
963
961
|
});
|
|
964
962
|
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
* over an in-memory build of the lint target, the ones `chant build` runs.
|
|
968
|
-
* The sql lexicon's SQLCH101 is the issue's repro: `ENGINE = MergeTre` failed
|
|
969
|
-
* the build and linted clean. The project imports the workspace's sql
|
|
970
|
-
* lexicon through a `node_modules` link, as an installed project would.
|
|
971
|
-
*/
|
|
972
|
-
describe("lintCommand — lexicon post-synth checks (#3750)", () => {
|
|
973
|
-
const repoNodeModules = resolve(fileURLToPath(new URL(".", import.meta.url)), "../../../../../node_modules");
|
|
974
|
-
let root: string;
|
|
975
|
-
|
|
976
|
-
const schema = (engine: string, idType = "UInt64") =>
|
|
977
|
-
'import { database, table } from "@intentius/chant-lexicon-sql/clickhouse";\n' +
|
|
978
|
-
"export const shopDb = database`CREATE DATABASE shop ENGINE = Atomic`;\n" +
|
|
979
|
-
"export const events = table`\n" +
|
|
980
|
-
` CREATE TABLE \${shopDb}.events (id ${idType}, kind String)\n` +
|
|
981
|
-
` ENGINE = ${engine}\n` +
|
|
982
|
-
" ORDER BY (kind, id)`;\n";
|
|
983
|
-
|
|
984
|
-
async function project(engine: string, rules?: Record<string, string>, idType?: string): Promise<void> {
|
|
985
|
-
await writeFile(
|
|
986
|
-
join(root, "chant.config.json"),
|
|
987
|
-
JSON.stringify({ lexicons: ["sql"], sql: { dialect: "clickhouse" }, ...(rules ? { lint: { rules } } : {}) }),
|
|
988
|
-
);
|
|
989
|
-
await writeFile(join(root, "src", "schema.ts"), schema(engine, idType));
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
beforeEach(async () => {
|
|
993
|
-
root = realpathSync(mkdtempSync(join(tmpdir(), "chant-3750-")));
|
|
994
|
-
await mkdir(join(root, "src"), { recursive: true });
|
|
995
|
-
symlinkSync(repoNodeModules, join(root, "node_modules"), "dir");
|
|
996
|
-
process.env.NO_COLOR = "1";
|
|
997
|
-
});
|
|
998
|
-
|
|
999
|
-
afterEach(async () => {
|
|
1000
|
-
await rm(root, { recursive: true, force: true });
|
|
1001
|
-
delete process.env.NO_COLOR;
|
|
1002
|
-
});
|
|
1003
|
-
|
|
1004
|
-
test("a lexicon post-synth error fails the lint, at the project root and at src", async () => {
|
|
1005
|
-
await project("MergeTre");
|
|
1006
|
-
for (const path of [root, join(root, "src")]) {
|
|
1007
|
-
const result = await lintCommand({ path, format: "stylish" });
|
|
1008
|
-
expect(result.success).toBe(false);
|
|
1009
|
-
const diag = result.diagnostics.find((d) => d.ruleId === "SQLCH101");
|
|
1010
|
-
expect(diag, result.output).toBeDefined();
|
|
1011
|
-
expect(diag!.severity).toBe("error");
|
|
1012
|
-
expect(diag!.message).toContain('"MergeTre"');
|
|
1013
|
-
// No line of its own: reported at 1:1 in the file that declared the table.
|
|
1014
|
-
expect(diag!.file).toBe(join(root, "src", "schema.ts"));
|
|
1015
|
-
expect([diag!.line, diag!.column]).toEqual([1, 1]);
|
|
1016
|
-
expect(result.output).toContain("SQLCH101");
|
|
1017
|
-
}
|
|
1018
|
-
});
|
|
1019
|
-
|
|
1020
|
-
test("a column type the pinned server does not have is reported (SQLCH121)", async () => {
|
|
1021
|
-
await project("MergeTree", undefined, "UInt46");
|
|
1022
|
-
const result = await lintCommand({ path: root, format: "stylish" });
|
|
1023
|
-
expect(result.success).toBe(false);
|
|
1024
|
-
const diag = result.diagnostics.find((d) => d.ruleId === "SQLCH121");
|
|
1025
|
-
expect(diag, result.output).toBeDefined();
|
|
1026
|
-
expect(diag!.message).toContain("UInt46");
|
|
1027
|
-
});
|
|
1028
|
-
|
|
1029
|
-
test("postSynth: false lints source alone", async () => {
|
|
1030
|
-
await project("MergeTre");
|
|
1031
|
-
const result = await lintCommand({ path: root, format: "stylish", postSynth: false });
|
|
1032
|
-
expect(result.diagnostics.some((d) => d.ruleId === "SQLCH101")).toBe(false);
|
|
1033
|
-
});
|
|
1034
|
-
|
|
1035
|
-
test("a clean project reports nothing from the post-synth pass", async () => {
|
|
1036
|
-
await project("MergeTree");
|
|
1037
|
-
const result = await lintCommand({ path: root, format: "stylish" });
|
|
1038
|
-
expect(result.diagnostics.filter((d) => /^SQL|^LEX/.test(d.ruleId)), result.output).toEqual([]);
|
|
1039
|
-
});
|
|
1040
|
-
|
|
1041
|
-
test("lint.rules overrides a post-synth finding's severity, and turns it off", async () => {
|
|
1042
|
-
await project("MergeTre", { SQLCH101: "warning" });
|
|
1043
|
-
const warned = await lintCommand({ path: root, format: "stylish" });
|
|
1044
|
-
expect(warned.diagnostics.find((d) => d.ruleId === "SQLCH101")?.severity).toBe("warning");
|
|
1045
|
-
expect(warned.success).toBe(true);
|
|
1046
|
-
|
|
1047
|
-
await project("MergeTre", { SQLCH101: "off" });
|
|
1048
|
-
const off = await lintCommand({ path: root, format: "stylish" });
|
|
1049
|
-
expect(off.diagnostics.some((d) => d.ruleId === "SQLCH101")).toBe(false);
|
|
1050
|
-
});
|
|
1051
|
-
|
|
1052
|
-
test("a target that does not build reports the build error and skips the checks", async () => {
|
|
1053
|
-
await project("MergeTre");
|
|
1054
|
-
// A table interpolating a name that is not declared does not build.
|
|
1055
|
-
await writeFile(
|
|
1056
|
-
join(root, "src", "broken.ts"),
|
|
1057
|
-
'import { table } from "@intentius/chant-lexicon-sql/clickhouse";\n' +
|
|
1058
|
-
'import { events } from "./schema";\n' +
|
|
1059
|
-
"export const copy = table`CREATE TABLE shop.copy (id UInt64) ENGINE = MergeTree ORDER BY ${(events as any).columns.nope}`;\n",
|
|
1060
|
-
);
|
|
1061
|
-
const result = await lintCommand({ path: root, format: "stylish" });
|
|
1062
|
-
expect(result.success).toBe(false);
|
|
1063
|
-
const failures = result.diagnostics.filter((d) => d.ruleId === BUILD_FAILURE_RULE_ID);
|
|
1064
|
-
expect(failures.length, result.output).toBeGreaterThan(0);
|
|
1065
|
-
expect(failures.every((d) => d.severity === "error")).toBe(true);
|
|
1066
|
-
expect(failures.map((d) => d.message).join("\n")).toContain("is undefined");
|
|
1067
|
-
expect(result.diagnostics.some((d) => d.ruleId === "SQLCH101")).toBe(false);
|
|
1068
|
-
});
|
|
1069
|
-
});
|
|
963
|
+
// The lexicon post-synth pass over a project that imports the sql lexicon (#3750) builds
|
|
964
|
+
// that project and loads the lexicon; it is in lint-post-synth.e2e.test.ts (#3793).
|
|
@@ -37,8 +37,8 @@ describe("CLI end-to-end — discovery skips a side-effecting script (#2519)", (
|
|
|
37
37
|
let ranPath: string;
|
|
38
38
|
|
|
39
39
|
/** Write the project config; `extra` is spliced into the default export. */
|
|
40
|
-
async function writeConfig(extra: string): Promise<void> {
|
|
41
|
-
await writeFile(join(testDir, "chant.config.ts"), `export default { lexicons: [
|
|
40
|
+
async function writeConfig(extra: string, lexicons = '"k8s"'): Promise<void> {
|
|
41
|
+
await writeFile(join(testDir, "chant.config.ts"), `export default { lexicons: [${lexicons}]${extra} };\n`);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/** The runner from the issue, optionally headed by `header`. */
|
|
@@ -158,11 +158,26 @@ describe("CLI end-to-end — discovery skips a side-effecting script (#2519)", (
|
|
|
158
158
|
}, TIMEOUT);
|
|
159
159
|
|
|
160
160
|
test("the control: without exclude, `chant lint` lints the script", async () => {
|
|
161
|
-
|
|
161
|
+
// No lexicon, so lint runs its source rules only. With a lexicon that ships
|
|
162
|
+
// post-synth checks, `chant lint` also builds the target (#3750) and imports
|
|
163
|
+
// the script, which ends the process before any diagnostic prints; the next
|
|
164
|
+
// test covers that.
|
|
165
|
+
await writeConfig("", "");
|
|
162
166
|
await writeRunner();
|
|
163
167
|
|
|
164
168
|
const lint = runCli(["lint", testDir, "--format", "json"]);
|
|
165
169
|
const diagnostics = JSON.parse(lint.stdout) as Array<{ file: string; ruleId: string }>;
|
|
166
170
|
expect(diagnostics.some((d) => d.file.endsWith(join("ops", "run.ts")) && d.ruleId === "EVL003")).toBe(true);
|
|
167
171
|
}, TIMEOUT);
|
|
172
|
+
|
|
173
|
+
test("the control: without exclude, `chant lint` with a lexicon imports the script, as build does", async () => {
|
|
174
|
+
await writeConfig("");
|
|
175
|
+
await writeRunner();
|
|
176
|
+
|
|
177
|
+
const { status, stderr } = runCli(["lint", testDir, "--format", "json"]);
|
|
178
|
+
|
|
179
|
+
expect(status).toBe(2);
|
|
180
|
+
expect(stderr).toContain("no op named");
|
|
181
|
+
expect(existsSync(ranPath)).toBe(true);
|
|
182
|
+
}, TIMEOUT);
|
|
168
183
|
});
|
package/src/config-import.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { join } from "node:path";
|
|
|
9
9
|
* — one narrow module whose only job is "execute project-authored code here",
|
|
10
10
|
* so that the question "did any project code run in this process?" has one
|
|
11
11
|
* place to look and one place to instrument (see
|
|
12
|
-
* `examples/sandbox-execution-boundary.test.ts`, which spies on both).
|
|
12
|
+
* `examples/sandbox-execution-boundary.e2e.test.ts`, which spies on both).
|
|
13
13
|
*
|
|
14
14
|
* Callers must not `import()` a config file directly. `./config-sandbox.ts`
|
|
15
15
|
* decides whether a given load is allowed to come through here at all: under
|
|
@@ -14,7 +14,7 @@ const runtimePath = resolve(thisDir, "../../runtime");
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* chant #1045 Phase 2 — proves the actual isolation properties (not just
|
|
17
|
-
* byte-identical output, which `examples/sandbox-differential.test.ts`
|
|
17
|
+
* byte-identical output, which `examples/sandbox-differential.e2e.test.ts`
|
|
18
18
|
* already covers): a run-fallback file cannot read outside the project
|
|
19
19
|
* directory, write anywhere, spawn a process, or read the ambient
|
|
20
20
|
* environment, and a permission denial names the file and the operation
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `importConfigModule` (`chant.config.ts`): one narrow module whose only job is
|
|
8
8
|
* "execute project-authored code here", so that "did any project code run in
|
|
9
9
|
* this process?" has one place to look and one place to instrument — see
|
|
10
|
-
* `examples/sandbox-execution-boundary.test.ts`, which spies on all three.
|
|
10
|
+
* `examples/sandbox-execution-boundary.e2e.test.ts`, which spies on all three.
|
|
11
11
|
*
|
|
12
12
|
* Before chant #1131 `./policy.ts` called `await import(resolved)` inline,
|
|
13
13
|
* which is why the corpus boundary gate could not see it even after #1113 put
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A webhook receiver that runs plain Node imports the verifier from the
|
|
3
|
+
* installed package (#3803). Node does not strip types under node_modules, so
|
|
4
|
+
* the `./notify-verify` and `./notify` exports must reach compiled JS, which
|
|
5
|
+
* the package build keeps in dist/. This packs the package the way a release
|
|
6
|
+
* does, installs the tarball's contents into a scratch project, and imports
|
|
7
|
+
* both entries with `node` and no loader.
|
|
8
|
+
*
|
|
9
|
+
* End to end because `npm pack` runs the package build.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { execFileSync } from "node:child_process";
|
|
13
|
+
import { mkdirSync, mkdtempSync, rmSync, symlinkSync } from "node:fs";
|
|
14
|
+
import { tmpdir } from "node:os";
|
|
15
|
+
import { join, resolve } from "node:path";
|
|
16
|
+
import { afterAll, beforeAll, describe, expect, test } from "vitest";
|
|
17
|
+
|
|
18
|
+
const coreRoot = resolve(import.meta.dirname, "..");
|
|
19
|
+
|
|
20
|
+
let scratch: string;
|
|
21
|
+
let consumer: string;
|
|
22
|
+
|
|
23
|
+
beforeAll(() => {
|
|
24
|
+
scratch = mkdtempSync(join(tmpdir(), "chant-notify-plain-node-"));
|
|
25
|
+
const packed = JSON.parse(
|
|
26
|
+
execFileSync("npm", ["pack", "--json", "--pack-destination", scratch], { cwd: coreRoot, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }),
|
|
27
|
+
) as { filename: string }[];
|
|
28
|
+
execFileSync("tar", ["-xzf", join(scratch, packed[0].filename), "-C", scratch]);
|
|
29
|
+
consumer = join(scratch, "consumer");
|
|
30
|
+
mkdirSync(join(consumer, "node_modules", "@intentius"), { recursive: true });
|
|
31
|
+
symlinkSync(join(scratch, "package"), join(consumer, "node_modules", "@intentius", "chant"), "dir");
|
|
32
|
+
}, 300_000);
|
|
33
|
+
|
|
34
|
+
afterAll(() => {
|
|
35
|
+
if (scratch) rmSync(scratch, { recursive: true, force: true });
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/** Runs `source` as an ES module under plain node in the consumer project, with no loader. */
|
|
39
|
+
function plainNode(source: string): string {
|
|
40
|
+
const env = { ...process.env };
|
|
41
|
+
delete env.NODE_OPTIONS;
|
|
42
|
+
return execFileSync(process.execPath, ["--input-type=module", "-e", source], { cwd: consumer, env, encoding: "utf-8" });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
describe("the notify entries under plain Node (#3803)", () => {
|
|
46
|
+
test("notify-verify verifies a signed delivery and refuses a tampered one", () => {
|
|
47
|
+
const out = plainNode(`
|
|
48
|
+
const { signWebhook, verifyWebhook } = await import("@intentius/chant/notify-verify");
|
|
49
|
+
const body = JSON.stringify({ schema: "chant.notify/v1" });
|
|
50
|
+
const ts = String(Math.floor(Date.now() / 1000));
|
|
51
|
+
const headers = { "x-chant-signature": signWebhook("key", ts, body), "x-chant-timestamp": ts };
|
|
52
|
+
const good = verifyWebhook({ body, headers, key: "key" });
|
|
53
|
+
const bad = verifyWebhook({ body: body + " ", headers, key: "key" });
|
|
54
|
+
console.log(JSON.stringify({ good: good.ok, bad: bad.ok, from: import.meta.resolve("@intentius/chant/notify-verify") }));
|
|
55
|
+
`);
|
|
56
|
+
const result = JSON.parse(out) as { good: boolean; bad: boolean; from: string };
|
|
57
|
+
expect(result).toMatchObject({ good: true, bad: false });
|
|
58
|
+
expect(result.from).toMatch(/\/dist\/notify-verify\.js$/);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("notify loads with the verifier it re-exports", () => {
|
|
62
|
+
const out = plainNode(`
|
|
63
|
+
const notify = await import("@intentius/chant/notify");
|
|
64
|
+
console.log(JSON.stringify({ make: typeof notify.makeNotifyEvent, verify: typeof notify.verifyWebhook }));
|
|
65
|
+
`);
|
|
66
|
+
expect(JSON.parse(out)).toEqual({ make: "function", verify: "function" });
|
|
67
|
+
});
|
|
68
|
+
});
|