ticket-runner 0.6.4 → 0.6.6
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/README.ko.md +5 -5
- package/README.md +4 -4
- package/docs/templates/operator-skill.md +81 -16
- package/package.json +1 -1
- package/src/acceptance-criteria.ts +99 -2
- package/src/adapters/claude-agent-runner.ts +5 -5
- package/src/adapters/exec.ts +32 -4
- package/src/adapters/gh-tracker.ts +276 -60
- package/src/adapters/git-workspace.ts +27 -10
- package/src/adapters/liveness.ts +77 -0
- package/src/adapters/process-tree.ts +4 -7
- package/src/adapters/version.ts +5 -5
- package/src/branch.ts +1 -1
- package/src/cli.ts +2 -2
- package/src/config.ts +22 -4
- package/src/conventions.ts +22 -19
- package/src/credential.ts +14 -13
- package/src/criteria.ts +102 -52
- package/src/failing-base.ts +7 -7
- package/src/failure-message.ts +72 -0
- package/src/guards.ts +21 -6
- package/src/handoff.ts +2 -2
- package/src/init.ts +8 -8
- package/src/landing.ts +1 -1
- package/src/lifecycle.ts +2 -2
- package/src/lock.ts +10 -2
- package/src/note-schema.ts +14 -11
- package/src/notes.ts +19 -7
- package/src/operator-skill.ts +2 -2
- package/src/orchestrator.ts +758 -275
- package/src/outside-fault.ts +103 -0
- package/src/ports/agent-runner.ts +1 -1
- package/src/ports/tracker.ts +29 -15
- package/src/ports/workspace.ts +52 -24
- package/src/progress.ts +42 -7
- package/src/prompts.ts +242 -34
- package/src/readiness.ts +11 -11
- package/src/remove.ts +7 -7
- package/src/resume.ts +28 -20
- package/src/run-log.ts +5 -5
- package/src/run.ts +55 -13
- package/src/staleness.ts +14 -14
- package/src/start.ts +29 -16
- package/src/stranded.ts +19 -19
- package/src/templates.ts +398 -149
- package/src/title.ts +106 -8
- package/src/transcript-home.ts +49 -0
- package/src/verdict.ts +132 -27
- package/src/version-number.ts +13 -13
- package/src/version-pr.ts +12 -12
package/src/failing-base.ts
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
* Whether a Check a Ticket's branch failed is one it inherited.
|
|
3
3
|
*
|
|
4
4
|
* The Checks run on the Ticket's branch, and CI on its pull request, so a
|
|
5
|
-
* failure alone cannot say whether the branch brought it or the
|
|
6
|
-
* did. A test that starts failing on the
|
|
5
|
+
* failure alone cannot say whether the branch brought it or the base branch
|
|
6
|
+
* did. A test that starts failing on the base branch fails on every branch at
|
|
7
7
|
* once, and a fix Stage per Ticket then mends it differently in each pull
|
|
8
|
-
* request, at the cost of every Ticket's
|
|
9
|
-
* once more, at what the branch inherited: its merge-base with the
|
|
8
|
+
* request, at the cost of every Ticket's fix budget. So a failure is graded
|
|
9
|
+
* once more, at what the branch inherited: its merge-base with the base branch,
|
|
10
10
|
* checked out clean in a worktree of its own. One that fails there too is the
|
|
11
|
-
*
|
|
11
|
+
* base branch's, and the Ticket is released rather than charged for it.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { baseWorktreePath } from "./branch.js";
|
|
15
15
|
import type { RoutedNote } from "./notes.js";
|
|
16
16
|
import type { CheckOutcome, Workspace } from "./ports/workspace.js";
|
|
17
17
|
|
|
18
|
-
/** A Check command the
|
|
18
|
+
/** A Check command the base branch fails, and how. */
|
|
19
19
|
export interface FailingBase {
|
|
20
20
|
/** The merge-base it fails at, in full. */
|
|
21
21
|
commit: string;
|
|
@@ -38,7 +38,7 @@ export interface BaseCheckRun {
|
|
|
38
38
|
* posted about the ones that failed there.
|
|
39
39
|
*
|
|
40
40
|
* A Run has one and every Lane shares it, so the Tickets that fail together
|
|
41
|
-
* over one broken
|
|
41
|
+
* over one broken base branch cost one run of the Check between them, and one
|
|
42
42
|
* Note. Runs at the same commit take turns, because they share its worktree.
|
|
43
43
|
* A run that could not be made — no worktree, no git — is forgotten rather
|
|
44
44
|
* than kept, as a standing Notes lookup that failed is: the Ticket that asked
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An error message as the pipeline shows it.
|
|
3
|
+
*
|
|
4
|
+
* A failure the pipeline did not expect reaches it as an error whose message
|
|
5
|
+
* is a command and how it exited, on its first line, and then whatever the
|
|
6
|
+
* command printed: `throwOnFailure` in `adapters/exec.ts` builds it so, giving
|
|
7
|
+
* an argument with a newline in it by its first line alone. Wherever one line
|
|
8
|
+
* is expected — a hand-off's `Failure:` line, a draft pull request's opening,
|
|
9
|
+
* a Run summary's row, a console log line — the first line goes, and the
|
|
10
|
+
* output goes where the whole of it can be read. No line of the output is
|
|
11
|
+
* picked as the reason: a rule that picked one would name the wrong cause on
|
|
12
|
+
* an output nobody has seen yet, and the output is never dropped.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** A message's one line, and the output that followed it. */
|
|
16
|
+
export interface SplitMessage {
|
|
17
|
+
/** The first line that says anything: the command and how it exited. */
|
|
18
|
+
line: string;
|
|
19
|
+
/** Everything after it, trimmed; empty when the message is one line. */
|
|
20
|
+
output: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function splitMessage(message: string): SplitMessage {
|
|
24
|
+
const lines = message.split("\n");
|
|
25
|
+
const first = lines.findIndex((line) => line.trim() !== "");
|
|
26
|
+
if (first === -1) return { line: "", output: "" };
|
|
27
|
+
return {
|
|
28
|
+
line: lines[first]!.trim(),
|
|
29
|
+
output: lines
|
|
30
|
+
.slice(first + 1)
|
|
31
|
+
.join("\n")
|
|
32
|
+
.trim(),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* What a log line whose output was already printed in this Run says in place
|
|
38
|
+
* of printing it again.
|
|
39
|
+
*/
|
|
40
|
+
const SAME_OUTPUT = "the same output as above";
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The Run's console log, printing each failure's output once.
|
|
44
|
+
*
|
|
45
|
+
* One cause tends to fail several steps of a Ticket in turn — a remote that
|
|
46
|
+
* refuses SSH fails the push, the draft pull request, the transcripts and the
|
|
47
|
+
* pull the rebase starts with — and each event logs the same output. Printed
|
|
48
|
+
* nine times it buries the lines that matter, so a line whose output this log
|
|
49
|
+
* has already printed gives its one line and says the output is the same.
|
|
50
|
+
* A line with no output passes as it is.
|
|
51
|
+
*/
|
|
52
|
+
export function printEachOutputOnce(print: (line: string) => void): (line: string) => void {
|
|
53
|
+
const printed = new Set<string>();
|
|
54
|
+
return (text) => {
|
|
55
|
+
const { line, output } = splitMessage(text);
|
|
56
|
+
if (output === "") return print(text);
|
|
57
|
+
if (printed.has(output)) return print(`${line} · ${SAME_OUTPUT}`);
|
|
58
|
+
printed.add(output);
|
|
59
|
+
print(text);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A quoted message ended as a sentence, so that a sentence can follow it.
|
|
65
|
+
*
|
|
66
|
+
* A command's output often ends with its own full stop, and one appended after
|
|
67
|
+
* it reads as a typo: "…and the repository exists.. It still names this Run".
|
|
68
|
+
*/
|
|
69
|
+
export function endSentence(message: string): string {
|
|
70
|
+
const trimmed = message.trimEnd();
|
|
71
|
+
return /[.!?]$/.test(trimmed) ? trimmed : `${trimmed}.`;
|
|
72
|
+
}
|
package/src/guards.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UNCHECKED_BOX } from "./acceptance-criteria.js";
|
|
1
|
+
import { TICKED_BOX, UNCHECKED_BOX } from "./acceptance-criteria.js";
|
|
2
2
|
import type { Issue } from "./ports/tracker.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -54,8 +54,8 @@ export function skipReason(
|
|
|
54
54
|
/**
|
|
55
55
|
* Whether this is a **Stranded Ticket**: one this checkout already holds, left
|
|
56
56
|
* claimed by a Run that never came back (GLOSSARY.md). Both refusals read the
|
|
57
|
-
*
|
|
58
|
-
* assignee is this very user and `ready-for-agent` came off when the
|
|
57
|
+
* claim as somebody else's work, and a stranded Ticket wears it itself — the
|
|
58
|
+
* assignee is this very user and `ready-for-agent` came off when the claim was
|
|
59
59
|
* made — so it passes them and is resumed rather than refused. The Planning
|
|
60
60
|
* guards below still grade it: they are about the issue, not about who has it.
|
|
61
61
|
*
|
|
@@ -79,9 +79,24 @@ const CRITERION_LINE = new RegExp(UNCHECKED_BOX, "m");
|
|
|
79
79
|
|
|
80
80
|
/** Triage posts its brief as a comment, so criteria are not always in the body. */
|
|
81
81
|
function hasCriteria(issue: Issue): boolean {
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
return texts(issue).some((text) => CRITERION_LINE.test(text));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** {@link TICKED_BOX}, over every line of a text, whichever case its `x` is in. */
|
|
86
|
+
const TICKED_LINE = new RegExp(TICKED_BOX, "gmi");
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* How many ticked checkboxes the Ticket carries, which is what the
|
|
90
|
+
* `no-criteria` guard says of one that has no unticked box: written with every
|
|
91
|
+
* box already ticked, it reads as having no criteria at all unless told so.
|
|
92
|
+
*/
|
|
93
|
+
export function tickedBoxes(issue: Issue): number {
|
|
94
|
+
return texts(issue).reduce((count, text) => count + [...text.matchAll(TICKED_LINE)].length, 0);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Every place a Ticket writes its criteria: its body, then its comments. */
|
|
98
|
+
function texts(issue: Issue): string[] {
|
|
99
|
+
return [issue.body, ...issue.comments.map((comment) => comment.body)];
|
|
85
100
|
}
|
|
86
101
|
|
|
87
102
|
/**
|
package/src/handoff.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* the Ticket is relabelled and a Run takes it again, the comment still reads as
|
|
6
6
|
* the last word on it — and on a Ticket that then merges it is the last thing
|
|
7
7
|
* on a closed issue, because the progress comment is edited in place above it
|
|
8
|
-
* and the merge writes nothing below. So the
|
|
8
|
+
* and the merge writes nothing below. So the claim marks every hand-off comment
|
|
9
9
|
* on the Ticket as history on its way past.
|
|
10
10
|
*
|
|
11
11
|
* Marked, not removed: the failure, the location and the evidence are worth
|
|
@@ -21,7 +21,7 @@ import { HANDOFF_MARKER, findMarkedComments, handoffTakenComment } from "./templ
|
|
|
21
21
|
* Every hand-off comment the Ticket is still carrying as current, each with the
|
|
22
22
|
* body that would mark it as history.
|
|
23
23
|
*
|
|
24
|
-
* One question, asked twice: it is what the
|
|
24
|
+
* One question, asked twice: it is what the claim edits, and it is also what
|
|
25
25
|
* says a human has been holding the Ticket since the last Run put it down.
|
|
26
26
|
*/
|
|
27
27
|
function unmarkedHandoffs(
|
package/src/init.ts
CHANGED
|
@@ -63,12 +63,12 @@ const FAIL = "✗";
|
|
|
63
63
|
export interface InitOptions {
|
|
64
64
|
repoRoot: string;
|
|
65
65
|
/**
|
|
66
|
-
* The
|
|
66
|
+
* The version doing the setting up, which the report's first line names. A
|
|
67
67
|
* string the CLI resolved, never something read from here (ADR-0007).
|
|
68
68
|
*/
|
|
69
69
|
version: string;
|
|
70
70
|
/**
|
|
71
|
-
* The pipeline's own repository, as `owner/name`, which the newer-
|
|
71
|
+
* The pipeline's own repository, as `owner/name`, which the newer-version
|
|
72
72
|
* notice is looked up against; see {@link import("./staleness.js")}.
|
|
73
73
|
*/
|
|
74
74
|
repository?: string | undefined;
|
|
@@ -170,7 +170,7 @@ function writeTargetFiles(repoRoot: string, version: string): string[] {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
|
-
* The
|
|
173
|
+
* The version that set this Target up, where it is newer than the one setting
|
|
174
174
|
* it up now, and nothing otherwise.
|
|
175
175
|
*
|
|
176
176
|
* Read off the conventions document's mark, which is the only thing in a
|
|
@@ -184,7 +184,7 @@ export function newerSetUp(repoRoot: string, version: string): NewerSetUp | unde
|
|
|
184
184
|
: undefined;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
/** Which newer
|
|
187
|
+
/** Which newer version set a Target up, and which one found it. */
|
|
188
188
|
export interface NewerSetUp {
|
|
189
189
|
mark: string;
|
|
190
190
|
own: string;
|
|
@@ -229,7 +229,7 @@ function ensureConfigFile(repoRoot: string): string | undefined {
|
|
|
229
229
|
*
|
|
230
230
|
* The mark is read before the text, because it is the only thing that says
|
|
231
231
|
* which way round the two copies are. Nothing is refused either way: a Target
|
|
232
|
-
* is not worse for carrying a document from another
|
|
232
|
+
* is not worse for carrying a document from another version.
|
|
233
233
|
*/
|
|
234
234
|
function ensureConventionsDoc(
|
|
235
235
|
repoRoot: string,
|
|
@@ -254,9 +254,9 @@ function ensureConventionsDoc(
|
|
|
254
254
|
/**
|
|
255
255
|
* Which of the four ways a copy came to be rewritten this one was.
|
|
256
256
|
*
|
|
257
|
-
* A copy marked with this very
|
|
257
|
+
* A copy marked with this very version is the odd one: nothing about the
|
|
258
258
|
* pipeline moved, so the difference is something the Target did to the file,
|
|
259
|
-
* and saying it was left by the
|
|
259
|
+
* and saying it was left by the version now writing it would read as nonsense.
|
|
260
260
|
*/
|
|
261
261
|
function rewritten(
|
|
262
262
|
existing: string | undefined,
|
|
@@ -264,7 +264,7 @@ function rewritten(
|
|
|
264
264
|
own: string | undefined,
|
|
265
265
|
): string {
|
|
266
266
|
if (existing === undefined) return "written";
|
|
267
|
-
if (mark === undefined) return "overwritten, because the copy here carried no
|
|
267
|
+
if (mark === undefined) return "overwritten, because the copy here carried no version";
|
|
268
268
|
if (mark === own) return "overwritten, because the copy here said something else";
|
|
269
269
|
return `overwritten, because the copy here was left by ${mark}`;
|
|
270
270
|
}
|
package/src/landing.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface LandingTurn {
|
|
|
17
17
|
* The Landing: the stretch of a Ticket from its rebase to the pull of the Base
|
|
18
18
|
* branch after its merge, which one Ticket is in at a time (ADR-0005).
|
|
19
19
|
*
|
|
20
|
-
* A Run has one and every Ticket it drives shares it, so the
|
|
20
|
+
* A Run has one and every Ticket it drives shares it, so the base branch cannot
|
|
21
21
|
* move between a Ticket's rebase and its merge: what CI graded is what lands.
|
|
22
22
|
* Turns are taken in arrival order — the Ticket that reaches the rebase first
|
|
23
23
|
* lands first, whatever its number — and a Ticket that leaves the stretch for a
|
package/src/lifecycle.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Where a Ticket was when it failed. Named after the lifecycle step, not the
|
|
3
|
-
* Stage, because Checks, rebase,
|
|
3
|
+
* Stage, because Checks, rebase, pull request and CI are not agent sessions.
|
|
4
4
|
*/
|
|
5
5
|
export type FailurePoint =
|
|
6
6
|
| "setup"
|
|
@@ -19,7 +19,7 @@ export type FailurePoint =
|
|
|
19
19
|
*
|
|
20
20
|
* Every other failure ends the Ticket where it stands, because none of them is
|
|
21
21
|
* a defect in the code a fresh session could go and mend: a Stage that never
|
|
22
|
-
* came back, a
|
|
22
|
+
* came back, a verdict with no evidence in it, a pull request whose checks
|
|
23
23
|
* timed out or never ran. A rebase conflict is on this list only once the
|
|
24
24
|
* conflict Stage has failed to resolve it, which is what makes it a defect in
|
|
25
25
|
* the branch rather than a state nobody has tried to mend yet. Uncommitted work
|
package/src/lock.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
|
+
import { endSentence } from "./failure-message.js";
|
|
3
4
|
import { type Host, describeHost, sameHost } from "./host.js";
|
|
4
5
|
import type { HeldLock, LockHolder } from "./ports/workspace.js";
|
|
5
6
|
|
|
@@ -57,10 +58,17 @@ export function lockFileContents(holder: LockHolder | undefined): string {
|
|
|
57
58
|
/**
|
|
58
59
|
* The commit message a lock change carries, which is what GitHub shows beside
|
|
59
60
|
* the branch: who holds the Target, or that nobody does.
|
|
61
|
+
*
|
|
62
|
+
* A command that named a Ticket as `#<n>`, as `ticket-runner run #12` may, is
|
|
63
|
+
* written here without the `#`: GitHub links a pushed commit that mentions
|
|
64
|
+
* `#<n>` to issue `<n>`, on whatever branch the commit is, so every take would
|
|
65
|
+
* leave a line on that Ticket's timeline. The lock file keeps the command as it
|
|
66
|
+
* was typed.
|
|
60
67
|
*/
|
|
61
68
|
export function lockCommitMessage(holder: LockHolder | undefined): string {
|
|
62
69
|
if (holder === undefined) return "Free";
|
|
63
|
-
|
|
70
|
+
const command = holder.command.replace(/#+(?=\d)/g, "");
|
|
71
|
+
return `Held by run ${holder.runId} on ${describeHost(holder.host)}: ${command}`;
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
/**
|
|
@@ -121,7 +129,7 @@ export function lockHeldMessage({ holder, onAnotherHost }: HeldLock): string {
|
|
|
121
129
|
*/
|
|
122
130
|
export function unreleasedLockMessage(reason: string): string {
|
|
123
131
|
return (
|
|
124
|
-
`Could not release the Run lock: ${reason}
|
|
132
|
+
`Could not release the Run lock: ${endSentence(reason)} It still names this Run on the ` +
|
|
125
133
|
`\`${LOCK_BRANCH}\` branch. The next Run on this Host takes it over by itself; for a ` +
|
|
126
134
|
`Run on any other Host, commit a \`${LOCK_FILE}\` that reads \`${FREE_LOCK}\` to that ` +
|
|
127
135
|
"branch on GitHub, or ask an Operator to."
|
package/src/note-schema.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* a Stage actually reads: two copies would drift, and the Stage reading the
|
|
7
7
|
* stale one would be the only place it showed.
|
|
8
8
|
*
|
|
9
|
-
* A module of its own rather than a corner of `notes.ts`, because the
|
|
9
|
+
* A module of its own rather than a corner of `notes.ts`, because the verdict's
|
|
10
10
|
* schema carries this list too and `notes.ts` reaches the templates a Note is
|
|
11
|
-
* posted with, which read a
|
|
11
|
+
* posted with, which read a verdict. Only the shape a Stage is asked for lives
|
|
12
12
|
* here, so both schemas can share it without that cycle.
|
|
13
13
|
*
|
|
14
14
|
* `ticket` is optional on purpose: a Stage that guesses a number puts the Note
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
* only needs a Ticket by its `next`. `next` alone is optional, because a Stage
|
|
22
22
|
* that knows neither a fix nor the decision in the way has nothing to put there.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* Each Stage reads it with one more sentence in its description, saying where a
|
|
25
|
+
* defect of its own branch goes instead: the Stages that write code read
|
|
26
|
+
* {@link CODE_STAGE_NOTES_LIST_SCHEMA}, and verify reads the verdict's copy.
|
|
26
27
|
*/
|
|
27
28
|
export const NOTES_LIST_SCHEMA = {
|
|
28
29
|
type: "array",
|
|
@@ -61,17 +62,19 @@ export const NOTES_LIST_SCHEMA = {
|
|
|
61
62
|
} as const;
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
65
|
+
* What a defect the branch itself made is, in the words every Stage is told it
|
|
66
|
+
* in: one declaration, so the code Stages and verify cannot drift apart on it.
|
|
66
67
|
*/
|
|
67
|
-
export const
|
|
68
|
-
"A defect this branch introduced, one that behaves correctly on the
|
|
68
|
+
export const BRANCH_DEFECT =
|
|
69
|
+
"A defect this branch introduced, one that behaves correctly on the base branch and wrongly here, or one in code this branch added";
|
|
70
|
+
|
|
71
|
+
/** Whose such a defect is, in the words the code Stages' schema and prompts use. */
|
|
72
|
+
export const OWN_DEFECT = `${BRANCH_DEFECT}, belongs to this Ticket`;
|
|
69
73
|
|
|
70
74
|
/**
|
|
71
75
|
* The list as the implement and fix Stages read it: a defect their own branch
|
|
72
|
-
* introduced is theirs to fix, not to list. verify
|
|
73
|
-
*
|
|
74
|
-
* regression it demonstrates beside them still has only a Note to go in.
|
|
76
|
+
* introduced is theirs to fix, not to list. verify reads the list with a
|
|
77
|
+
* description of its own, which sends such a defect to its verdict instead.
|
|
75
78
|
*/
|
|
76
79
|
export const CODE_STAGE_NOTES_LIST_SCHEMA = {
|
|
77
80
|
...NOTES_LIST_SCHEMA,
|
package/src/notes.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A Stage that meets a defect in code it was not sent to touch has three bad
|
|
5
5
|
* options and one good one. Fixing it widens the Ticket past the Acceptance
|
|
6
|
-
* Criteria the
|
|
6
|
+
* Criteria the verdict grades. Ignoring it loses it. Writing it into the
|
|
7
7
|
* Ticket's own comments buries it under a Ticket that is about to close. So it
|
|
8
8
|
* records a **Note** instead, and the pipeline puts the Note where somebody
|
|
9
9
|
* will meet it: the comments of the Ticket it belongs to, or the standing
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Notes ride along with the structured output of the implement, verify and fix
|
|
13
13
|
* Stages: the two that write code, which meet what they were not sent to touch,
|
|
14
|
-
* and the one that grades, whose
|
|
14
|
+
* and the one that grades, whose verdict has a slot per Acceptance Criterion and
|
|
15
15
|
* none for anything else it found. A Stage with nothing to report emits an empty
|
|
16
16
|
* list and is not treated differently for it.
|
|
17
17
|
*/
|
|
@@ -55,13 +55,23 @@ export interface Note extends NoteText {
|
|
|
55
55
|
ticket?: number;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* A Note one of this Ticket's code Stages wrote, as the verify Stage behind it
|
|
60
|
+
* is shown it: what it says and which Stage said it, so a defect of the branch
|
|
61
|
+
* among them is graded rather than left to the Note.
|
|
62
|
+
*/
|
|
63
|
+
export interface WrittenNote {
|
|
64
|
+
stage: Exclude<NotingStage, "verify">;
|
|
65
|
+
note: Note;
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
/** A Note that reached GitHub, which is what a Run summary reports. */
|
|
59
69
|
export interface RoutedNote {
|
|
60
70
|
/** The Ticket whose Stage made the finding, or whose Release did. */
|
|
61
71
|
origin: number;
|
|
62
72
|
/**
|
|
63
73
|
* The Stage that made it, or the pipeline itself: the one Note no Stage
|
|
64
|
-
* writes is the pipeline's, about a
|
|
74
|
+
* writes is the pipeline's, about a base branch failing a Check.
|
|
65
75
|
*/
|
|
66
76
|
stage: NotingStage | "pipeline";
|
|
67
77
|
/** The issue the Note reached: the Ticket it named, or the standing Notes issue. */
|
|
@@ -97,7 +107,7 @@ const noteSchema = z.object({
|
|
|
97
107
|
});
|
|
98
108
|
|
|
99
109
|
/** The parts of a Note beside its summary. */
|
|
100
|
-
const NOTE_PARTS = ["evidence", "impact", "next"] as const;
|
|
110
|
+
export const NOTE_PARTS = ["evidence", "impact", "next"] as const;
|
|
101
111
|
|
|
102
112
|
/**
|
|
103
113
|
* The Notes in a Stage's structured output, and nothing else from it.
|
|
@@ -378,9 +388,11 @@ async function route(routing: NoteRouting, note: Note): Promise<RoutedNote> {
|
|
|
378
388
|
return { origin, stage, issue: ticket, opened: false, summary: text.summary };
|
|
379
389
|
}
|
|
380
390
|
} catch (error) {
|
|
391
|
+
// The message last, as every other event logs one, so what a failed
|
|
392
|
+
// command printed follows the line it is printed under.
|
|
381
393
|
routing.log?.(
|
|
382
|
-
`#${origin} could not comment its Note on #${ticket} ` +
|
|
383
|
-
|
|
394
|
+
`#${origin} could not comment its Note on #${ticket}, sending it to triage instead: ` +
|
|
395
|
+
(error as Error).message,
|
|
384
396
|
);
|
|
385
397
|
return await sendToTriage(routing, { ...from, intended: ticket });
|
|
386
398
|
}
|
|
@@ -400,7 +412,7 @@ async function route(routing: NoteRouting, note: Note): Promise<RoutedNote> {
|
|
|
400
412
|
* finishes with, after `which`.
|
|
401
413
|
*
|
|
402
414
|
* Claimed is the label alone, not the assignee with it: the pipeline's own
|
|
403
|
-
*
|
|
415
|
+
* claim writes both, but a human who took a Ticket may have written only the
|
|
404
416
|
* label, and either way there is somebody on it.
|
|
405
417
|
*/
|
|
406
418
|
async function buriedOn(routing: NoteRouting, ticket: number): Promise<string | undefined> {
|
package/src/operator-skill.ts
CHANGED
|
@@ -11,8 +11,8 @@ import { readFileSync } from "node:fs";
|
|
|
11
11
|
* Its text is a shape like every other the pipeline writes, so it lives with
|
|
12
12
|
* them in `docs/templates/`, and it is read from there rather than copied into
|
|
13
13
|
* this module: the package carries that one file for this. The text names no
|
|
14
|
-
*
|
|
15
|
-
* mark, so a Target is never rewritten for a
|
|
14
|
+
* version. The Operator reads the one to install off the conventions document's
|
|
15
|
+
* mark, so a Target is never rewritten for a version that changed nothing here.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
/** Where the skill goes in a Target, relative to the Target's root. */
|