Skip to content

gardener: review-tiers check, judgment as a model draft (#1064) - #1071

Open
scuttletoby wants to merge 3 commits into
mainfrom
gardener-review-tiers
Open

scuttletoby wants to merge 3 commits into
mainfrom
gardener-review-tiers

Conversation

@scuttletoby

@scuttletoby scuttletoby commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Phase 2 of #1064 (phase 1: #1068).

What

  • New general check review-tiers (fork-kit/gardener/checks/review-tiers): merged pull requests that had less review than their tier asks for.
    • Tiers come from options: rules (globs), a registry file in the repository (rows of paths with a tier), unmatched, and per tier requires (minLenses, named lens regexes with counts). Without tiers it judges by the merge gate's own review block.
    • Lens comments are read by the gate's own code (fork-ci/actions/pr-queue: config, lens, review_config, review_glob, review_judge), imported and not copied. The installer copies them into the release as gate/. A comment counts exactly when the gate would take it as a lens, and only if posted before the merge by the queue config's lens authors.
    • A valid override comment before the merge settles a pull request. So does a counted author's comment whose first line starts with one of waivers.
    • exemptLabels and exemptAuthors skip pull requests.
    • GitHub budget: one free rate_limit read and one paged GraphQL search per run. Below minRemaining (1000) it does not search and judges from the cache.
    • The cache keeps facts only (paths, lens names, no comment text), so the next run searches only pull requests updated since the day before.
  • Contract v1 gains cacheDir (a private per-check folder in the state folder) and dryRun. Both are additive; checks read them with .get().
  • Report:
    • A #N where is shown; when the report goes to another repository it is written OWNER/REPO#N, so it never links to the wrong #N.
    • Well-known token shapes (ghp_, github_pat_, sk-, xoxb-, AKIA, private key blocks) are masked in check text and in the judgment.
  • Judgment:
    • Shown as "Judgment (model draft)" with a line saying nobody checked it. It passes the same publish filter as check text and is dropped in counts-only.
    • timeoutSeconds now bounds the whole answer, so a server that trickles bytes is cut off. Before, it bounded only each socket read.
    • No paid fallback, on purpose; the README and docstring explain why.

State question (runs again, stops half-way, old/empty state)

  • Runs again the same day: it searches only updated:>= the day before the last full search. Merged pull requests already in the cache are still judged.
  • Next day: the same incremental search. Pull requests that left the window are pruned from the cache.
  • Stops half-way (a GitHub error on page 2): the check fails and the cache file is byte-for-byte unchanged, with no temporary file left. A partial search (maxPages, or the budget falling) keeps the old search day, so the next run searches those days again.
  • Old, broken or empty state: these all read as empty and the whole window is searched: an empty file, not JSON, a list, no version, an older version, entries without the new keys, another repository or queue config, a search day in the future.
  • Newer state (a downgraded kit): not used and not overwritten.
  • Dry run: reads the cache and writes nothing.
  • Model endpoint: down, silent (accepts and says nothing), trickling (slow), junk (not HTTP), errors, empty answer. Each is a note and the run goes on.

Calibration (dry runs on two real repositories)

  • This fork (gate review block, 7 days): about 3 GraphQL points for 8 pages. Many merged PRs have no lens comments at all, so they are listed. These findings are real (for example fork-kit: gardener kit, a daily report issue per project (#1064, phase 1) #1068).
  • A second, private project (its own tiers): about 50 findings, most of them PRs with no lens comment.
  • Both hit maxPages 8, so a busy project should set maxPages to about 20.

Tests

fork-kit/gardener/tests passes, and RedCheck covers the new rules (10 mutations in checks, 2 in report):

File Tests New
checks 52 20 ReviewTiers; 1 Worktrees (a branch named like a tag or remote)
report 34 4
run 38 context incl. cacheDir/dryRun
install 10 gate/ copied, installed review-tiers runs

Also run: fork-kit/common/tests/machine_file.test.py 27 OK, fork-ci/actions/pr-queue/review_judge.test.py 57 OK, .github/scripts/fork-ci-release.test.py 98 OK, fork-kit/common/tests/kit_install.test.py 189 OK, and the seam check (clean).

Two fixes found on the way: the kit tests' fixture now copies the kit in the fork's layout (the installer reads gate/ from fork-ci/actions/pr-queue), and the worktrees check reads branches with refname:lstrip=2, because refname:short prints heads/<name> when a tag or remote has the same name and the check then crashed.

General vs project

  • General (this PR): the check, its tier model (rules, registry, required lens counts, waivers, exemptions), the cache, the GitHub budget, the judgment and the report filter. No project names in code; tests use made-up names.
  • Project (adapter, not here): each project's tier table, registry file, waiver words and maxPages go in its own machine-file entry or config. The SkyRPG adapter comes in a separate PR in that repository.

🤖 Generated with Claude Code

scuttletoby and others added 3 commits November 23, 2026 21:09
- New general check review-tiers: merged pull requests that had less review
  than their tier asks for. Tiers and waiver words come from options (or the
  merge gate's own review block); lens comments are read by the gate's own
  code (fork-ci/actions/pr-queue, installed as gate/). One rate_limit read and
  one paged GraphQL search per run, cached in the check's cacheDir, so the
  next run searches only pull requests updated since the day before.
- Contract v1 gains cacheDir and dryRun (additive; read with .get()).
- Report: a "#N" where is shown (OWNER/REPO#N when the report goes to
  another repository); well-known token shapes are masked.
- Judgment: shown as "Judgment (model draft)", timeoutSeconds bounds the
  whole answer (a trickling server is cut off), no paid fallback (documented).
- Tests: verdicts, override/waiver/exempt, gate review block, budget and
  partial searches, the cache (runs again, stops half-way, old/empty/newer
  state, dry run), slow and silent model endpoints; RedCheck mutations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cluded

The installer reads the gardener's gate/ from fork-ci/actions/pr-queue two folders up from the kit; the shared
install fixture copied the kit to a folder with nothing beside it, so 7 gardener install tests failed in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…is ambiguous)

A branch named like a tag or remote printed as heads/<name> and crashed the check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant