Maintainer peer-review skip marks the attempt peer_skipped so merge re-verification accepts it
This commit is contained in:
parent
0e3648a174
commit
20b67432b1
2 changed files with 2 additions and 1 deletions
|
|
@ -88,7 +88,7 @@ export class Merger {
|
||||||
const approvals = this.store.get(`SELECT COUNT(*) AS n FROM reviews WHERE attempt_id = ? AND action = 'approve'`, attemptId).n;
|
const approvals = this.store.get(`SELECT COUNT(*) AS n FROM reviews WHERE attempt_id = ? AND action = 'approve'`, attemptId).n;
|
||||||
const needed = this.requiredApprovals(attempt) - approvals;
|
const needed = this.requiredApprovals(attempt) - approvals;
|
||||||
if (hasRole(reviewer, 'maintainer') || needed <= 0) {
|
if (hasRole(reviewer, 'maintainer') || needed <= 0) {
|
||||||
this.store.run(`UPDATE attempts SET state = 'approved' WHERE id = ?`, attemptId);
|
this.store.run(`UPDATE attempts SET state = 'approved'${skipsPeers ? ', peer_skipped = 1' : ''} WHERE id = ?`, attemptId);
|
||||||
this.store.run(`UPDATE tasks SET state = 'approved', updated_at = ? WHERE id = ?`, now(), attempt.task_id);
|
this.store.run(`UPDATE tasks SET state = 'approved', updated_at = ? WHERE id = ?`, now(), attempt.task_id);
|
||||||
return { state: 'approved' };
|
return { state: 'approved' };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -932,6 +932,7 @@ test('maintainers can decide a function still in peer review; reviewers cannot',
|
||||||
assert.throws(() => ctx.merger.review(ctx.accounts.byName('pmaint'), attempt, 'approve'), /attempt is peer_review/, 'skipping peer review must be asked for');
|
assert.throws(() => ctx.merger.review(ctx.accounts.byName('pmaint'), attempt, 'approve'), /attempt is peer_review/, 'skipping peer review must be asked for');
|
||||||
assert.equal(ctx.merger.review(ctx.accounts.byName('pmaint'), attempt, 'approve', null, { skipPeerReview: true }).state, 'approved');
|
assert.equal(ctx.merger.review(ctx.accounts.byName('pmaint'), attempt, 'approve', null, { skipPeerReview: true }).state, 'approved');
|
||||||
assert.equal(ctx.store.get('SELECT state FROM tasks WHERE id = ?', task).state, 'approved');
|
assert.equal(ctx.store.get('SELECT state FROM tasks WHERE id = ?', task).state, 'approved');
|
||||||
|
assert.ok(ctx.peers.confirmed(attempt), 'the merge re-check must accept a maintainer decision without peer verdicts');
|
||||||
assert.ok(ctx.store.get(`SELECT 1 FROM events WHERE type = 'review' AND data LIKE '%skippedPeerReview%'`));
|
assert.ok(ctx.store.get(`SELECT 1 FROM events WHERE type = 'review' AND data LIKE '%skippedPeerReview%'`));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue