Repository navigation
feat: automated review of dataset pull requests (ADR 0092) - #1682
Conversation
Closed-vocabulary report, derived verdict, check words and the contributor tally rule (ADR 0092).
The Worker takes the App's pull_request delivery, applies the contributor tally and rate caps, dispatches the central workflow, and publishes the derived verdict as a check and one comment. Off unless PR_REVIEW_ENABLED is 1 (ADR 0092).
Reads the change as git data, asks Haiku 5.5 at high effort through workload identity federation, and posts a closed-vocabulary report (ADR 0092).
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR1682Version: 🤖 Updated on each push. |
Review record (pr-review-toolkit, two rounds)Six reviewers ran on the full diff: code review, silent-failure audit, test coverage (with mutation testing on copies of the repo), type design, comment accuracy, and simplification. The first round's findings were fixed in the earlier commits on this branch; this record covers the second round, which ran on the result. Each fix has a test, and the important ones were mutation-checked (the test fails when the code is changed in the dangerous direction). Round two: what was found and what was doneFixed, security and correctness
Fixed, structure
Tests added for what the coverage review showed was unpinned
Found and accepted (also in the ADR)
VerificationTypecheck and Biome are clean on the changed files. The affected suites pass (contract, evidence and script, workflow, route inventory, ADR index, Worker flow, cron wiring). The full backend suite fails only the six manifest-canary tests that fail identically on a clean Not verifiedThe live model call, the real workload identity exchange, and a real GitHub Actions run of Generated by Claude Code |
What this does
A pull request to
mainof a dataset repository innemarDatasetsis reviewed automatically by Claude Haiku 5.5 (high effort). The result is a green or redNEMAR PR Reviewcheck plus one pull-request comment that says what changed and what the reviewer found. A human still approves and merges.The review asks three questions:
Decision record:
.context/decisions/0092-dataset-pull-requests-get-a-derived-verdict-from-a-worker-gated-model-review.md(status: proposed).How it works
pull_requestevent to the Worker, forks included. The Worker is the gate: it dedupes per commit, applies the contributor tally and rate caps, records the attempt inpr_reviews, and dispatches one central workflow,run-pr-review.ymlinnemarDatasets/.github.nemarDatasets, the only place the Anthropic identity (workload identity federation) is minted. It reads the change as git data withinitandfetch, never a checkout, so nothing from a pull request can run. A fork is read throughrefs/pull/N/headon the base repository.Behaviour the maintainer asked for
main; drafts and bot authors are skipped.passis a green check,failis a red check. Anything that is not a clear pass (uncertain, not reviewed, errored, never reported) isaction_required, which GitHub does not count as passing for a required check.neutralis deliberately unused because it does count.pr_review_overrideslets a maintainer allow or block a contributor outright.Safeguards worth reviewing
verdictOf), and facts overrule the model: no changed file cannot be an improvement, an unchanged version cannot advance the revision, a truncated list cannot certify that nothing was lost, any removed file needs a person, and a steering attempt fails the review. The parser also makes a report agree with itself in the safe direction: a finding that names a steering attempt sets the flag, and a criterion passed while a blocker is filed against it becomes unknown.curlstep.env, are validated, and are cross-checked against GitHub's own record of the PR (open, targetsmain, still athead_sha).PR_REVIEW_ENABLEDis exactly1. The watchdog is production-only and ignores the flag, so switching the review off never strands a check that is already running.Review
The change went through two rounds of the pr-review-toolkit (code review, silent-failure audit, test-coverage review with mutation testing, type design, comment accuracy, simplification). The findings and what was done with each are in the review comment below.
Verification
bun run typecheckand Biome on the changed files are clean.main()end to end, the workflow's structure and shell steps, and the Worker flow through the real routes with fault injection.Not verified
run-pr-review.ymlhas not run on GitHub. Its shell steps are executed in tests, but GitHub's behaviour is not: for example, whether Actions masks the token in step headers as designed, whether the App can create a check against a fork's head commit (the existing BIDS check does the same), and how long a GitHub OIDC token lives against a long review.Before it is switched on (also in the ADR)
nemarDatasets:ANTHROPIC_FEDERATION_RULE_ID,ANTHROPIC_ORGANIZATION_ID,ANTHROPIC_SERVICE_ACCOUNT_ID,ANTHROPIC_WORKSPACE_ID. Check the federation rule accepts onlyrepo:nemarDatasets/.github:ref:refs/heads/mainfor this workflow.run-pr-review.ymltonemarDatasets/.github/.github/workflows/, then add it to theunit-puresparse checkout withNEMAR_PR_REVIEW_WORKFLOW_LIVEso the parity test stops skipping.PR_REVIEW_ENABLED=1on the production Worker.Follow-ups
nemar admincommand to list and manage all pending pull requests in one place, and to allow or block a contributor (a separate session owns this).updated_at, so a manually redelivered older commit cannot supersede a newer one (accepted risk in the ADR).Generated by Claude Code