@preventive/triage 1.0.0-alpha.76 → 1.0.0-alpha.77
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/common/code-language.js +3 -2
- package/out/activity.js +1 -1
- package/out/{chunk-MFAB7P3T.js → chunk-5DWOFBKS.js} +1 -1
- package/out/{chunk-O6FA2R5G.js → chunk-EMNIV37E.js} +1 -1
- package/out/{chunk-W5PRH5D7.js → chunk-G6YPDPW7.js} +1 -1
- package/out/{chunk-24LZZYAP.js → chunk-N7TD27UJ.js} +1 -1
- package/out/{chunk-62QT2RXR.js → chunk-OWIBDEJJ.js} +1 -1
- package/out/{chunk-HLMQ7QYS.js → chunk-S5PPXPAT.js} +1 -1
- package/out/{chunk-EYTPAODY.js → chunk-SDLETN3Z.js} +1 -1
- package/out/{chunk-RHOQDAU4.js → chunk-WB3NRZL7.js} +1 -1
- package/out/{chunk-UZC7POI4.js → chunk-Z6DL5PPO.js} +2 -2
- package/out/client-managed.js +1 -1
- package/out/compare.js +11 -11
- package/out/dialogs.js +1 -1
- package/out/index.html +4 -4
- package/out/prism.js +1 -1
- package/out/scan.js +1 -1
- package/out/view.js +1 -1
- package/package.json +2 -2
- package/server-managed/dependency-review-comments.ts +35 -27
- package/server-managed/pretty-print.ts +1 -1
- package/server-managed/pull-dependency-reviews.ts +23 -12
|
@@ -106,28 +106,39 @@ export function reviewsOf(pkg: LockedPackage, reviews: ReviewsOf): PublishedRevi
|
|
|
106
106
|
export const comparedWith = (review: PublishedReview, pkg: LockedPackage, bases: string[] | 'any') => review.basePackage === null
|
|
107
107
|
|| review.basePackage !== pkg.name || bases === 'any' || bases.includes(review.baseVersion ?? '')
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
// The latest of `reviews`, some, the first of those as late.
|
|
110
|
+
export const latestOf = (reviews: PublishedReview[]) => reviews.reduce((one, other) => other.time > one.time ? other : one)
|
|
111
|
+
// What a review compares its version with, as one continued from it in a new
|
|
112
|
+
// review does too: none (whole), or a package's version; one a pull
|
|
113
|
+
// request's comments make, which revises no review here, of its comments.
|
|
114
|
+
const comparisonOf = (review: PublishedReview) => review.comment ? '\0comment' : review.basePackage === null ? '' : `${review.basePackage}@${review.baseVersion ?? ''}`
|
|
115
|
+
|
|
116
|
+
export const ACCEPTING = new Set(['accept', 'accept-with-nits'])
|
|
110
117
|
// Where `pkg`'s reviewers stand on it among `reviews`, those of its version,
|
|
111
118
|
// of an integrity it is locked with, and of its patch: each one's latest
|
|
112
|
-
// telling it, any rejecting it holding it
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
119
|
+
// telling it, whatever it was compared with, any rejecting it holding it
|
|
120
|
+
// unreviewed (`rejected`), any not accepting it holding each of theirs
|
|
121
|
+
// before it; those accepting it passing it (`passing`), each once, by a
|
|
122
|
+
// full, accepting review of theirs, the latest of its comparison, which
|
|
123
|
+
// revises those of it before, whole, compared with another package's
|
|
124
|
+
// version, or compared with one of `bases` of its own (any, for `any`); and
|
|
125
|
+
// how many review it in its pull request's comments alone (`commented`),
|
|
126
|
+
// which count for it alone: whose reviews passing it, else whose latest, are
|
|
127
|
+
// its comments'. Each reviewer too (`reviewers`), by their login, their
|
|
128
|
+
// latest verdict, whether they pass it, and whether that verdict is its
|
|
129
|
+
// comments' (`comment`), which counts for it alone.
|
|
120
130
|
function stancesOf(pkg: LockedPackage, reviews: ReviewsOf, bases: string[] | 'any') {
|
|
121
131
|
const by = Map.groupBy(reviewsOf(pkg, reviews), review => review.reviewer)
|
|
122
132
|
const qualifies = (review: PublishedReview) => review.full && ACCEPTING.has(review.status) && comparedWith(review, pkg, bases)
|
|
123
133
|
let commented = 0, passing = 0, rejected = false
|
|
124
134
|
const reviewers: Reviewer[] = []
|
|
125
135
|
for (const theirs of by.values()) {
|
|
126
|
-
const latest = theirs
|
|
127
|
-
const
|
|
136
|
+
const latest = latestOf(theirs)
|
|
137
|
+
const current = [...Map.groupBy(theirs, comparisonOf).values()].map(latestOf).filter(qualifies)
|
|
138
|
+
const passes = ACCEPTING.has(latest.status) && current.length > 0
|
|
128
139
|
// In its comments alone where those telling where they stand are: those
|
|
129
140
|
// passing it, where they pass it, else their latest.
|
|
130
|
-
const comment = (passes ?
|
|
141
|
+
const comment = (passes ? current : [latest]).every(review => review.comment)
|
|
131
142
|
if (comment) commented++
|
|
132
143
|
if (latest.status === 'reject') rejected = true
|
|
133
144
|
else if (passes) passing++
|