INNER CODE UNIT · JavaScript
verifyReviewReport
rancher/terraform-provider-rancher2 · agent-scripts/after-invoke.js:75
export function verifyReviewReport(report, diffHash, planHash, reviewApprovalFile, testApprovalFile) {
const isSuccess = report.includes('PR Review status: 🟢 PERFECT - 0 findings.');
if (isSuccess) {
// Hook enforces Gate 2 must also be valid! (Review requires Tests to be passed)
if (!fs.existsSync(testApprovalFile)) {
return {
status: 'gated',
systemMessage:
'🔒 Hook Notification: Review agent completed with 0 findings, but Gate 3 (Review Gate) cannot be signed because Gate 2 (Testing Gate) is missing!',
};
}
try {
const testContent = JSON.parse(fs.readFileSync(testApprovalFile, 'utf-8'));
if (testContent.diff_hash !== diffHash || testContent.plan_hash !== planHash) {
return {
status: 'gated',