@intentius/chant 0.124.48 → 0.124.49
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/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +20 -12
- package/dist/cli/handlers/graph-reader.d.ts +26 -0
- package/dist/cli/handlers/graph-reader.d.ts.map +1 -0
- package/dist/cli/handlers/graph-reader.js +41 -0
- package/dist/cli/handlers/graph.d.ts.map +1 -1
- package/dist/cli/handlers/graph.js +14 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +40 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +22 -0
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +11 -0
- package/dist/cli/registry.d.ts +8 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/pr-run.d.ts +3 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +1 -0
- package/dist/config.d.ts +16 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -0
- package/dist/gate-decision.d.ts +9 -0
- package/dist/gate-decision.d.ts.map +1 -1
- package/dist/gate-decision.js +22 -7
- package/dist/lexicon.d.ts +23 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/op/activities/activity-contracts.d.ts +4 -4
- package/dist/op/gate-approval-base.d.ts +25 -0
- package/dist/op/gate-approval-base.d.ts.map +1 -0
- package/dist/op/gate-approval-base.js +71 -0
- package/dist/op/gate-approval.d.ts +7 -4
- package/dist/op/gate-approval.d.ts.map +1 -1
- package/dist/op/gate-approval.js +2 -25
- package/dist/op/gate-name.d.ts +13 -0
- package/dist/op/gate-name.d.ts.map +1 -1
- package/dist/op/gate-name.js +14 -1
- package/dist/op/gate.d.ts +4 -3
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/local-executor.d.ts +9 -2
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +24 -5
- package/dist/pr-loop.d.ts +10 -0
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +4 -0
- package/dist/pr-migrations.d.ts +62 -0
- package/dist/pr-migrations.d.ts.map +1 -0
- package/dist/pr-migrations.js +50 -0
- package/dist/pr-post.js +1 -1
- package/dist/wave-runtime.mjs +219 -218
- package/dist/workspace/check.schema.json +4 -2
- package/dist/workspace/checks/gate-approval.d.ts +58 -0
- package/dist/workspace/checks/gate-approval.d.ts.map +1 -0
- package/dist/workspace/checks/gate-approval.js +103 -0
- package/dist/workspace/checks.d.ts +1 -0
- package/dist/workspace/checks.d.ts.map +1 -1
- package/dist/workspace/checks.js +4 -0
- package/dist/workspace/declaration.d.ts +7 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +13 -1
- package/dist/workspace/declaration.schema.json +33 -0
- package/dist/workspace/exit-cli.d.ts +44 -0
- package/dist/workspace/exit-cli.d.ts.map +1 -0
- package/dist/workspace/exit-cli.js +198 -0
- package/dist/workspace/exit.d.ts +159 -0
- package/dist/workspace/exit.d.ts.map +1 -0
- package/dist/workspace/exit.js +480 -0
- package/dist/workspace/exit.schema.json +257 -0
- package/dist/workspace/graph-cache.d.ts +3 -1
- package/dist/workspace/graph-cache.d.ts.map +1 -1
- package/dist/workspace/graph-cache.js +12 -1
- package/dist/workspace/import-fetch.d.ts +38 -0
- package/dist/workspace/import-fetch.d.ts.map +1 -0
- package/dist/workspace/import-fetch.js +99 -0
- package/dist/workspace/import-init.d.ts +26 -0
- package/dist/workspace/import-init.d.ts.map +1 -0
- package/dist/workspace/import-init.js +130 -0
- package/dist/workspace/import-source.d.ts +147 -0
- package/dist/workspace/import-source.d.ts.map +1 -0
- package/dist/workspace/import-source.js +370 -0
- package/dist/workspace/init.d.ts +4 -0
- package/dist/workspace/init.d.ts.map +1 -1
- package/dist/workspace/init.js +70 -3
- package/dist/workspace/kind-readers.d.ts +6 -0
- package/dist/workspace/kind-readers.d.ts.map +1 -1
- package/dist/workspace/kind-readers.js +18 -0
- package/dist/workspace/kinds.d.ts +24 -1
- package/dist/workspace/kinds.d.ts.map +1 -1
- package/dist/workspace/kinds.js +64 -4
- package/dist/workspace/lineage-upgrade.d.ts.map +1 -1
- package/dist/workspace/lineage-upgrade.js +13 -4
- package/dist/workspace/new-migrations.d.ts +47 -0
- package/dist/workspace/new-migrations.d.ts.map +1 -0
- package/dist/workspace/new-migrations.js +91 -0
- package/dist/workspace/pr-report.schema.json +46 -0
- package/dist/workspace/promote.d.ts +96 -0
- package/dist/workspace/promote.d.ts.map +1 -0
- package/dist/workspace/promote.js +263 -0
- package/dist/workspace/reason-codes.d.ts +13 -0
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +14 -0
- package/dist/workspace/search-contract.d.ts +1 -1
- package/dist/workspace/search-contract.d.ts.map +1 -1
- package/dist/workspace/workspace-kinds.schema.json +50 -7
- package/package.json +1 -1
- package/src/cli/handlers/approve.ts +10 -2
- package/src/cli/handlers/graph-reader.test.ts +31 -0
- package/src/cli/handlers/graph-reader.ts +51 -0
- package/src/cli/handlers/graph.ts +14 -0
- package/src/cli/handlers/pr.ts +38 -1
- package/src/cli/main.test.ts +2 -0
- package/src/cli/main.ts +22 -0
- package/src/cli/parse-args.ts +8 -0
- package/src/cli/registry.ts +8 -0
- package/src/components/pr-env-run-bundle.test.ts +1 -0
- package/src/components/pr-run.ts +4 -0
- package/src/config.ts +16 -0
- package/src/gate-decision-bundle.test.ts +4 -2
- package/src/gate-decision-identity.test.ts +11 -0
- package/src/gate-decision.ts +26 -6
- package/src/lexicon.ts +24 -0
- package/src/op/gate-approval-at-base.test.ts +97 -0
- package/src/op/gate-approval-base.ts +72 -0
- package/src/op/gate-approval.ts +10 -21
- package/src/op/gate-name.ts +16 -1
- package/src/op/gate.ts +4 -3
- package/src/op/local-executor.ts +25 -5
- package/src/pr-loop-bundle.test.ts +3 -2
- package/src/pr-loop.test.ts +52 -0
- package/src/pr-loop.ts +12 -0
- package/src/pr-migrations.ts +97 -0
- package/src/pr-post.ts +1 -1
- package/src/workspace/__fixtures__/import/spacelift.json +9 -0
- package/src/workspace/__fixtures__/import/tfc.json +13 -0
- package/src/workspace/behold-kinds.test.ts +1 -0
- package/src/workspace/check-contract.test.ts +3 -2
- package/src/workspace/check.schema.json +4 -2
- package/src/workspace/checks/gate-approval.test.ts +77 -0
- package/src/workspace/checks/gate-approval.ts +121 -0
- package/src/workspace/checks.ts +4 -0
- package/src/workspace/declaration.schema.json +33 -0
- package/src/workspace/declaration.ts +19 -2
- package/src/workspace/exit-cli.ts +219 -0
- package/src/workspace/exit.schema.json +257 -0
- package/src/workspace/exit.test.ts +185 -0
- package/src/workspace/exit.ts +560 -0
- package/src/workspace/graph-cache.ts +12 -2
- package/src/workspace/identity.test.ts +18 -3
- package/src/workspace/import-fetch.ts +151 -0
- package/src/workspace/import-init.ts +147 -0
- package/src/workspace/import-source.test.ts +183 -0
- package/src/workspace/import-source.ts +462 -0
- package/src/workspace/init.test.ts +55 -1
- package/src/workspace/init.ts +66 -4
- package/src/workspace/kind-readers.test.ts +36 -0
- package/src/workspace/kind-readers.ts +18 -1
- package/src/workspace/kinds.test.ts +23 -0
- package/src/workspace/kinds.ts +81 -5
- package/src/workspace/lineage-upgrade.test.ts +20 -0
- package/src/workspace/lineage-upgrade.ts +16 -7
- package/src/workspace/new-migrations.test.ts +98 -0
- package/src/workspace/new-migrations.ts +109 -0
- package/src/workspace/pr-report.schema.json +46 -0
- package/src/workspace/promote.test.ts +114 -0
- package/src/workspace/promote.ts +302 -0
- package/src/workspace/reason-codes.test.ts +4 -0
- package/src/workspace/reason-codes.ts +14 -0
- package/src/workspace/workspace-kinds.schema.json +50 -7
|
@@ -490,12 +490,31 @@ function gateFn(step) {
|
|
|
490
490
|
* `approval.quorum` is not read then, so a change can't lower the quorum its
|
|
491
491
|
* own run needs. The base quorum applies to a gate whose Op declares no
|
|
492
492
|
* `approval` block too. With none at base, the Op's quorum applies as before.
|
|
493
|
+
*
|
|
494
|
+
* #4404: `policy`, `mode` and `context` are read the same way, each from its
|
|
495
|
+
* own `identity.gates.<gate>` field (`baseApproval`). A field the entry sets
|
|
496
|
+
* replaces the Op's. The base `context` wins key by key: a change can't edit a
|
|
497
|
+
* key the entry declares, but a key only the Op declares (often a step output
|
|
498
|
+
* the run computes) still reaches the policy. A field the entry leaves out
|
|
499
|
+
* still comes from the Op, and `chant workspace check` (WSP153) reports it.
|
|
493
500
|
*/
|
|
494
|
-
export function resolveGateApproval(step, resultsById, env, atBase) {
|
|
501
|
+
export function resolveGateApproval(step, resultsById, env, atBase, baseApproval) {
|
|
495
502
|
const baseQuorum = atBase ?? undefined;
|
|
496
|
-
const
|
|
497
|
-
|
|
503
|
+
const base = {
|
|
504
|
+
policy: baseApproval?.policy ?? undefined,
|
|
505
|
+
mode: baseApproval?.mode ?? undefined,
|
|
506
|
+
context: baseApproval?.context ?? undefined,
|
|
507
|
+
};
|
|
508
|
+
const anyBase = baseQuorum !== undefined || base.policy !== undefined || base.mode !== undefined || base.context !== undefined;
|
|
509
|
+
const opApproval = step.approval ?? (anyBase ? {} : undefined);
|
|
510
|
+
if (!opApproval)
|
|
498
511
|
return undefined;
|
|
512
|
+
const authored = {
|
|
513
|
+
...opApproval,
|
|
514
|
+
...(base.policy !== undefined ? { policy: base.policy } : {}),
|
|
515
|
+
...(base.mode !== undefined ? { mode: base.mode } : {}),
|
|
516
|
+
...(base.context !== undefined ? { context: { ...(opApproval.context ?? {}), ...base.context } } : {}),
|
|
517
|
+
};
|
|
499
518
|
const quorum = baseQuorum ?? authored.quorum;
|
|
500
519
|
let context;
|
|
501
520
|
if (authored.context) {
|
|
@@ -543,7 +562,7 @@ async function runGateStep(step, phaseName, gates, resultsById = new Map()) {
|
|
|
543
562
|
// a run over a missing digest.
|
|
544
563
|
const resolvedPlan = resolveStepOutputRefs(step.plan, resultsById);
|
|
545
564
|
const planDigest = typeof resolvedPlan === "string" && resolvedPlan !== "" ? resolvedPlan : undefined;
|
|
546
|
-
// #4324: the workspace's rule for this gate at base, read once: its quorum
|
|
565
|
+
// #4324, #4404: the workspace's rule for this gate at base, read once: its quorum, policy, mode and context
|
|
547
566
|
// replaces the Op's, and evaluateGate judges approvals by it. A read that
|
|
548
567
|
// fails ends the step as a failing record, as a ledger read does below.
|
|
549
568
|
let rule;
|
|
@@ -553,7 +572,7 @@ async function runGateStep(step, phaseName, gates, resultsById = new Map()) {
|
|
|
553
572
|
catch (err) {
|
|
554
573
|
return { record: { phase: phaseName, fn: gateFn(step), args: {}, status: "fail", durationMs: Date.now() - start, error: errMessage(err) } };
|
|
555
574
|
}
|
|
556
|
-
const approval = resolveGateApproval(step, resultsById, gates.env, rule?.requirement.quorum);
|
|
575
|
+
const approval = resolveGateApproval(step, resultsById, gates.env, rule?.requirement.quorum, rule?.requirement);
|
|
557
576
|
// #3947: a gate that resumes stores the outputs the steps after it read.
|
|
558
577
|
const resumeAt = gates.resume?.gates.get(step);
|
|
559
578
|
let checkpoint;
|
package/dist/pr-loop.d.ts
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
*/
|
|
49
49
|
import type { ChangeSetDocument } from "./change-set.js";
|
|
50
50
|
import type { PrRequireOutcome } from "./pr-requires.js";
|
|
51
|
+
import { type PrMigrationFile } from "./pr-migrations.js";
|
|
51
52
|
/** The schema a pull-request report names in `$schema`. */
|
|
52
53
|
export declare const PR_REPORT_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/pr-report/v1/pr-report.schema.json";
|
|
53
54
|
/** The read-contract version the report follows. */
|
|
@@ -72,6 +73,8 @@ export declare const PR_REPORT_OVERDUE_FLOOR = "0.124.41";
|
|
|
72
73
|
export declare const PR_REPORT_POLICY_FLOOR = "0.124.41";
|
|
73
74
|
/** The first chant whose apply report can carry `beforeMerge` and the `requires-unmet` and `before-merge-off` refusals (#4301, ws-106). */
|
|
74
75
|
export declare const PR_REPORT_BEFORE_MERGE_FLOOR = "0.124.42";
|
|
76
|
+
/** The first chant whose plan report can carry `migrations` (#4407). */
|
|
77
|
+
export declare const PR_REPORT_MIGRATIONS_FLOOR = "0.124.49";
|
|
75
78
|
/** The gate a pull request's apply waits on, unless the pipeline names another. */
|
|
76
79
|
export declare const PR_APPLY_GATE = "pr-apply";
|
|
77
80
|
/**
|
|
@@ -413,6 +416,13 @@ export interface PrReport {
|
|
|
413
416
|
* {@link PR_REPORT_OVERDUE_FLOOR}.
|
|
414
417
|
*/
|
|
415
418
|
overdue?: PrOverdue[];
|
|
419
|
+
/**
|
|
420
|
+
* Plan stage (#4407): the migration files the pull request adds in a
|
|
421
|
+
* migration-directory workspace member, each statement classified offline.
|
|
422
|
+
* Absent when it adds none. Added within contract 1 by chant
|
|
423
|
+
* {@link PR_REPORT_MIGRATIONS_FLOOR}.
|
|
424
|
+
*/
|
|
425
|
+
migrations?: PrMigrationFile[];
|
|
416
426
|
/** Component names: which changed, which run because they depend on one, and what the change touched that no component deploys. */
|
|
417
427
|
selection: {
|
|
418
428
|
changed: string[];
|
package/dist/pr-loop.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-loop.d.ts","sourceRoot":"","sources":["../src/pr-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"pr-loop.d.ts","sourceRoot":"","sources":["../src/pr-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,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G,cAAc,CAIpG;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAG/F;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC,EAAE,QAAQ,SAAU,GAAG,MAAM,CAE7G;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC,GAAG,MAAM,CAMzG;AA8ID;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CA8F1G;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CA6D5D;AAED,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CASjF"}
|
package/dist/pr-loop.js
CHANGED
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
* contexts carry the member's name. The gate name stays the same, so one
|
|
47
47
|
* `identity.gates` entry covers every member.
|
|
48
48
|
*/
|
|
49
|
+
import { renderMigrationLines } from "./pr-migrations.js";
|
|
49
50
|
import { GITHUB_COMMENT_LIMIT, groupChangeSet, renderPlanSummaryMarkdown } from "./plan-summary.js";
|
|
50
51
|
/** The schema a pull-request report names in `$schema`. */
|
|
51
52
|
export const PR_REPORT_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/pr-report/v1/pr-report.schema.json";
|
|
@@ -71,6 +72,8 @@ export const PR_REPORT_OVERDUE_FLOOR = "0.124.41";
|
|
|
71
72
|
export const PR_REPORT_POLICY_FLOOR = "0.124.41";
|
|
72
73
|
/** The first chant whose apply report can carry `beforeMerge` and the `requires-unmet` and `before-merge-off` refusals (#4301, ws-106). */
|
|
73
74
|
export const PR_REPORT_BEFORE_MERGE_FLOOR = "0.124.42";
|
|
75
|
+
/** The first chant whose plan report can carry `migrations` (#4407). */
|
|
76
|
+
export const PR_REPORT_MIGRATIONS_FLOOR = "0.124.49";
|
|
74
77
|
/** The gate a pull request's apply waits on, unless the pipeline names another. */
|
|
75
78
|
export const PR_APPLY_GATE = "pr-apply";
|
|
76
79
|
/**
|
|
@@ -309,6 +312,7 @@ export function renderPrNote(report, options = {}) {
|
|
|
309
312
|
out.push("", `Hooks: ${passed} passed${other.length > 0 ? `; ${other.join("; ")}` : ""}.`);
|
|
310
313
|
}
|
|
311
314
|
out.push(...policyLines(report));
|
|
315
|
+
out.push(...renderMigrationLines(report.migrations));
|
|
312
316
|
if (report.selection.unclaimed.length > 0) {
|
|
313
317
|
out.push("", `Changed, and deployed by no component: ${report.selection.unclaimed.map(code).join(", ")}.`);
|
|
314
318
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The migration files a pull request adds, classified for the plan note
|
|
3
|
+
* (#4407). This is the "check" adoption level: each new migration in a
|
|
4
|
+
* migration-directory workspace member (goose, golang-migrate,
|
|
5
|
+
* clickhouse-migrations, Flyway) is read offline and its statements are given
|
|
6
|
+
* the class the lexicon's classifier gives the same change. Nothing is applied
|
|
7
|
+
* and no server is contacted.
|
|
8
|
+
*
|
|
9
|
+
* Core holds the shapes and the note's lines. The classes come from a
|
|
10
|
+
* lexicon's `classifyMigrations` (`./lexicon.ts`), the way a lexicon's
|
|
11
|
+
* `classifyDisruption` supplies the disruption of an update. Pure: it imports
|
|
12
|
+
* nothing, so `./pr-loop.ts` can render it.
|
|
13
|
+
*/
|
|
14
|
+
/** One change a statement makes, under one classifier rule. */
|
|
15
|
+
export interface MigrationChange {
|
|
16
|
+
rule: string;
|
|
17
|
+
/** The rule's class, e.g. `rebuild`, `concurrently`, `metadata`. */
|
|
18
|
+
class: string;
|
|
19
|
+
/** The class as a report names it, e.g. `REBUILD`. */
|
|
20
|
+
label: string;
|
|
21
|
+
title: string;
|
|
22
|
+
/** Postgres: the lock the rule names. */
|
|
23
|
+
lock?: string;
|
|
24
|
+
destructive?: boolean;
|
|
25
|
+
note?: string;
|
|
26
|
+
}
|
|
27
|
+
/** What one statement came to: `undecided` lists `candidates`; `unclassified` and `data` say why in `note`. */
|
|
28
|
+
export interface MigrationStatement {
|
|
29
|
+
/** 1-based position among the file's up statements. */
|
|
30
|
+
index: number;
|
|
31
|
+
/** The statement's first line, cut to 120 characters. */
|
|
32
|
+
sql: string;
|
|
33
|
+
outcome: "classified" | "undecided" | "unclassified" | "data";
|
|
34
|
+
changes: MigrationChange[];
|
|
35
|
+
candidates?: MigrationChange[];
|
|
36
|
+
note?: string;
|
|
37
|
+
}
|
|
38
|
+
/** What a lexicon answers for one new migration file. */
|
|
39
|
+
export interface MigrationFileClassification {
|
|
40
|
+
/** The file, relative to the workspace root. */
|
|
41
|
+
file: string;
|
|
42
|
+
statements: MigrationStatement[];
|
|
43
|
+
/** Set when the file could not be read (a Flyway placeholder with no value): why. */
|
|
44
|
+
error?: string;
|
|
45
|
+
}
|
|
46
|
+
/** A new migration file in the report's `migrations`. */
|
|
47
|
+
export interface PrMigrationFile extends MigrationFileClassification {
|
|
48
|
+
/** The workspace member whose directory holds it. */
|
|
49
|
+
member: string;
|
|
50
|
+
/** The reader that listed it: `goose-dir`, `golang-migrate-dir`, `clickhouse-migrations-dir` or `flyway-dir`. */
|
|
51
|
+
reader: string;
|
|
52
|
+
version: string;
|
|
53
|
+
name: string;
|
|
54
|
+
type: "versioned" | "repeatable" | "baseline" | "undo";
|
|
55
|
+
dialect: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The note's section: one heading line per new file and a list of its
|
|
59
|
+
* statements with their classes. Empty when the pull request adds none.
|
|
60
|
+
*/
|
|
61
|
+
export declare function renderMigrationLines(files: readonly PrMigrationFile[] | undefined): string[];
|
|
62
|
+
//# sourceMappingURL=pr-migrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-migrations.d.ts","sourceRoot":"","sources":["../src/pr-migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,+GAA+G;AAC/G,MAAM,WAAW,kBAAkB;IACjC,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,YAAY,GAAG,WAAW,GAAG,cAAc,GAAG,MAAM,CAAC;IAC9D,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,yDAAyD;AACzD,MAAM,WAAW,2BAA2B;IAC1C,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,yDAAyD;AACzD,MAAM,WAAW,eAAgB,SAAQ,2BAA2B;IAClE,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,iHAAiH;IACjH,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IACvD,OAAO,EAAE,MAAM,CAAC;CACjB;AAoBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAa5F"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The migration files a pull request adds, classified for the plan note
|
|
3
|
+
* (#4407). This is the "check" adoption level: each new migration in a
|
|
4
|
+
* migration-directory workspace member (goose, golang-migrate,
|
|
5
|
+
* clickhouse-migrations, Flyway) is read offline and its statements are given
|
|
6
|
+
* the class the lexicon's classifier gives the same change. Nothing is applied
|
|
7
|
+
* and no server is contacted.
|
|
8
|
+
*
|
|
9
|
+
* Core holds the shapes and the note's lines. The classes come from a
|
|
10
|
+
* lexicon's `classifyMigrations` (`./lexicon.ts`), the way a lexicon's
|
|
11
|
+
* `classifyDisruption` supplies the disruption of an update. Pure: it imports
|
|
12
|
+
* nothing, so `./pr-loop.ts` can render it.
|
|
13
|
+
*/
|
|
14
|
+
/** One line of plain text: the report is read from a file the head's job wrote, so nothing in it breaks the note's layout. */
|
|
15
|
+
const line = (s) => s.replace(/\s+/g, " ").trim();
|
|
16
|
+
const code = (s) => `\`${line(s).replace(/`/g, "'")}\``;
|
|
17
|
+
const changeText = (c) => `${c.label} (${c.rule}${c.lock ? `, ${c.lock}` : ""})${c.destructive ? ", removes data" : ""}`;
|
|
18
|
+
/** The statement's row in the note. */
|
|
19
|
+
function statementText(s) {
|
|
20
|
+
if (s.outcome === "classified")
|
|
21
|
+
return s.changes.map(changeText).join("; ") + (s.note ? `. ${line(s.note)}` : "");
|
|
22
|
+
if (s.outcome === "undecided") {
|
|
23
|
+
const decided = s.changes.length > 0 ? `${s.changes.map(changeText).join("; ")}; ` : "";
|
|
24
|
+
return `${decided}undecided between ${(s.candidates ?? []).map((c) => `${c.rule} ${c.label}`).join(" and ")}${s.note ? `: ${line(s.note)}` : ""}`;
|
|
25
|
+
}
|
|
26
|
+
if (s.outcome === "unclassified")
|
|
27
|
+
return `no class${s.note ? `: ${line(s.note)}` : ""}`;
|
|
28
|
+
return `data, not schema${s.note ? `: ${line(s.note)}` : ""}`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The note's section: one heading line per new file and a list of its
|
|
32
|
+
* statements with their classes. Empty when the pull request adds none.
|
|
33
|
+
*/
|
|
34
|
+
export function renderMigrationLines(files) {
|
|
35
|
+
if (!files || files.length === 0)
|
|
36
|
+
return [];
|
|
37
|
+
const out = ["", `New migration files (${files.length}), classified offline. Nothing is applied and no server is contacted.`];
|
|
38
|
+
for (const f of files) {
|
|
39
|
+
out.push("", `${code(f.file)} (member ${code(f.member)}, ${f.dialect}${f.type === "versioned" ? "" : `, ${f.type}`})`);
|
|
40
|
+
if (f.error) {
|
|
41
|
+
out.push(`- not read: ${line(f.error)}`);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (f.statements.length === 0)
|
|
45
|
+
out.push("- no up statements");
|
|
46
|
+
for (const s of f.statements)
|
|
47
|
+
out.push(`- ${s.index}. ${code(s.sql)}: ${statementText(s)}`);
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
package/dist/pr-post.js
CHANGED
|
@@ -108,7 +108,7 @@ export async function postPlanReport(input) {
|
|
|
108
108
|
state = prStatusState(report);
|
|
109
109
|
description = prStatusDescription(report);
|
|
110
110
|
// A member the change does not reach has nothing to say on the pull request (as pr-plan's own publish).
|
|
111
|
-
if (!(input.member && report.status === "nothing" && !report.overdue?.length))
|
|
111
|
+
if (!(input.member && report.status === "nothing" && !report.overdue?.length && !report.migrations?.length))
|
|
112
112
|
note = planNoteFor(report, input.forge, prNoteMarker(input.env, input.member));
|
|
113
113
|
}
|
|
114
114
|
catch (err) {
|