d48cda4081
CI / Test (ubuntu-latest, Node 18.x, bun) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, npm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, pnpm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, yarn) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 20.x, bun) (push) Failing after 17m13s
CI / Test (ubuntu-latest, Node 20.x, npm) (push) Failing after 18m42s
CI / Test (ubuntu-latest, Node 20.x, pnpm) (push) Failing after 15m0s
CI / Test (ubuntu-latest, Node 20.x, yarn) (push) Failing after 49m44s
CI / Test (ubuntu-latest, Node 22.x, bun) (push) Failing after 51m55s
CI / Test (ubuntu-latest, Node 22.x, pnpm) (push) Failing after 21m57s
CI / Test (ubuntu-latest, Node 22.x, npm) (push) Failing after 37m39s
CI / Test (ubuntu-latest, Node 22.x, yarn) (push) Failing after 34m7s
CI / Validate Components (push) Failing after 37m15s
CI / Python Tests (push) Failing after 10m1s
CI / Security Scan (push) Failing after 10m1s
CI / Lint (push) Failing after 17m12s
CI / Coverage (push) Failing after 20m19s
CI / Test (macos-latest, Node 18.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, yarn) (push) Has been cancelled
83 lines
2.2 KiB
JavaScript
83 lines
2.2 KiB
JavaScript
#!/usr/bin/env node
|
|
'use strict';
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const repoRoot = path.resolve(__dirname, '..', '..');
|
|
const reviewerPath = path.join(repoRoot, 'agents', 'code-reviewer.md');
|
|
|
|
const requiredHeadings = [
|
|
'## Confidence-Based Filtering',
|
|
'### Pre-Report Gate',
|
|
'### HIGH / CRITICAL Require Proof',
|
|
'### It Is Acceptable And Expected To Return Zero Findings',
|
|
'## Common False Positives - Skip These',
|
|
];
|
|
|
|
const requiredPatterns = [
|
|
/Can I cite the exact line/i,
|
|
/concrete failure mode/i,
|
|
/Have I read the surrounding context/i,
|
|
/Severity inflation/i,
|
|
/exact snippet and line number/i,
|
|
/specific failure scenario/i,
|
|
/demote to MEDIUM or drop/i,
|
|
/clean review is a valid review/i,
|
|
/Manufactured findings/i,
|
|
/Common False Positives/i,
|
|
/Consider adding error handling/i,
|
|
/Missing input validation/i,
|
|
/Magic number/i,
|
|
/Would a senior engineer on this\s+team actually change this in review/i,
|
|
/Do not withhold approval to appear rigorous/i,
|
|
];
|
|
|
|
let passed = 0;
|
|
let failed = 0;
|
|
|
|
function test(name, fn) {
|
|
try {
|
|
fn();
|
|
console.log(` PASS ${name}`);
|
|
passed++;
|
|
} catch (error) {
|
|
console.log(` FAIL ${name}`);
|
|
console.log(` Error: ${error.message}`);
|
|
failed++;
|
|
}
|
|
}
|
|
|
|
function readReviewer() {
|
|
return fs.readFileSync(reviewerPath, 'utf8');
|
|
}
|
|
|
|
console.log('\n=== Testing code-reviewer false-positive guardrails ===\n');
|
|
|
|
for (const heading of requiredHeadings) {
|
|
test(`code-reviewer.md contains heading: ${heading}`, () => {
|
|
const source = readReviewer();
|
|
assert.ok(source.includes(heading), `code-reviewer.md missing required heading "${heading}"`);
|
|
});
|
|
}
|
|
|
|
for (const pattern of requiredPatterns) {
|
|
test(`code-reviewer.md matches ${pattern}`, () => {
|
|
const source = readReviewer();
|
|
assert.ok(pattern.test(source), `code-reviewer.md missing required pattern ${pattern}`);
|
|
});
|
|
}
|
|
|
|
test('code-reviewer.md retains the >80% confidence threshold', () => {
|
|
const source = readReviewer();
|
|
assert.ok(/>\s*80%\s*confident/i.test(source), 'code-reviewer.md missing >80% confidence threshold');
|
|
});
|
|
|
|
if (failed > 0) {
|
|
console.log(`\nFailed: ${failed}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log(`\nPassed: ${passed}`);
|