@intentius/chant 0.124.88 → 0.124.89
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/actor.d.ts +36 -1
- package/dist/actor.d.ts.map +1 -1
- package/dist/actor.js +39 -1
- package/dist/chant-install.d.ts.map +1 -1
- package/dist/chant-install.js +1 -2
- package/dist/ci-base.d.ts +30 -0
- package/dist/ci-base.d.ts.map +1 -0
- package/dist/ci-base.js +33 -0
- package/dist/ci-comment-commands.d.ts +177 -0
- package/dist/ci-comment-commands.d.ts.map +1 -0
- package/dist/ci-comment-commands.js +325 -0
- package/dist/ci-comment-replies.d.ts +40 -0
- package/dist/ci-comment-replies.d.ts.map +1 -0
- package/dist/ci-comment-replies.js +59 -0
- package/dist/ci-evidence-from-job.d.ts +25 -0
- package/dist/ci-evidence-from-job.d.ts.map +1 -1
- package/dist/ci-evidence-from-job.js +43 -2
- package/dist/ci-evidence-jobs.d.ts +30 -1
- package/dist/ci-evidence-jobs.d.ts.map +1 -1
- package/dist/ci-evidence-jobs.js +46 -3
- package/dist/ci-image.d.ts +21 -4
- package/dist/ci-image.d.ts.map +1 -1
- package/dist/ci-image.js +62 -10
- package/dist/ci-note-commands.d.ts +63 -3
- package/dist/ci-note-commands.d.ts.map +1 -1
- package/dist/ci-note-commands.js +69 -35
- package/dist/ci-product-words.d.ts +42 -0
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +25 -0
- package/dist/ci-product.d.ts +31 -0
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +34 -4
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +29 -2
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +2 -1
- package/dist/cli/handlers/ci-check.d.ts +1 -1
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +17 -7
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
- package/dist/cli/handlers/ci-evidence.js +33 -7
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/components.js +3 -1
- package/dist/cli/handlers/generated-check.d.ts +8 -0
- package/dist/cli/handlers/generated-check.d.ts.map +1 -1
- package/dist/cli/handlers/generated-check.js +31 -1
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +121 -4
- package/dist/cli/handlers/pr-comment.d.ts +21 -0
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
- package/dist/cli/handlers/pr-comment.js +112 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +6 -3
- package/dist/cli/handlers/pr.d.ts +23 -1
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +55 -9
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +2 -1
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +11 -2
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +28 -2
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +2 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +24 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +16 -0
- package/dist/cli/registry.d.ts +11 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +2 -1
- package/dist/components/pr-checks.d.ts +70 -6
- package/dist/components/pr-checks.d.ts.map +1 -1
- package/dist/components/pr-checks.js +74 -13
- package/dist/components/pr-pipeline.d.ts +16 -12
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +3 -11
- package/dist/components/product-pipeline.d.ts +42 -1
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +64 -12
- package/dist/components/product-plan.d.ts +190 -5
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +220 -39
- package/dist/drift-record.d.ts +7 -0
- package/dist/drift-record.d.ts.map +1 -1
- package/dist/drift-record.js +19 -0
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +54 -31
- package/dist/forge-check/contract.d.ts +11 -1
- package/dist/forge-check/contract.d.ts.map +1 -1
- package/dist/forge-check/contract.js +4 -1
- package/dist/forge-check/index.d.ts +2 -0
- package/dist/forge-check/index.d.ts.map +1 -1
- package/dist/forge-check/index.js +2 -0
- package/dist/gate-resume-run.d.ts +9 -1
- package/dist/gate-resume-run.d.ts.map +1 -1
- package/dist/gate-resume-run.js +26 -3
- package/dist/generated-check.d.ts +18 -4
- package/dist/generated-check.d.ts.map +1 -1
- package/dist/generated-check.js +37 -5
- package/dist/image-pins.d.ts +26 -0
- package/dist/image-pins.d.ts.map +1 -0
- package/dist/image-pins.js +19 -0
- package/dist/lexicon.d.ts +11 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +11 -0
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +30 -3
- package/dist/lifecycle/publish-npm.d.ts +11 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +27 -1
- package/dist/lifecycle/reach-locks.d.ts +131 -0
- package/dist/lifecycle/reach-locks.d.ts.map +1 -0
- package/dist/lifecycle/reach-locks.js +118 -0
- package/dist/lifecycle/release-cut.d.ts +3 -1
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +15 -0
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +1 -2
- package/dist/notify-product.d.ts +12 -3
- package/dist/notify-product.d.ts.map +1 -1
- package/dist/notify-product.js +10 -6
- package/dist/op/activities/source-release.d.ts.map +1 -1
- package/dist/op/activities/source-release.js +2 -1
- package/dist/op/activities/source-rollback.d.ts.map +1 -1
- package/dist/op/activities/source-rollback.js +2 -1
- package/dist/op/index.d.ts +2 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -0
- package/dist/op/op-waves-evidence-jobs.d.ts +6 -1
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.js +9 -3
- package/dist/op/op-waves-render-spec.d.ts +100 -0
- package/dist/op/op-waves-render-spec.d.ts.map +1 -0
- package/dist/op/op-waves-render-spec.js +162 -0
- package/dist/op/op-waves-run.d.ts +2 -0
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +2 -1
- package/dist/op/op-waves.d.ts +4 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +4 -1
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +59 -3
- package/dist/op/wave-stop.d.ts +64 -0
- package/dist/op/wave-stop.d.ts.map +1 -0
- package/dist/op/wave-stop.js +127 -0
- package/dist/planned-files.d.ts +76 -0
- package/dist/planned-files.d.ts.map +1 -0
- package/dist/planned-files.js +108 -0
- package/dist/pr-forge-job.d.ts +22 -0
- package/dist/pr-forge-job.d.ts.map +1 -0
- package/dist/pr-forge-job.js +46 -0
- package/dist/pr-loop.d.ts +3 -6
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +4 -81
- package/dist/pr-plan-note.d.ts +97 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +94 -1
- package/dist/pr-post.d.ts +28 -3
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +145 -13
- package/dist/pr-status.d.ts +16 -0
- package/dist/pr-status.d.ts.map +1 -0
- package/dist/pr-status.js +90 -0
- package/dist/ref-gate-init.d.ts +16 -2
- package/dist/ref-gate-init.d.ts.map +1 -1
- package/dist/ref-gate-init.js +24 -13
- package/dist/release-floors.d.ts +37 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +61 -25
- package/dist/render-module.d.ts +15 -0
- package/dist/render-module.d.ts.map +1 -0
- package/dist/render-module.js +73 -0
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +1 -2
- package/dist/wave-runtime.mjs +304 -301
- package/dist/workspace/ci-green-cli.d.ts.map +1 -1
- package/dist/workspace/ci-green-cli.js +3 -2
- package/dist/workspace/release-train.d.ts.map +1 -1
- package/dist/workspace/release-train.js +2 -1
- package/dist/workspace/release-workflow.d.ts +4 -3
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +10 -7
- package/dist/workspace/trust/check-evidence-report.d.ts +7 -2
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.js +15 -8
- package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
- package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate-cli.js +30 -10
- package/dist/workspace/workspace-run.d.ts.map +1 -1
- package/dist/workspace/workspace-run.js +2 -1
- package/package.json +1 -1
- package/src/actor.test.ts +68 -2
- package/src/actor.ts +61 -1
- package/src/chant-install.test.ts +2 -3
- package/src/chant-install.ts +1 -2
- package/src/ci-base.test.ts +41 -0
- package/src/ci-base.ts +43 -0
- package/src/ci-comment-commands.test.ts +376 -0
- package/src/ci-comment-commands.ts +389 -0
- package/src/ci-comment-replies.ts +78 -0
- package/src/ci-commit.test.ts +2 -3
- package/src/ci-evidence-from-job.test.ts +18 -0
- package/src/ci-evidence-from-job.ts +58 -2
- package/src/ci-evidence-jobs.ts +50 -5
- package/src/ci-image.test.ts +130 -9
- package/src/ci-image.ts +85 -12
- package/src/ci-note-commands.ts +104 -41
- package/src/ci-product-words.ts +59 -0
- package/src/ci-product.ts +40 -4
- package/src/cli/commands/build.test.ts +41 -0
- package/src/cli/commands/build.ts +27 -2
- package/src/cli/handlers/approve.ts +2 -1
- package/src/cli/handlers/ci-check.ts +19 -7
- package/src/cli/handlers/ci-evidence.ts +29 -8
- package/src/cli/handlers/components.ts +3 -1
- package/src/cli/handlers/generated-check.ts +31 -1
- package/src/cli/handlers/lock-reach.test.ts +103 -0
- package/src/cli/handlers/lock.ts +100 -4
- package/src/cli/handlers/pr-comment.ts +104 -0
- package/src/cli/handlers/pr-env.ts +6 -3
- package/src/cli/handlers/pr-record.test.ts +1 -1
- package/src/cli/handlers/pr.ts +50 -10
- package/src/cli/handlers/promote.ts +2 -1
- package/src/cli/handlers/release.e2e.test.ts +35 -0
- package/src/cli/handlers/release.ts +14 -2
- package/src/cli/handlers/run-wave.ts +28 -2
- package/src/cli/handlers/run.ts +2 -1
- package/src/cli/main.ts +24 -2
- package/src/cli/parse-args.ts +12 -0
- package/src/cli/registry.ts +11 -0
- package/src/components/auto-release.ts +2 -1
- package/src/components/pr-checks.ts +112 -17
- package/src/components/pr-pipeline.ts +17 -15
- package/src/components/product-pipeline.ts +93 -11
- package/src/components/product-plan.test.ts +40 -2
- package/src/components/product-plan.ts +331 -45
- package/src/drift-record.test.ts +20 -0
- package/src/drift-record.ts +16 -0
- package/src/floor-table.data.ts +54 -31
- package/src/forge-check/contract.ts +12 -1
- package/src/forge-check/forge-check.test.ts +17 -0
- package/src/forge-check/index.ts +2 -0
- package/src/gate-resume-run.ts +27 -3
- package/src/generated-check.e2e.test.ts +21 -1
- package/src/generated-check.test.ts +66 -0
- package/src/generated-check.ts +51 -10
- package/src/image-pins.ts +31 -0
- package/src/lexicon.ts +11 -0
- package/src/lifecycle/git.test.ts +48 -0
- package/src/lifecycle/git.ts +27 -4
- package/src/lifecycle/publish-npm.ts +31 -1
- package/src/lifecycle/reach-locks.test.ts +87 -0
- package/src/lifecycle/reach-locks.ts +169 -0
- package/src/lifecycle/release-cut.ts +17 -1
- package/src/lifecycle/release-images.test.ts +56 -0
- package/src/lifecycle/release-images.ts +1 -2
- package/src/notify-product.ts +19 -8
- package/src/op/activities/source-release.ts +2 -1
- package/src/op/activities/source-rollback.ts +2 -1
- package/src/op/gate-resume.test.ts +27 -0
- package/src/op/index.ts +10 -0
- package/src/op/op-waves-evidence-jobs.ts +10 -4
- package/src/op/op-waves-notify-words.test.ts +18 -0
- package/src/op/op-waves-render-spec.test.ts +160 -0
- package/src/op/op-waves-render-spec.ts +171 -0
- package/src/op/op-waves-run.ts +2 -1
- package/src/op/op-waves.ts +5 -2
- package/src/op/schedule-overdue.test.ts +43 -0
- package/src/op/schedule-overdue.ts +57 -3
- package/src/op/wave-stop.test.ts +72 -0
- package/src/op/wave-stop.ts +137 -0
- package/src/planned-files.test.ts +80 -0
- package/src/planned-files.ts +134 -0
- package/src/pr-forge-job.test.ts +53 -0
- package/src/pr-forge-job.ts +46 -0
- package/src/pr-loop-narrowed.test.ts +2 -1
- package/src/pr-loop-words.test.ts +2 -1
- package/src/pr-loop.test.ts +1 -2
- package/src/pr-loop.ts +4 -80
- package/src/pr-plan-note.ts +155 -3
- package/src/pr-post-replan.test.ts +144 -0
- package/src/pr-post-subject.test.ts +230 -0
- package/src/pr-post.test.ts +2 -1
- package/src/pr-post.ts +150 -15
- package/src/pr-status.ts +91 -0
- package/src/ref-gate-init.ts +30 -11
- package/src/release-floors.ts +78 -25
- package/src/render-module.ts +73 -0
- package/src/state-migration-record.test.ts +2 -3
- package/src/state-migration.ts +1 -2
- package/src/workspace/ci-green-cli.ts +3 -2
- package/src/workspace/ci-green-workflow.test.ts +32 -1
- package/src/workspace/release-train.ts +2 -1
- package/src/workspace/release-workflow.test.ts +36 -5
- package/src/workspace/release-workflow.ts +10 -7
- package/src/workspace/trust/check-evidence-report.ts +15 -8
- package/src/workspace/trust/check-evidence.test.ts +5 -0
- package/src/workspace/trust/ref-gate-cli.ts +30 -8
- package/src/workspace/trust/ref-gate-pieces.test.ts +46 -1
- package/src/workspace/trust/ref-gate.test.ts +10 -0
- package/src/workspace/workspace-run.ts +2 -1
package/dist/pr-plan-note.d.ts
CHANGED
|
@@ -62,7 +62,73 @@ export interface PrPlanNoteHandoff {
|
|
|
62
62
|
* one space, at most {@link PRODUCT_MARKER_LIMIT} characters.
|
|
63
63
|
*/
|
|
64
64
|
marker?: string;
|
|
65
|
+
/**
|
|
66
|
+
* What the plan is taken over (#4972), such as sql-yodeler's plan digest
|
|
67
|
+
* and its subject's parts: `pr-post` compares it with the subject it kept
|
|
68
|
+
* in the previous note for the same environment and member, says what
|
|
69
|
+
* changed when its id differs, and keeps this one in the new note.
|
|
70
|
+
*/
|
|
71
|
+
subject?: PrPlanSubject;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A plan's subject (#4972), as a plan verb hands it to the note job, which
|
|
75
|
+
* compares it with the previous note's, so the plan job needs no forge
|
|
76
|
+
* token to read the previous note on any forge. Both are the change's code,
|
|
77
|
+
* so each word is checked against {@link PLAN_SUBJECT_WORD}.
|
|
78
|
+
*/
|
|
79
|
+
export interface PrPlanSubject {
|
|
80
|
+
/** The plan as one word, such as its digest: a different id is a changed plan. */
|
|
81
|
+
id: string;
|
|
82
|
+
/**
|
|
83
|
+
* The parts the id is taken over, each `<group>` or `<group>/<item>` to a
|
|
84
|
+
* word (a checksum, a list joined by commas): `pr-post` names the parts
|
|
85
|
+
* added, gone and changed, group by group, in the note words'
|
|
86
|
+
* `subjectParts`. Absent: the line says only that the plan changed.
|
|
87
|
+
*/
|
|
88
|
+
parts?: Record<string, string>;
|
|
89
|
+
}
|
|
90
|
+
/** A word of a plan subject (#4972): letters, digits and `_.,:+=-`, at most 1024 characters, nothing that ends a comment or mentions anyone. */
|
|
91
|
+
export declare const PLAN_SUBJECT_WORD: RegExp;
|
|
92
|
+
/** A plan subject part's key (#4972): `<group>` or `<group>/<item>`. */
|
|
93
|
+
export declare const PLAN_SUBJECT_KEY: RegExp;
|
|
94
|
+
/** The most characters the note's kept subject line holds (#4972); a subject with more parts is kept by its id alone. */
|
|
95
|
+
export declare const PLAN_SUBJECT_LIMIT = 16384;
|
|
96
|
+
/** Why `subject` is not a {@link PrPlanSubject} (#4972), or undefined when it is one. */
|
|
97
|
+
export declare function planSubjectProblem(subject: unknown): string | undefined;
|
|
98
|
+
/** How the note words name one group's changes (#4972), each over `{group}` and `{items}`, the group's items as `item` writes them, joined by ", ". */
|
|
99
|
+
export interface PrPlanSubjectPartWords {
|
|
100
|
+
added?: string;
|
|
101
|
+
gone?: string;
|
|
102
|
+
changed?: string;
|
|
103
|
+
/** One item, over `{item}`, `{before}` and `{after}`. Default `{item}`, or for a part with no item `{before} -> {after}` (changed), `{after}` (added), `{before}` (gone). */
|
|
104
|
+
item?: string;
|
|
65
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* A product's plan note hand-off whose note is the product's own text
|
|
108
|
+
* (#4963), in place of a {@link PrPlanNote}: sql-yodeler's tenant set note,
|
|
109
|
+
* which chant's note cannot carry yet. `pr-post` checks it as it checks a
|
|
110
|
+
* {@link PrPlanNoteHandoff}, writes every `<!--` in `body` as `<!--`,
|
|
111
|
+
* puts chant's marker and the product's line (`marker`) above it, adds the
|
|
112
|
+
* overdue Ops and the note job's notices under it, and cuts it to the
|
|
113
|
+
* forge's limit.
|
|
114
|
+
*/
|
|
115
|
+
export interface PrPlanBodyHandoff extends Omit<PrPlanNoteHandoff, "note"> {
|
|
116
|
+
/** The note's markdown, at most {@link PLAN_BODY_LIMIT} characters. */
|
|
117
|
+
body: string;
|
|
118
|
+
}
|
|
119
|
+
/** The most characters a {@link PrPlanBodyHandoff.body} holds (#4963). */
|
|
120
|
+
export declare const PLAN_BODY_LIMIT = 1000000;
|
|
121
|
+
/** The hand-off for a product's own note text (#4963), as a plan verb writes it to {@link PR_PLAN_NOTE_FILE}. */
|
|
122
|
+
export declare function planBodyHandoff(body: string, at: {
|
|
123
|
+
pr: number;
|
|
124
|
+
head: string;
|
|
125
|
+
env: string;
|
|
126
|
+
member?: string;
|
|
127
|
+
state: PrPlanNoteHandoff["state"];
|
|
128
|
+
description: string;
|
|
129
|
+
marker?: string;
|
|
130
|
+
subject?: PrPlanSubject;
|
|
131
|
+
}): PrPlanBodyHandoff;
|
|
66
132
|
/** The most characters a hand-off's {@link PrPlanNoteHandoff.marker} holds (#4931). */
|
|
67
133
|
export declare const PRODUCT_MARKER_LIMIT = 4096;
|
|
68
134
|
/** What a hand-off's marker may hold (#4931): no `-->`, no `<` or `>`, nothing that ends the comment or starts another. */
|
|
@@ -79,6 +145,7 @@ export declare function planNoteHandoff(note: PrPlanNote, at: {
|
|
|
79
145
|
state: PrPlanNoteHandoff["state"];
|
|
80
146
|
description: string;
|
|
81
147
|
marker?: string;
|
|
148
|
+
subject?: PrPlanSubject;
|
|
82
149
|
}): PrPlanNoteHandoff;
|
|
83
150
|
/** One change line of a group, as chant's plan summary groups them. */
|
|
84
151
|
export interface PrPlanNoteChange {
|
|
@@ -305,7 +372,37 @@ export interface PrPlanNoteWords {
|
|
|
305
372
|
* note by it. Absent: a hand-off's marker is dropped.
|
|
306
373
|
*/
|
|
307
374
|
productMarker?: string;
|
|
375
|
+
/**
|
|
376
|
+
* The line `pr-post` adds when a hand-off's subject differs from the
|
|
377
|
+
* previous note's (#4972), over `{previous}` (the previous subject's id)
|
|
378
|
+
* and `{changes}` (what changed, part by part, joined by "; "). Default
|
|
379
|
+
* "Since the previous version of this note (`{previous}`): {changes}.".
|
|
380
|
+
*/
|
|
381
|
+
sinceLast?: string;
|
|
382
|
+
/**
|
|
383
|
+
* The line when no part says what changed (#4972): the subject has no
|
|
384
|
+
* parts, or the previous note kept its id alone. Over `{previous}`.
|
|
385
|
+
* Default "The plan changed since the previous version of this note (`{previous}`).".
|
|
386
|
+
*/
|
|
387
|
+
sinceLastOnly?: string;
|
|
388
|
+
/** How `{changes}` names each group of the subject's parts (#4972), by group. Default "{group}: {items} added" (gone, changed). */
|
|
389
|
+
subjectParts?: Record<string, PrPlanSubjectPartWords>;
|
|
308
390
|
}
|
|
391
|
+
/** The {@link PrPlanNoteWords.sinceLast} default (#4972). */
|
|
392
|
+
export declare const SINCE_LAST_LINE = "Since the previous version of this note (`{previous}`): {changes}.";
|
|
393
|
+
/** The {@link PrPlanNoteWords.sinceLastOnly} default (#4972). */
|
|
394
|
+
export declare const SINCE_LAST_ONLY_LINE = "The plan changed since the previous version of this note (`{previous}`).";
|
|
395
|
+
/**
|
|
396
|
+
* What changed from `before` to `after`, group by group (#4972): each
|
|
397
|
+
* group's added, gone and changed parts in the note words, groups in the
|
|
398
|
+
* order `after` names them, then those only `before` names.
|
|
399
|
+
*/
|
|
400
|
+
export declare function subjectChanges(before: Record<string, string>, after: Record<string, string>, words?: Record<string, PrPlanSubjectPartWords>): string[];
|
|
401
|
+
/**
|
|
402
|
+
* The line for a plan whose subject is no longer `previous`'s (#4972), in
|
|
403
|
+
* the note words, or undefined when the ids are the same.
|
|
404
|
+
*/
|
|
405
|
+
export declare function sinceLastLine(previous: PrPlanSubject, now: PrPlanSubject, words?: Pick<PrPlanNoteWords, "sinceLast" | "sinceLastOnly" | "subjectParts">): string | undefined;
|
|
309
406
|
/** Options for {@link renderPlanNote}. */
|
|
310
407
|
export interface PlanNoteOptions {
|
|
311
408
|
/** The most characters the note may hold. Default GitHub's 65,536. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-plan-note.d.ts","sourceRoot":"","sources":["../src/pr-plan-note.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAiD,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAExG,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAE7C,sDAAsD;AACtD,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD;;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U,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,eAAe,CAAA;CAAO,GAAG,MAAM,CAElK;AAED,iDAAiD;AACjD,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,UAAU,CAEhE;AAYD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAE5D;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAK1D;AAED,2GAA2G;AAC3G,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;CAAE,GAAG,MAAM,CAEtK;AAmBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE,eAAoB,GAAG,MAAM,CAqOxF"}
|
package/dist/pr-plan-note.js
CHANGED
|
@@ -35,6 +35,37 @@ export const PR_PLAN_NOTE_CONTRACT = 1;
|
|
|
35
35
|
* it with `pr-post`.
|
|
36
36
|
*/
|
|
37
37
|
export const PR_PLAN_NOTE_FILE = "pr-plan-note.json";
|
|
38
|
+
/** A word of a plan subject (#4972): letters, digits and `_.,:+=-`, at most 1024 characters, nothing that ends a comment or mentions anyone. */
|
|
39
|
+
export const PLAN_SUBJECT_WORD = /^[A-Za-z0-9_.,:+=-]{1,1024}$/;
|
|
40
|
+
/** A plan subject part's key (#4972): `<group>` or `<group>/<item>`. */
|
|
41
|
+
export const PLAN_SUBJECT_KEY = /^[A-Za-z0-9_.:+=-]{1,128}(\/[A-Za-z0-9_.,:+=-]{1,256})?$/;
|
|
42
|
+
/** The most characters the note's kept subject line holds (#4972); a subject with more parts is kept by its id alone. */
|
|
43
|
+
export const PLAN_SUBJECT_LIMIT = 16384;
|
|
44
|
+
/** Why `subject` is not a {@link PrPlanSubject} (#4972), or undefined when it is one. */
|
|
45
|
+
export function planSubjectProblem(subject) {
|
|
46
|
+
if (!subject || typeof subject !== "object" || Array.isArray(subject))
|
|
47
|
+
return "is not an object";
|
|
48
|
+
const s = subject;
|
|
49
|
+
if (typeof s.id !== "string" || !PLAN_SUBJECT_WORD.test(s.id))
|
|
50
|
+
return "has no id of letters, digits and _.,:+=-";
|
|
51
|
+
if (s.parts === undefined)
|
|
52
|
+
return undefined;
|
|
53
|
+
if (!s.parts || typeof s.parts !== "object" || Array.isArray(s.parts))
|
|
54
|
+
return "has parts that are not an object";
|
|
55
|
+
for (const [k, v] of Object.entries(s.parts)) {
|
|
56
|
+
if (!PLAN_SUBJECT_KEY.test(k))
|
|
57
|
+
return `has a part ${JSON.stringify(k.slice(0, 64))} that is not <group> or <group>/<item>`;
|
|
58
|
+
if (typeof v !== "string" || !PLAN_SUBJECT_WORD.test(v))
|
|
59
|
+
return `has a part ${k} whose value is not a word of letters, digits and _.,:+=-`;
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
/** The most characters a {@link PrPlanBodyHandoff.body} holds (#4963). */
|
|
64
|
+
export const PLAN_BODY_LIMIT = 1000000;
|
|
65
|
+
/** The hand-off for a product's own note text (#4963), as a plan verb writes it to {@link PR_PLAN_NOTE_FILE}. */
|
|
66
|
+
export function planBodyHandoff(body, at) {
|
|
67
|
+
return { kind: "plan-note-handoff", contract: PR_PLAN_NOTE_CONTRACT, pr: at.pr, head: at.head, env: at.env, ...(at.member !== undefined ? { member: at.member } : {}), state: at.state, description: at.description, body, ...(at.marker !== undefined ? { marker: at.marker } : {}), ...(at.subject !== undefined ? { subject: at.subject } : {}) };
|
|
68
|
+
}
|
|
38
69
|
/** The most characters a hand-off's {@link PrPlanNoteHandoff.marker} holds (#4931). */
|
|
39
70
|
export const PRODUCT_MARKER_LIMIT = 4096;
|
|
40
71
|
/** What a hand-off's marker may hold (#4931): no `-->`, no `<` or `>`, nothing that ends the comment or starts another. */
|
|
@@ -47,7 +78,69 @@ export function productMarkerLine(name, body) {
|
|
|
47
78
|
}
|
|
48
79
|
/** The hand-off for `note` (#4799), as a product's plan verb writes it to {@link PR_PLAN_NOTE_FILE}. */
|
|
49
80
|
export function planNoteHandoff(note, at) {
|
|
50
|
-
return { kind: "plan-note-handoff", contract: PR_PLAN_NOTE_CONTRACT, pr: at.pr, head: note.head, env: at.env, ...(at.member !== undefined ? { member: at.member } : {}), state: at.state, description: at.description, note, ...(at.marker !== undefined ? { marker: at.marker } : {}) };
|
|
81
|
+
return { kind: "plan-note-handoff", contract: PR_PLAN_NOTE_CONTRACT, pr: at.pr, head: note.head, env: at.env, ...(at.member !== undefined ? { member: at.member } : {}), state: at.state, description: at.description, note, ...(at.marker !== undefined ? { marker: at.marker } : {}), ...(at.subject !== undefined ? { subject: at.subject } : {}) };
|
|
82
|
+
}
|
|
83
|
+
/** The {@link PrPlanNoteWords.sinceLast} default (#4972). */
|
|
84
|
+
export const SINCE_LAST_LINE = "Since the previous version of this note (`{previous}`): {changes}.";
|
|
85
|
+
/** The {@link PrPlanNoteWords.sinceLastOnly} default (#4972). */
|
|
86
|
+
export const SINCE_LAST_ONLY_LINE = "The plan changed since the previous version of this note (`{previous}`).";
|
|
87
|
+
/**
|
|
88
|
+
* What changed from `before` to `after`, group by group (#4972): each
|
|
89
|
+
* group's added, gone and changed parts in the note words, groups in the
|
|
90
|
+
* order `after` names them, then those only `before` names.
|
|
91
|
+
*/
|
|
92
|
+
export function subjectChanges(before, after, words = {}) {
|
|
93
|
+
const groupOf = (k) => {
|
|
94
|
+
const at = k.indexOf("/");
|
|
95
|
+
return at < 0 ? [k, ""] : [k.slice(0, at), k.slice(at + 1)];
|
|
96
|
+
};
|
|
97
|
+
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
|
98
|
+
const groups = [];
|
|
99
|
+
for (const k of [...Object.keys(after), ...Object.keys(before)]) {
|
|
100
|
+
const [g] = groupOf(k);
|
|
101
|
+
if (!groups.includes(g))
|
|
102
|
+
groups.push(g);
|
|
103
|
+
}
|
|
104
|
+
const fill = (t, v) => t.replace(/\{(group|items|item|before|after)\}/g, (_, n) => v[n] ?? "");
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const group of groups) {
|
|
107
|
+
const w = has(words, group) ? words[group] : {};
|
|
108
|
+
const kinds = { added: [], gone: [], changed: [] };
|
|
109
|
+
const say = (kind, item, b, a) => {
|
|
110
|
+
const dflt = item !== "" ? "{item}" : kind === "changed" ? "{before} -> {after}" : kind === "added" ? "{after}" : "{before}";
|
|
111
|
+
kinds[kind].push(fill(w.item ?? dflt, { item, before: b, after: a, group }));
|
|
112
|
+
};
|
|
113
|
+
for (const k of Object.keys(after)) {
|
|
114
|
+
const [g, item] = groupOf(k);
|
|
115
|
+
if (g !== group)
|
|
116
|
+
continue;
|
|
117
|
+
if (!has(before, k))
|
|
118
|
+
say("added", item, "", after[k]);
|
|
119
|
+
else if (before[k] !== after[k])
|
|
120
|
+
say("changed", item, before[k], after[k]);
|
|
121
|
+
}
|
|
122
|
+
for (const k of Object.keys(before)) {
|
|
123
|
+
const [g, item] = groupOf(k);
|
|
124
|
+
if (g === group && !has(after, k))
|
|
125
|
+
say("gone", item, before[k], "");
|
|
126
|
+
}
|
|
127
|
+
for (const kind of ["added", "gone", "changed"]) {
|
|
128
|
+
if (kinds[kind].length > 0)
|
|
129
|
+
out.push(fill(w[kind] ?? `{group}: {items} ${kind}`, { group, items: kinds[kind].join(", ") }));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return out;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The line for a plan whose subject is no longer `previous`'s (#4972), in
|
|
136
|
+
* the note words, or undefined when the ids are the same.
|
|
137
|
+
*/
|
|
138
|
+
export function sinceLastLine(previous, now, words = {}) {
|
|
139
|
+
if (previous.id === now.id)
|
|
140
|
+
return undefined;
|
|
141
|
+
const changes = previous.parts && now.parts ? subjectChanges(previous.parts, now.parts, words.subjectParts) : [];
|
|
142
|
+
const fill = (t) => t.replace(/\{(previous|changes)\}/g, (_, n) => (n === "previous" ? previous.id : changes.join("; ")));
|
|
143
|
+
return changes.length > 0 ? fill(words.sinceLast ?? SINCE_LAST_LINE) : fill(words.sinceLastOnly ?? SINCE_LAST_ONLY_LINE);
|
|
51
144
|
}
|
|
52
145
|
const NOTE_WORDS = {
|
|
53
146
|
footer: "",
|
package/dist/pr-post.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ import { type CiProductWords } from "./ci-product-words.js";
|
|
|
34
34
|
import { type ControlEdgeFacts } from "./control/edges.js";
|
|
35
35
|
import type { OpRunRecordInput } from "./op/runtime.js";
|
|
36
36
|
import type { RunOrigin } from "./lifecycle/release-ledger.js";
|
|
37
|
-
import { type PrPlanNoteHandoff, type PrPlanNoteWords } from "./pr-plan-note.js";
|
|
37
|
+
import { type PrPlanBodyHandoff, type PrPlanNoteHandoff, type PrPlanNoteWords, type PrPlanSubject } from "./pr-plan-note.js";
|
|
38
38
|
/** The plan report's file under the report directory. */
|
|
39
39
|
export declare const PR_PLAN_REPORT_FILE = "pr-plan.json";
|
|
40
40
|
/** What {@link postPlanReport} posts for. */
|
|
@@ -98,6 +98,14 @@ export interface PlanPostInput {
|
|
|
98
98
|
* pushes. `keep` returns a warning to say, when there is one.
|
|
99
99
|
*/
|
|
100
100
|
recordRun?: PlanRunRecorder;
|
|
101
|
+
/**
|
|
102
|
+
* The one argument a re-plan was narrowed to (#4963), such as a
|
|
103
|
+
* terragucci root: when the report or the hand-off says the change
|
|
104
|
+
* reaches nothing, the pull request gets a reply that the argument is not
|
|
105
|
+
* affected, and the note and the status stay as they were. Ignored when
|
|
106
|
+
* empty or not one plain word.
|
|
107
|
+
*/
|
|
108
|
+
notAffected?: string;
|
|
101
109
|
}
|
|
102
110
|
/** How the note job keeps the plan job's run record (#4899). */
|
|
103
111
|
export interface PlanRunRecorder {
|
|
@@ -131,11 +139,22 @@ export declare function readPlanReport(input: Pick<PlanPostInput, "dir" | "pr" |
|
|
|
131
139
|
* The note for `report`, rendered here, with every `<!--` after the marker
|
|
132
140
|
* line written as `<!--`, so the note carries no hidden marker but its own.
|
|
133
141
|
*/
|
|
134
|
-
export declare function planNoteFor(report: PrReport, forge: Pick<PrForge, "kind" | "host">, marker: string, baseTip?: string): string;
|
|
142
|
+
export declare function planNoteFor(report: PrReport, forge: Pick<PrForge, "kind" | "host">, marker: string, baseTip?: string, own?: string): string;
|
|
135
143
|
/** The hidden line a note carries with the target branch's commit it was posted against (#4628). */
|
|
136
144
|
export declare function prNoteTipMarker(sha: string): string;
|
|
137
145
|
/** The hidden line a note marked stale carries, with the commit it was marked at (#4628). */
|
|
138
146
|
export declare function prNoteStaleMarker(sha: string): string;
|
|
147
|
+
/**
|
|
148
|
+
* The hidden line a note keeps its plan's subject in (#4972): base64url of
|
|
149
|
+
* the subject's JSON, `{ id }` alone when its parts would make the line
|
|
150
|
+
* longer than {@link PLAN_SUBJECT_LIMIT}. Undefined when even that is.
|
|
151
|
+
*/
|
|
152
|
+
export declare function prNoteSubjectMarker(subject: PrPlanSubject): string | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* The subject a note kept (#4972), checked again: the line was chant's, but
|
|
155
|
+
* what it holds came from an earlier plan job. Undefined when there is none.
|
|
156
|
+
*/
|
|
157
|
+
export declare function subjectInNote(body: string): PrPlanSubject | undefined;
|
|
139
158
|
/** The note as the job summary shows it (#4628): the hidden lines dropped. */
|
|
140
159
|
export declare function planNoteSummary(note: string): string;
|
|
141
160
|
/**
|
|
@@ -149,10 +168,16 @@ export declare function postPlanReport(input: PlanPostInput): Promise<PlanPostRe
|
|
|
149
168
|
* one the caller ran, as {@link readPlanReport} checks a report.
|
|
150
169
|
*/
|
|
151
170
|
export declare function readPlanNoteHandoff(input: Pick<PlanPostInput, "dir" | "pr" | "head" | "env" | "member">): {
|
|
152
|
-
handoff: PrPlanNoteHandoff;
|
|
171
|
+
handoff: PrPlanNoteHandoff | PrPlanBodyHandoff;
|
|
153
172
|
} | {
|
|
154
173
|
refused: string;
|
|
155
174
|
};
|
|
175
|
+
/**
|
|
176
|
+
* The note for a hand-off of the product's own text (#4963): chant's
|
|
177
|
+
* marker, the product's line, the body with every `<!--` defused, the
|
|
178
|
+
* notices as quoted lines under it, the tip line, cut to the forge's limit.
|
|
179
|
+
*/
|
|
180
|
+
export declare function planBodyHandoffNote(handoff: PrPlanBodyHandoff, forge: Pick<PrForge, "kind">, marker: string, noteWords?: PrPlanNoteWords, baseTip?: string, notices?: readonly string[]): string;
|
|
156
181
|
/** The notices in the file `CHANT_PLAN_NOTE_NOTICES` names (#4931), one a line, or none when unset or unreadable. */
|
|
157
182
|
export declare function noticesFromEnv(env?: NodeJS.ProcessEnv): string[];
|
|
158
183
|
/**
|
package/dist/pr-post.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-post.d.ts","sourceRoot":"","sources":["../src/pr-post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,
|
|
1
|
+
{"version":3,"file":"pr-post.d.ts","sourceRoot":"","sources":["../src/pr-post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,EAA+C,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEvG,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAmC,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAkD,KAAK,gBAAgB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ACpC,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+FAA+F;IAC/F,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,4DAA4D;AAC5D,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAiD/G"}
|
package/dist/pr-post.js
CHANGED
|
@@ -31,14 +31,15 @@
|
|
|
31
31
|
import { appendFileSync, existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
32
32
|
import { tmpdir } from "node:os";
|
|
33
33
|
import { join } from "node:path";
|
|
34
|
-
import { prNoteMarker, prStatusContext,
|
|
34
|
+
import { prNoteMarker, prStatusContext, renderPrNote } from "./pr-loop.js";
|
|
35
|
+
import { prStatusDescription, prStatusState } from "./pr-status.js";
|
|
35
36
|
import { forgePrincipalOf } from "./pr-forge.js";
|
|
36
|
-
import { GITHUB_COMMENT_LIMIT, GITLAB_NOTE_LIMIT } from "./plan-summary.js";
|
|
37
|
+
import { fitNote, GITHUB_COMMENT_LIMIT, GITLAB_NOTE_LIMIT } from "./plan-summary.js";
|
|
37
38
|
import { activeProductWords, commentLine } from "./ci-product-words.js";
|
|
38
39
|
import { controlEdgeFactsFromEnv, remarkCrossStackEdges } from "./control/edges.js";
|
|
39
40
|
import { CHECK_EVIDENCE_FILE, checkEvidenceNoteLine, openEvidenceFor } from "./workspace/trust/check-evidence-report.js";
|
|
40
41
|
import { PLAN_RUN_RECORD_FILE, readPlanRunRecord } from "./pr-plan-record.js";
|
|
41
|
-
import { isPlanNote, planNoteMarker, PR_PLAN_NOTE_CONTRACT, PR_PLAN_NOTE_FILE, PRODUCT_MARKER_BODY, PRODUCT_MARKER_LIMIT, PRODUCT_MARKER_NAME, productMarkerLine, renderPlanNote } from "./pr-plan-note.js";
|
|
42
|
+
import { isPlanNote, PLAN_BODY_LIMIT, PLAN_SUBJECT_LIMIT, planNoteMarker, planSubjectProblem, PR_PLAN_NOTE_CONTRACT, PR_PLAN_NOTE_FILE, PRODUCT_MARKER_BODY, PRODUCT_MARKER_LIMIT, PRODUCT_MARKER_NAME, productMarkerLine, renderPlanNote, sinceLastLine } from "./pr-plan-note.js";
|
|
42
43
|
/** The plan report's file under the report directory. */
|
|
43
44
|
export const PR_PLAN_REPORT_FILE = "pr-plan.json";
|
|
44
45
|
const SHA = /^[0-9a-f]{40}$/;
|
|
@@ -80,7 +81,7 @@ export function readPlanReport(input) {
|
|
|
80
81
|
* The note for `report`, rendered here, with every `<!--` after the marker
|
|
81
82
|
* line written as `<!--`, so the note carries no hidden marker but its own.
|
|
82
83
|
*/
|
|
83
|
-
export function planNoteFor(report, forge, marker, baseTip) {
|
|
84
|
+
export function planNoteFor(report, forge, marker, baseTip, own) {
|
|
84
85
|
const note = renderPrNote(report, {
|
|
85
86
|
limit: forge.kind === "gitlab" ? GITLAB_NOTE_LIMIT : GITHUB_COMMENT_LIMIT,
|
|
86
87
|
approver: forgePrincipalOf(forge.kind, forge.host, "<your-login>"),
|
|
@@ -89,7 +90,42 @@ export function planNoteFor(report, forge, marker, baseTip) {
|
|
|
89
90
|
const rest = (at < 0 ? "" : note.slice(at + 1)).split("<!--").join("<!--");
|
|
90
91
|
// #4628: the tip line is written after the defusing, from the caller's sha, never the report's.
|
|
91
92
|
const tip = baseTip && SHA.test(baseTip) ? `${rest.endsWith("\n") ? "" : "\n"}${prNoteTipMarker(baseTip)}\n` : "";
|
|
92
|
-
|
|
93
|
+
// #4963: the product's own line, already checked, under chant's marker.
|
|
94
|
+
return `${marker}\n${own ? `${own}\n` : ""}${rest}${tip}`;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The product's hidden line for a report or a hand-off (#4931, #4963): from
|
|
98
|
+
* the pipeline's `productMarker` and the file's `marker`, checked against
|
|
99
|
+
* {@link PRODUCT_MARKER_BODY}. Undefined when either is missing or the
|
|
100
|
+
* marker is not plain words.
|
|
101
|
+
*/
|
|
102
|
+
function productLineOf(name, marker) {
|
|
103
|
+
if (name === undefined || !PRODUCT_MARKER_NAME.test(name) || typeof marker !== "string" || marker.length > PRODUCT_MARKER_LIMIT)
|
|
104
|
+
return undefined;
|
|
105
|
+
if (marker !== "" && !PRODUCT_MARKER_BODY.test(marker))
|
|
106
|
+
return undefined;
|
|
107
|
+
return productMarkerLine(name, marker);
|
|
108
|
+
}
|
|
109
|
+
/** The one plain word a re-plan was narrowed to (#4963), or undefined. */
|
|
110
|
+
function narrowedTo(input) {
|
|
111
|
+
const a = input.notAffected?.trim();
|
|
112
|
+
return a && /^[A-Za-z0-9_.\/@+=,:-]+$/.test(a) ? a : undefined;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The reply for a re-plan narrowed to an argument the change does not
|
|
116
|
+
* reach (#4963), in place of the note and the status, as terragucci's
|
|
117
|
+
* plan-note job replied (plan-note.ts).
|
|
118
|
+
*/
|
|
119
|
+
async function replyNotAffected(input, argument, state, warnings) {
|
|
120
|
+
const description = `${argument} is not affected by this pull request, so nothing was planned.`;
|
|
121
|
+
try {
|
|
122
|
+
await input.forge.addComment(input.pr, `${activeProductWords().product}: ${description}`);
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
warnings.push(`could not reply on #${input.pr}: ${err instanceof Error ? err.message : String(err)}`);
|
|
126
|
+
}
|
|
127
|
+
const recorded = await keepRunRecord(input, warnings);
|
|
128
|
+
return { state, description: cut(description), noted: false, ...(recorded ? { recorded } : {}), warnings };
|
|
93
129
|
}
|
|
94
130
|
/** The hidden line a note carries with the target branch's commit it was posted against (#4628). */
|
|
95
131
|
export function prNoteTipMarker(sha) {
|
|
@@ -99,6 +135,55 @@ export function prNoteTipMarker(sha) {
|
|
|
99
135
|
export function prNoteStaleMarker(sha) {
|
|
100
136
|
return `<!-- chant-pr-stale:${sha} -->`;
|
|
101
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* The hidden line a note keeps its plan's subject in (#4972): base64url of
|
|
140
|
+
* the subject's JSON, `{ id }` alone when its parts would make the line
|
|
141
|
+
* longer than {@link PLAN_SUBJECT_LIMIT}. Undefined when even that is.
|
|
142
|
+
*/
|
|
143
|
+
export function prNoteSubjectMarker(subject) {
|
|
144
|
+
const line = (s) => `<!-- chant-pr-subject:${Buffer.from(JSON.stringify(s), "utf8").toString("base64url")} -->`;
|
|
145
|
+
const full = line(subject);
|
|
146
|
+
if (full.length <= PLAN_SUBJECT_LIMIT)
|
|
147
|
+
return full;
|
|
148
|
+
const bare = line({ id: subject.id });
|
|
149
|
+
return bare.length <= PLAN_SUBJECT_LIMIT ? bare : undefined;
|
|
150
|
+
}
|
|
151
|
+
const SUBJECT_LINE = /^<!-- chant-pr-subject:([A-Za-z0-9_-]+) -->$/m;
|
|
152
|
+
/**
|
|
153
|
+
* The subject a note kept (#4972), checked again: the line was chant's, but
|
|
154
|
+
* what it holds came from an earlier plan job. Undefined when there is none.
|
|
155
|
+
*/
|
|
156
|
+
export function subjectInNote(body) {
|
|
157
|
+
const m = SUBJECT_LINE.exec(body.replace(/\r\n/g, "\n"));
|
|
158
|
+
if (!m?.[1] || m[1].length > PLAN_SUBJECT_LIMIT)
|
|
159
|
+
return undefined;
|
|
160
|
+
try {
|
|
161
|
+
const s = JSON.parse(Buffer.from(m[1], "base64url").toString("utf8"));
|
|
162
|
+
return planSubjectProblem(s) === undefined ? s : undefined;
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The line saying what changed since the previous note (#4972): the
|
|
170
|
+
* previous note of the same environment and member is read with the job's
|
|
171
|
+
* token, and its kept subject compared with the hand-off's. Undefined when
|
|
172
|
+
* there is no previous note, it kept no subject, or the id is the same. A
|
|
173
|
+
* forge that refuses the read is a warning.
|
|
174
|
+
*/
|
|
175
|
+
async function sinceLastOf(input, subject, words, warnings) {
|
|
176
|
+
let found;
|
|
177
|
+
try {
|
|
178
|
+
found = await input.forge.findComment(input.pr, prNoteMarker(input.env, input.member));
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
warnings.push(`could not read the previous note on #${input.pr}, so the note does not say what changed since it: ${err instanceof Error ? err.message : String(err)}`);
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
const previous = found ? subjectInNote(found.body) : undefined;
|
|
185
|
+
return previous ? sinceLastLine(previous, subject, words ?? {}) : undefined;
|
|
186
|
+
}
|
|
102
187
|
const TIP_LINE = /<!-- chant-pr-tip:([0-9a-f]{40}) -->/;
|
|
103
188
|
const STALE_LINE = /<!-- chant-pr-stale:([0-9a-f]{40}) -->/;
|
|
104
189
|
const STALE_PREFIX = "> Stale: ";
|
|
@@ -135,6 +220,10 @@ export async function postPlanReport(input) {
|
|
|
135
220
|
}
|
|
136
221
|
else {
|
|
137
222
|
let report = read.report;
|
|
223
|
+
// #4963: a re-plan narrowed to an argument the change does not reach.
|
|
224
|
+
const narrowed = narrowedTo(input);
|
|
225
|
+
if (narrowed && report.status === "nothing" && !failedJob)
|
|
226
|
+
return replyNotAffected(input, narrowed, "success", warnings);
|
|
138
227
|
if (input.overdue) {
|
|
139
228
|
const { overdue: _forged, ...rest } = report;
|
|
140
229
|
const found = await input.overdue().catch(() => []);
|
|
@@ -149,8 +238,10 @@ export async function postPlanReport(input) {
|
|
|
149
238
|
state = prStatusState(report);
|
|
150
239
|
description = prStatusDescription(report);
|
|
151
240
|
// A member the change does not reach has nothing to say on the pull request (as pr-plan's own publish).
|
|
241
|
+
// #4963: the report's own `marker`, under the pipeline's productMarker, as a hand-off's.
|
|
242
|
+
const own = productLineOf((input.noteWords ?? noteWordsFromEnv())?.productMarker, read.report.marker);
|
|
152
243
|
if (!(input.member && report.status === "nothing" && !report.overdue?.length && !report.migrations?.length))
|
|
153
|
-
note = planNoteFor(report, input.forge, prNoteMarker(input.env, input.member), input.baseTip);
|
|
244
|
+
note = planNoteFor(report, input.forge, prNoteMarker(input.env, input.member), input.baseTip, own);
|
|
154
245
|
}
|
|
155
246
|
catch (err) {
|
|
156
247
|
refused = `the plan report does not render: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -276,15 +367,43 @@ export function readPlanNoteHandoff(input) {
|
|
|
276
367
|
return { refused: `the plan note's state ${JSON.stringify(r.state)} is not success, failure or pending` };
|
|
277
368
|
if (typeof r.description !== "string")
|
|
278
369
|
return { refused: "the plan note has no description" };
|
|
279
|
-
|
|
370
|
+
// #4963: the product's own text in place of a plan note.
|
|
371
|
+
if (r.body !== undefined) {
|
|
372
|
+
if (r.note !== undefined)
|
|
373
|
+
return { refused: "the plan note gives both a note and a body; give one" };
|
|
374
|
+
if (typeof r.body !== "string" || r.body.length > PLAN_BODY_LIMIT)
|
|
375
|
+
return { refused: `the plan note's body is not text of at most ${PLAN_BODY_LIMIT} characters` };
|
|
376
|
+
}
|
|
377
|
+
else if (!isPlanNote(r.note) || r.note.head !== r.head || !Array.isArray(r.note.waves) || !Array.isArray(r.note.groups) || !Array.isArray(r.note.named)) {
|
|
280
378
|
return { refused: "the plan note's note is not a plan note for its head" };
|
|
281
379
|
}
|
|
282
380
|
// #4931: the product's hidden line is the change's too, so it holds only plain words.
|
|
283
381
|
if (r.marker !== undefined && (typeof r.marker !== "string" || r.marker.length > PRODUCT_MARKER_LIMIT || (r.marker !== "" && !PRODUCT_MARKER_BODY.test(r.marker)))) {
|
|
284
382
|
return { refused: `the plan note's marker is not words of letters, digits and _.,/@+=:- of at most ${PRODUCT_MARKER_LIMIT} characters` };
|
|
285
383
|
}
|
|
384
|
+
// #4972: the subject is kept in the note and said back in a later one, so it holds only plain words too.
|
|
385
|
+
const subjectProblem = r.subject !== undefined ? planSubjectProblem(r.subject) : undefined;
|
|
386
|
+
if (subjectProblem)
|
|
387
|
+
return { refused: `the plan note's subject ${subjectProblem}` };
|
|
286
388
|
return { handoff: doc };
|
|
287
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* The note for a hand-off of the product's own text (#4963): chant's
|
|
392
|
+
* marker, the product's line, the body with every `<!--` defused, the
|
|
393
|
+
* notices as quoted lines under it, the tip line, cut to the forge's limit.
|
|
394
|
+
*/
|
|
395
|
+
export function planBodyHandoffNote(handoff, forge, marker, noteWords, baseTip, notices = []) {
|
|
396
|
+
const limit = forge.kind === "gitlab" ? GITLAB_NOTE_LIMIT : GITHUB_COMMENT_LIMIT;
|
|
397
|
+
const line = productLineOf(noteWords?.productMarker, handoff.marker);
|
|
398
|
+
const head = `${marker}\n${line ? `${line}\n` : ""}`;
|
|
399
|
+
const said = notices.length > 0 ? `\n${notices.map((n) => `> ${n.split("<!--").join("<!--")}`).join("\n")}\n` : "";
|
|
400
|
+
const tip = baseTip && SHA.test(baseTip) ? `${prNoteTipMarker(baseTip)}\n` : "";
|
|
401
|
+
// #4972: the subject, kept for the next note to compare with.
|
|
402
|
+
const kept = handoff.subject ? prNoteSubjectMarker(handoff.subject) : undefined;
|
|
403
|
+
const subject = kept ? `${kept}\n` : "";
|
|
404
|
+
const body = handoff.body.split("<!--").join("<!--").replace(/\n*$/, "\n");
|
|
405
|
+
return `${head}${fitNote(body, { limit: Math.max(0, limit - head.length - said.length - tip.length - subject.length) })}${said}${tip}${subject}`;
|
|
406
|
+
}
|
|
288
407
|
/** The notices in the file `CHANT_PLAN_NOTE_NOTICES` names (#4931), one a line, or none when unset or unreadable. */
|
|
289
408
|
export function noticesFromEnv(env = process.env) {
|
|
290
409
|
const file = env.CHANT_PLAN_NOTE_NOTICES;
|
|
@@ -318,7 +437,10 @@ function noteWordsFromEnv() {
|
|
|
318
437
|
*/
|
|
319
438
|
export function planNoteHandoffNote(handoff, forge, marker, noteWords, baseTip) {
|
|
320
439
|
const words = activeProductWords();
|
|
321
|
-
|
|
440
|
+
// #4972: the subject, kept for the next note to compare with, within the forge's limit.
|
|
441
|
+
const kept = handoff.subject ? prNoteSubjectMarker(handoff.subject) : undefined;
|
|
442
|
+
const limit = (forge.kind === "gitlab" ? GITLAB_NOTE_LIMIT : GITHUB_COMMENT_LIMIT) - (kept ? kept.length + 1 : 0);
|
|
443
|
+
const rendered = renderPlanNote(handoff.note, { limit, words, ...(noteWords ? { note: noteWords } : {}) });
|
|
322
444
|
let body = rendered.split("<!--").join("<!--");
|
|
323
445
|
const n = handoff.note;
|
|
324
446
|
const previews = n.previews ?? [];
|
|
@@ -328,7 +450,8 @@ export function planNoteHandoffNote(handoff, forge, marker, noteWords, baseTip)
|
|
|
328
450
|
// #4931: the product's own line, from the pipeline's name and the hand-off's checked body, under chant's marker.
|
|
329
451
|
const name = noteWords?.productMarker;
|
|
330
452
|
const own = name !== undefined && PRODUCT_MARKER_NAME.test(name) && handoff.marker !== undefined ? `${productMarkerLine(name, handoff.marker)}\n` : "";
|
|
331
|
-
|
|
453
|
+
const subject = kept ? `${body.endsWith("\n") || tip ? "" : "\n"}${kept}\n` : "";
|
|
454
|
+
return `${marker}\n${own}${body}${tip}${subject}`;
|
|
332
455
|
}
|
|
333
456
|
/** {@link postPlanReport} for a product's plan note hand-off (#4799). */
|
|
334
457
|
async function postPlanNoteHandoff(input) {
|
|
@@ -348,14 +471,23 @@ async function postPlanNoteHandoff(input) {
|
|
|
348
471
|
else {
|
|
349
472
|
state = read.handoff.state;
|
|
350
473
|
description = read.handoff.description;
|
|
474
|
+
const h = read.handoff;
|
|
475
|
+
// #4963: a re-plan narrowed to an argument the change does not reach.
|
|
476
|
+
const narrowed = narrowedTo(input);
|
|
477
|
+
if (narrowed && "note" in h && h.note.nothing === true && !failedJob)
|
|
478
|
+
return replyNotAffected(input, narrowed, state, warnings);
|
|
351
479
|
// #4931: the overdue Ops (#4289), asked here with the job's token, and the note job's own notices, under the counts.
|
|
352
|
-
const given =
|
|
480
|
+
const given = "note" in h ? (h.note.notices ?? []) : [];
|
|
353
481
|
// An Op the product's own notices already call overdue is not said twice.
|
|
354
482
|
const overdue = input.overdue ? (await input.overdue().catch(() => [])).filter((o) => !given.some((g) => g.includes(`\`${o.op}\``) && g.includes("overdue"))).map((o) => o.message) : [];
|
|
355
|
-
const
|
|
356
|
-
|
|
483
|
+
const noteWords = input.noteWords ?? noteWordsFromEnv();
|
|
484
|
+
// #4972: what changed since the previous note, from the subject it kept, read here with the job's token.
|
|
485
|
+
const since = h.subject ? await sinceLastOf(input, h.subject, noteWords, warnings) : undefined;
|
|
486
|
+
const added = [...(since ? [since] : []), ...overdue, ...(input.notices ?? noticesFromEnv())].filter((n, i, all) => !given.includes(n) && all.indexOf(n) === i);
|
|
357
487
|
try {
|
|
358
|
-
note =
|
|
488
|
+
note = "note" in h
|
|
489
|
+
? planNoteHandoffNote(added.length > 0 ? { ...h, note: { ...h.note, notices: [...given, ...added] } } : h, input.forge, prNoteMarker(input.env, input.member), noteWords, input.baseTip)
|
|
490
|
+
: planBodyHandoffNote(h, input.forge, prNoteMarker(input.env, input.member), noteWords, input.baseTip, added);
|
|
359
491
|
}
|
|
360
492
|
catch (err) {
|
|
361
493
|
refused = `the plan note does not render: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pull-request loop's commit status (#3183): its description and its
|
|
3
|
+
* state, from the report `chant components pr-plan` and `pr-apply` write.
|
|
4
|
+
*
|
|
5
|
+
* They lived in `./pr-loop.ts` until #4966 moved them here, so the bundle
|
|
6
|
+
* a product builds from `pr-loop.ts` and `pr-forge.ts` (the report, the note
|
|
7
|
+
* and the forge clients, `pr-loop-bundle.test.ts`) keeps room under its
|
|
8
|
+
* ceiling. chant's own handlers post the status; no product reads these.
|
|
9
|
+
*/
|
|
10
|
+
import { type CiProductWords } from "./ci-product-words.js";
|
|
11
|
+
import { type PrReport } from "./pr-loop.js";
|
|
12
|
+
/** A commit status's description, at most 140 characters (GitHub's limit). */
|
|
13
|
+
export declare function prStatusDescription(report: PrReport, words?: CiProductWords): string;
|
|
14
|
+
/** The commit status state for a report: success, failure, or pending while it waits on approval. */
|
|
15
|
+
export declare function prStatusState(report: PrReport): "success" | "failure" | "pending";
|
|
16
|
+
//# sourceMappingURL=pr-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-status.d.ts","sourceRoot":"","sources":["../src/pr-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE7D,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAE,cAAqC,GAAG,MAAM,CAgE1G;AAED,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CASjF"}
|