@fullstackhouse/cerber 1.4.1-pr.86.5003531 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/dist/core/artifact.js +0 -5
- package/dist/core/refresh.js +4 -25
- package/dist/core/revise.js +0 -3
- package/dist/runner/review.js +7 -11
- package/dist/server/index.js +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -437,13 +437,14 @@ The AI's summary and verdict still describe the commit that was reviewed. To
|
|
|
437
437
|
get its opinion of the new code, hit **Re-review at the new head** in the
|
|
438
438
|
cockpit (or `cerber review <pr> --force`).
|
|
439
439
|
|
|
440
|
-
> **A re-review replaces the
|
|
441
|
-
>
|
|
442
|
-
>
|
|
443
|
-
> ([`docs/lifecycle.md`](docs/lifecycle.md))
|
|
444
|
-
>
|
|
445
|
-
>
|
|
446
|
-
>
|
|
440
|
+
> ⚠️ **A re-review replaces the whole draft — including comments you wrote or
|
|
441
|
+
> rewrote, and a send body you wrote yourself.** They are dropped when the run
|
|
442
|
+
> starts and they do not come back, on success or on failure. This is a
|
|
443
|
+
> decision, not a bug ([`docs/lifecycle.md`](docs/lifecycle.md)): the run owns
|
|
444
|
+
> the draft. If you have written comments you want to keep, send the review or
|
|
445
|
+
> copy them out first. Your *decisions* do survive — a `reviewed` or `skipped`
|
|
446
|
+
> you set and the chat transcript are kept, and a send is kept as a record of
|
|
447
|
+
> what went to GitHub (see the next section).
|
|
447
448
|
|
|
448
449
|
### Re-reviewing one you already sent
|
|
449
450
|
|
package/dist/core/artifact.js
CHANGED
|
@@ -90,11 +90,6 @@ export const CommentSchema = z.object({
|
|
|
90
90
|
drifted: z.boolean().default(false),
|
|
91
91
|
/** Somebody else already raised this on the PR. AI comments only. */
|
|
92
92
|
alreadyRaised: AlreadyRaisedSchema.nullable().default(null),
|
|
93
|
-
/**
|
|
94
|
-
* Added or rewritten through the chat. That was the user's call, not the
|
|
95
|
-
* run's, so a re-review carries it over like their own (`carryYours`).
|
|
96
|
-
*/
|
|
97
|
-
fromChat: z.boolean().default(false),
|
|
98
93
|
});
|
|
99
94
|
/**
|
|
100
95
|
* The last comparison of the draft against what others already said on the PR.
|
package/dist/core/refresh.js
CHANGED
|
@@ -33,26 +33,6 @@ export function refreshArtifact(artifact, pr, diff) {
|
|
|
33
33
|
results,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* A comment that is the user's call rather than the run's: one they wrote, one
|
|
38
|
-
* they rewrote, or one they had the chat add or rewrite.
|
|
39
|
-
*/
|
|
40
|
-
export function isYours(c) {
|
|
41
|
-
return c.origin === "user" || c.editedByUser || c.fromChat;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* The user's comments, pulled from the diff they were written on onto the one a
|
|
45
|
-
* re-review is reading.
|
|
46
|
-
*
|
|
47
|
-
* A re-review replaces the AI's findings, not the user's. A push from the
|
|
48
|
-
* author is no reason to lose a comment they wrote or a finding they argued
|
|
49
|
-
* into shape in the chat — and the old conversation would go on naming it
|
|
50
|
-
* as though it were still there. Anchored by line text like a refresh; one
|
|
51
|
-
* whose code is gone is marked drifted and posts in the body.
|
|
52
|
-
*/
|
|
53
|
-
export function carryYours(comments, fromDiff, toDiff) {
|
|
54
|
-
return reanchorComments(comments.filter(isYours), fromDiff, toDiff).comments;
|
|
55
|
-
}
|
|
56
36
|
/**
|
|
57
37
|
* Is this artifact's status the user's to keep, rather than the run's to set?
|
|
58
38
|
*
|
|
@@ -86,8 +66,10 @@ export function supersede(a) {
|
|
|
86
66
|
* `mergeConcurrentEdits` exists to stop a chat turn making.
|
|
87
67
|
*
|
|
88
68
|
* `fresh` is what the run produced; `current` is what is on disk now. The run
|
|
89
|
-
* owns the draft — summary, chapters, verdict,
|
|
90
|
-
*
|
|
69
|
+
* owns the draft — summary, chapters, verdict, comments — and that includes
|
|
70
|
+
* replacing comments the user wrote: a re-review starts fresh by design, and
|
|
71
|
+
* `docs/lifecycle.md` says so plainly rather than leaving anyone to count on
|
|
72
|
+
* work surviving one. What it does *not* own are the decisions:
|
|
91
73
|
*
|
|
92
74
|
* - **a send** stands, and takes the status with it. Without this a run
|
|
93
75
|
* finishing after a send wrote `sent: null` back over the record, and the
|
|
@@ -97,13 +79,10 @@ export function supersede(a) {
|
|
|
97
79
|
* The fresh draft still lands underneath, which is what the row shows if
|
|
98
80
|
* the user changes their mind.
|
|
99
81
|
* - **the conversation** is the user's writing, snapshot and all.
|
|
100
|
-
* - **the user's comments** (`carryYours`), read from disk so one written
|
|
101
|
-
* while the run worked is kept too, and put ahead of the run's own.
|
|
102
82
|
*/
|
|
103
83
|
export function mergeRunResult(fresh, current) {
|
|
104
84
|
return {
|
|
105
85
|
...fresh,
|
|
106
|
-
comments: [...carryYours(current.comments, current.diff, fresh.diff), ...fresh.comments],
|
|
107
86
|
status: userOwnsStatus(current) ? current.status : fresh.status,
|
|
108
87
|
// Travels with the status it dates. A settle that landed while the run
|
|
109
88
|
// worked keeps both halves of itself, and a run that reopens the row takes
|
package/dist/core/revise.js
CHANGED
|
@@ -152,8 +152,6 @@ export function applyRevisions(artifact, revisions, opts = {}) {
|
|
|
152
152
|
...rewriteFinding(c, revision.body),
|
|
153
153
|
// Omitted = the turn is not re-grading; null = "not a finding".
|
|
154
154
|
severity: revision.severity === undefined ? c.severity : revision.severity,
|
|
155
|
-
// The user's call now, so a re-review keeps it.
|
|
156
|
-
fromChat: true,
|
|
157
155
|
}
|
|
158
156
|
: c),
|
|
159
157
|
};
|
|
@@ -196,7 +194,6 @@ export function applyRevisions(artifact, revisions, opts = {}) {
|
|
|
196
194
|
originalLine: null,
|
|
197
195
|
drifted: false,
|
|
198
196
|
alreadyRaised: null,
|
|
199
|
-
fromChat: true,
|
|
200
197
|
},
|
|
201
198
|
],
|
|
202
199
|
};
|
package/dist/runner/review.js
CHANGED
|
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { AiReviewSchema, SCHEMA_VERSION, artifactId, artifactKey, } from "../core/artifact.js";
|
|
3
3
|
import { createRunDir, evictOldCheckouts, prepareCheckout, removeRunDir } from "../core/checkout.js";
|
|
4
4
|
import { fetchPrDiff, fetchPrInfo, isOrgMember, isTeamMember } from "../core/gh.js";
|
|
5
|
-
import {
|
|
5
|
+
import { mergeRunResult, supersede, userOwnsStatus } from "../core/refresh.js";
|
|
6
6
|
import { loadArtifact, noteHistory, saveArtifact, updateArtifactByKey } from "../core/state.js";
|
|
7
7
|
import { withWriter } from "../core/history.js";
|
|
8
8
|
import { loadConfig } from "../core/config.js";
|
|
@@ -146,14 +146,13 @@ async function performReview(ref, pr, existing, opts, log) {
|
|
|
146
146
|
`reviewing from the diff alone.`);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
// A re-review regenerates the
|
|
150
|
-
//
|
|
151
|
-
//
|
|
149
|
+
// A re-review regenerates the draft, comments and all — deliberately, and
|
|
150
|
+
// including any the user wrote. Carrying them across is a feature this tool
|
|
151
|
+
// has decided not to have, so nothing here tries to half-keep them: they go
|
|
152
|
+
// when the run starts, whichever way it ends. `docs/lifecycle.md` says so
|
|
153
|
+
// where a reader would otherwise assume otherwise.
|
|
152
154
|
if (existing && existing.comments.length > 0) {
|
|
153
|
-
|
|
154
|
-
const theirs = existing.comments.length - yours;
|
|
155
|
-
log(`Replacing the previous draft's ${theirs} AI comment(s)` +
|
|
156
|
-
(yours > 0 ? `, keeping your ${yours}.` : "."));
|
|
155
|
+
log(`Replacing the previous draft's ${existing.comments.length} comment(s) — a re-review starts fresh.`);
|
|
157
156
|
}
|
|
158
157
|
let artifact = {
|
|
159
158
|
schemaVersion: SCHEMA_VERSION,
|
|
@@ -243,8 +242,6 @@ async function performReview(ref, pr, existing, opts, log) {
|
|
|
243
242
|
...artifact,
|
|
244
243
|
notified: current.notified,
|
|
245
244
|
viewed: current.viewed,
|
|
246
|
-
// Yours stay through the run, its failure included; the AI's go.
|
|
247
|
-
comments: carryYours(current.comments, current.diff, artifact.diff),
|
|
248
245
|
priorSends: supersede(current),
|
|
249
246
|
calibration: current.calibration,
|
|
250
247
|
});
|
|
@@ -290,7 +287,6 @@ async function performReview(ref, pr, existing, opts, log) {
|
|
|
290
287
|
originalLine: null,
|
|
291
288
|
drifted: false,
|
|
292
289
|
alreadyRaised: null,
|
|
293
|
-
fromChat: false,
|
|
294
290
|
})),
|
|
295
291
|
verdict: review.ai.verdict,
|
|
296
292
|
run: {
|
package/dist/server/index.js
CHANGED
package/package.json
CHANGED