mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
Remove the ai-assisted label when an edit drops the disclosure line
Keeps the label a deterministic mirror of the body's disclosure state, per Greptile's P2 review finding on #518. AI-assisted: written with an AI agent under maintainer direction. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -181,6 +181,7 @@ export function evaluateIssue(issue, options = {}) {
|
||||
const plan = { ...base, verdict, reasons };
|
||||
plan.aiAssisted = AI_DISCLOSURE.test(body);
|
||||
if (plan.aiAssisted && !labels.has(AI_LABEL)) plan.labelsToAdd.push(AI_LABEL);
|
||||
if (!plan.aiAssisted && labels.has(AI_LABEL)) plan.labelsToRemove.push(AI_LABEL);
|
||||
|
||||
if (verdict === 'pass') {
|
||||
if (labels.has(GATE_LABEL)) plan.labelsToRemove.push(GATE_LABEL);
|
||||
|
||||
@@ -222,6 +222,15 @@ describe('issue body gate', () => {
|
||||
assert.deepEqual(plan.labelsToAdd, [AI_LABEL]);
|
||||
});
|
||||
|
||||
it('removes the AI label when an edit drops the disclosure line', () => {
|
||||
const plan = evaluateIssue(issue({
|
||||
labels: [AI_LABEL],
|
||||
}), { templates });
|
||||
assert.equal(plan.verdict, 'pass');
|
||||
assert.equal(plan.aiAssisted, false);
|
||||
assert.deepEqual(plan.labelsToRemove, [AI_LABEL]);
|
||||
});
|
||||
|
||||
it('exempts maintainers and repo members', () => {
|
||||
const maintainer = evaluateIssue(issue({ authorLogin: 'pbakaus', body: 'quick note' }), { templates });
|
||||
assert.equal(maintainer.exempt, true);
|
||||
|
||||
Reference in New Issue
Block a user