Repository navigation
feat: nemar admin pr-reviews start - #1706
Conversation
The Worker reviews on events, and a pull request that was open before the review was switched on produced none. POST /admin/pr-reviews/:dataset/:pr/start reads the pull request from GitHub itself, shapes it as the delivery it would have been and runs it through the one gate, so the flag, the dedupe, the pause and the platform pool apply. An administrator's start lifts the per-contributor allowances for that review and restarts a commit whose review ended declined, errored or never reported. A redelivery of a failed dispatch is now held to the pause and the allowances too (ranked as the newest row), which closes the gap recorded in ADR 0092.
Review a pull request that was already open when the review was switched on, one by name or all of them (--all, --dry-run, --yes). It lists the open pull requests with no review of their current commit, leaves drafts out, lists a paused contributor's apart, asks before spending, and starts them one at a time, stopping when the daily pool is spent. ADR 0092 and 0093 record it.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR1706Version: 🤖 Updated on each push. |
Review recordFour reviewers read this change before it was opened (code review, silent failures, comment accuracy, test mutation). Their findings were checked against the code. What each led to: Fixed, with a test that fails without the fix
Test-mutation review. About 100 one-line mutants against the two new suites; 41 and 18 killed at first. The ones that survived and mattered now have tests, and I re-ran those mutants: a redelivery restarting a decline or an unreported review, a restart keeping Not changed, and why
Verification on this head: typecheck and Biome clean on the changed files; Generated by Claude Code |
What this is
The automated review of dataset pull requests reacts to events. A pull request that was open before the review was switched on produced none, so it would sit unreviewed until its author pushed again.
nemar admin pr-reviews startgives an administrator a way to review those, one by name or all at once, and to start again a commit whose review ended without a verdict. It is the follow-up promised in ADR 0092 ("a re-run command belongs with the admin follow-up").How it works
POST /admin/pr-reviews/:dataset/:pr/startreads the pull request from GitHub with the datasets token (nothing about it comes from the caller), shapes it as thepull_requestdelivery it would have been, and hands it to the one gate every delivery goes through. So the flag, the "public, named, first-published" test, the per-commit dedupe, the contributor pause and the platform's daily pool all apply. Two things differ, both the administrator's choice made by name:start --alllists the open pull requests with no review of their current commit (not_reviewedandcould_not_decide), leaves drafts out, asks before spending (each one is a model call), starts them one at a time, and stops with exit 1 when the daily pool is spent.--dry-runlists and starts nothing.--jsonis one document.What the review of this change changed
Four reviewers read it (code review, silent failures, comment accuracy, test mutation); every finding below was checked and has a test that fails without the fix.
0095_pr_review_attempts.sqladdspr_reviews.attempts(1 for every existing row), the pool sums it, and a restart of an attempt that had already spent a call adds one when it is handed to GitHub. A decline, a stale head and a dispatch GitHub never ran spent none.id <= ?, so an old row's id would have counted it ahead of every later row.dispatchedrow is restartable. The queue reports it ascould_not_decide(the production watchdog would close it asunreported, and dev has no watchdog), so--alllisted it and thenstartrefused it as a duplicate.--dry-runon a single start, and exits 1 when GitHub refused a dispatch.Tests
Real SQLite behind the real admin router and auth middleware, and the real CLI binary; GitHub is a
Bun.serve()stand-in. After the review, about 100 one-line mutants were run against the two new suites; the survivors that mattered (a redelivery restarting a decline, a restart keepingclaimed_at,--dry-runignored with--yes, a refused dispatch not being a fault, the concurrency guard, the daily allowance, the tally-based pause, route validation) now have tests, and I re-ran the mutants against them: all are killed. The documentation (ADR 0092 and 0093 amendments, CHANGELOG) is written to match.Not in this change
backend/wrangler-sccn.toml, so that is a release, after the dev trial has passed.run-pr-review.ymlis not yet innemarDatasets/.github; this session cannot write there.🤖 Generated with Claude Code
https://claude.ai/code/session_01XpB5Wz7WvF2AZNfqYZLoRR
Generated by Claude Code