Hand deploy findings to devops instead of the developer.
Rubric R13 makes CI, Dockerfile, compose and manifest findings devops-owned; the Hub tags hub.json devops users once when such findings appear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -158,6 +158,65 @@ test('labelled MR is reviewed once, a new commit updates the same comment in the
|
||||
assert.match(note, /new_commit: go di bbbb2222/);
|
||||
});
|
||||
|
||||
const deployFinding = (kind: 'bad' | 'todo' | 'ok'): Checked => ({
|
||||
verdict: kind === 'bad' ? 'no_go' : 'go',
|
||||
reason: 'urutan deploy',
|
||||
findings: [{ kind, text: 'API naik sebelum migrasi', evidence: [{ type: 'file', path: '.gitlab-ci.yml', line: 118, job_id: null, rule_id: null, label: '.gitlab-ci.yml:118', url: 'https://x' }] }],
|
||||
postDeploy: [],
|
||||
dropped: [],
|
||||
overrides: [],
|
||||
});
|
||||
const codeFinding: Checked = {
|
||||
verdict: 'go',
|
||||
reason: 'aman',
|
||||
findings: [{ kind: 'todo', text: 'tambah test', evidence: [{ type: 'rubric', path: null, line: null, job_id: null, rule_id: 'R8', label: 'rubric R8', url: 'file:///r#r8' }] }],
|
||||
postDeploy: [],
|
||||
dropped: [],
|
||||
overrides: [],
|
||||
};
|
||||
|
||||
test('deploy findings tag devops once; code findings and ok checks do not', async () => {
|
||||
const w = world({ devops: { users: ['ops1', 'ops2'] } });
|
||||
w.gl.mrs.set(8, { sha: 'a1', state: 'opened', labels: ['labuh'] });
|
||||
w.script(ok(deployFinding('bad')), ok(deployFinding('todo')), ok(codeFinding), ok(deployFinding('ok')), ok(deployFinding('todo')));
|
||||
const step = async (sha: string) => {
|
||||
w.gl.mrs.get(8)!.sha = sha;
|
||||
await w.hub.poll();
|
||||
await w.hub.drain();
|
||||
const out = w.store.outbox(w.store.ajuan(PROJECT, 8)!.id);
|
||||
return { verdict: out.find((o) => o.kind === 'verdict')!.body, replies: out.filter((o) => o.kind === 'reply').map((o) => o.body) };
|
||||
};
|
||||
|
||||
let r = await step('a1');
|
||||
assert.match(r.verdict, /Untuk devops @ops1 @ops2/, 'a bad finding on a CI file tags devops in the new verdict note');
|
||||
r = await step('a2');
|
||||
assert.match(r.verdict, /Untuk devops/);
|
||||
assert.doesNotMatch(r.replies[0], /@ops1/, 'still a deploy finding: devops is not tagged again');
|
||||
r = await step('a3');
|
||||
assert.doesNotMatch(r.verdict, /Untuk devops/, 'a code-only todo leaves devops out');
|
||||
r = await step('a4');
|
||||
assert.doesNotMatch(r.verdict, /Untuk devops/, 'an ok check on a CI file is not a deploy finding');
|
||||
r = await step('a5');
|
||||
assert.match(r.replies.at(-1)!, /Untuk devops @ops1 @ops2/, 'a deploy finding that comes back tags devops in the re-review note');
|
||||
});
|
||||
|
||||
test('a rubric R13 citation tags devops; without devops users nothing is added', async () => {
|
||||
const r13: Checked = { ...codeFinding, findings: [{ ...codeFinding.findings[0], evidence: [{ ...codeFinding.findings[0].evidence[0], rule_id: 'R13', label: 'rubric R13' }] }] };
|
||||
const w = world({ devops: { users: ['ops1'] } });
|
||||
w.gl.mrs.set(9, { sha: 'b1', state: 'opened', labels: ['labuh'] });
|
||||
w.script(ok(r13));
|
||||
await w.hub.poll();
|
||||
await w.hub.drain();
|
||||
assert.match(w.store.outbox(w.store.ajuan(PROJECT, 9)!.id).find((o) => o.kind === 'verdict')!.body, /Untuk devops @ops1/);
|
||||
|
||||
const plain = world();
|
||||
plain.gl.mrs.set(9, { sha: 'b1', state: 'opened', labels: ['labuh'] });
|
||||
plain.script(ok(deployFinding('bad')));
|
||||
await plain.hub.poll();
|
||||
await plain.hub.drain();
|
||||
assert.doesNotMatch(plain.store.outbox(plain.store.ajuan(PROJECT, 9)!.id).find((o) => o.kind === 'verdict')!.body, /devops/);
|
||||
});
|
||||
|
||||
test('mentions are answered in the thread without changing the verdict; own notes are ignored', async () => {
|
||||
const w = world();
|
||||
w.gl.mrs.set(6, { sha: 'cccc3333', state: 'opened', labels: ['labuh'] });
|
||||
|
||||
Reference in New Issue
Block a user