Nirnaya v1
← cookbooks
engineeringbring your own workflow

Pull request triage

Pick the review path straight from the diff summary.

This recipe shows the request shape and the routing logic for a workflow of your own. nirnaya is fitted to the decisions you actually make, so bring a few hundred of your own reviewed pull requests and it is tuned to them.

The questions

review_pathchoice

How should this pull request be handled?

auto_mergeSafe to merge without a human reviewer.
standard_reviewOne reviewer from the owning team.
senior_reviewNeeds a senior reviewer because of risk or scope.
request_changesSend back before review; something obvious is missing.
riskscore

How risky is merging this change?

0Trivial: docs or formatting.
1Low: isolated, well tested.
2Medium: touches shared logic.
3High: payments, auth or data migration.
needs_testsnoul

This change should not merge without new tests.

falseno, the statement does not hold
trueyes, the statement holds
description_accuratenoul

The PR description accurately reflects the size and risk of the change.

falseno, the statement does not hold
trueyes, the statement holds

Acting on the answers

  • Use it as a router, not a judge: senior_review above 0.4 assigns a senior; nothing merges on the model's say-so.

request

{
  "state": "Pull request #4821: refactors the payment retry loop, touches 14 files, adds no tests, CI green, author is a new contributor, diff is 900 lines, description says 'small cleanup'.",
  "questions": {
    "review_path": {
      "type": "choice",
      "instructions": "How should this pull request be handled?",
      "criteria": {
        "auto_merge": "Safe to merge without a human reviewer.",
        "standard_review": "One reviewer from the owning team.",
        "senior_review": "Needs a senior reviewer because of risk or scope.",
        "request_changes": "Send back before review; something obvious is missing."
      }
    },
    "risk": {
      "type": "score",
      "instructions": "How risky is merging this change?",
      "criteria": [
        "Trivial: docs or formatting.",
        "Low: isolated, well tested.",
        "Medium: touches shared logic.",
        "High: payments, auth or data migration."
      ]
    },
    "needs_tests": {
      "type": "noul",
      "instructions": "This change should not merge without new tests."
    },
    "description_accurate": {
      "type": "noul",
      "instructions": "The PR description accurately reflects the size and risk of the change."
    }
  }
}

call it

import { loadEngine } from "nirnaya";     // the same call this site makes

const engine = await loadEngine();          // loads once, then cached by the browser
const answers = await engine.decide(
  "Pull request #4821: refactors the payment retry loop, touches 14 files, adds no tests, CI green, author is a new contributor, diff is 900 lines, description says 'small cleanup'.",
  {
    "review_path": {
      "type": "choice",
      "instructions": "How should this pull request be handled?",
      "criteria": {
        "auto_merge": "Safe to merge without a human reviewer.",
        "standard_review": "One reviewer from the owning team.",
        "senior_review": "Needs a senior reviewer because of risk or scope.",
        "request_changes": "Send back before review; something obvious is missing."
      }
    },
    "risk": {
      "type": "score",
      "instructions": "How risky is merging this change?",
      "criteria": [
        "Trivial: docs or formatting.",
        "Low: isolated, well tested.",
        "Medium: touches shared logic.",
        "High: payments, auth or data migration."
      ]
    },
    "needs_tests": {
      "type": "noul",
      "instructions": "This change should not merge without new tests."
    },
    "description_accurate": {
      "type": "noul",
      "instructions": "The PR description accurately reflects the size and risk of the change."
    }
  }
);
for (const a of answers) console.log(a.qid, a.answer, a.p);

curl and Python target nirnaya_serve, the Jev-compatible server in the release; the browser snippet is exactly what this site does.