Skip to content

skills: add /pr-review, the house-invariant diff review - #777

Merged
github-actions[bot] merged 1 commit into
mainfrom
skill/pr-review
Nov 7, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
skill/pr-review

Conversation

@athvin

@athvin athvin commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Adds /pr-review: the pre-merge diff review for the four invariants make check
cannot judge, plus two tool-restricted subagents and a generated exclusion
backbone.

Why these four, and why a review rather than a gate

The brief was "enforce observability, declared SQL, correct work routing, and
reuse". Probing what the gates already hold turned most of that into already
enforced
, which is the finding that shaped the skill:

  • span_boundaries.rs, structured_logging.rs, collector_allowlist.rs,
    cardinality.rs and no_pii_in_exported_spans.rs already fail the build on a
    bare spawn_blocking, an eprintln! in er-server, an unallowlisted span
    attribute, a forbidden metric dimension, and PII on the wire.
  • freeform_sql.rs and declared_names.rs close the lake half of SQL
    governance completely; er-entity verify owns E0xx and the V-rules.
  • control_tasks_no_engine.rs and dispatch_coverage.rs hold the structural
    half of routing.

A reviewer enforcing any of those is re-reporting a red test — noise that
arrives with evidence, which is worse than silence because it teaches the author
to skim the next report. So the skill reviews the un-gated residue, verified
by grep rather than assumed:

Dimension What no gate catches
instrumentation the absence of a span on new work; span.record on a field the callsite never declared (a silent no-op); a process::exit path with no force_flush; a new metric whose declared series product is simply wrong
declared SQL Postgres statements assembled inline — the lake equivalent is gated, this is not; a closed-set column with no accepted_values, which a later CHECK can never land on a live table; two writes that must share one transaction(); Catalog::load_dir where load_linted is required
tier the direction of the choice. §3.5's rule is "a body that needs a lake open is a pod task", and the deciding question is the writer lock, not latency — a lake write cannot happen in a request at any speed, which is why steward actions stage to Postgres and drain in apply_corrections
reuse a copy of a helper that drops an invariant: errfmt::chain vs to_string(), generated er_entities:: vs an inline string, common::fresh_db vs a hand-rolled drop list

Shape

  • SKILL.md, 162 lines, disable-model-invocation: true — a review is something
    a human starts, and it can post to GitHub.
  • Six references, one level deep, each with a ## Contents.
  • .claude/agents/pr-reviewer.md and pr-verifier.md, read-only, so the
    producer never grades its own finding
    is structural rather than advised —
    the same mechanism /pentest uses for security-verifier.
  • evals.md with six scenarios. Three check that it fires and reports the right
    thing; three check that it stays out of the way of /code-review,
    observability and land-pr.

The generated part

not-a-finding.md is the largest file by design — the open-source review prompts
converge on that ratio. Its backbone is a new review-gates generator: every
rust/crates/*/tests/*.rs that reads .rs source with read_to_string and
asserts is_empty(), each row carrying the first sentence of its own module doc
as the claim, plus whether a tier variable makes it self-skip in make check.

Twelve rows today. Nobody maintains the list, so nobody can forget it. Two
narrowings came from watching it produce nonsense first: the wider "module doc
says gate" scan returns every golden tier (a reviewer told golden_em.rs is a
gate learns nothing), and cutting the claim at a bare period produced rows
reading any qualified \lake.` — a table that looks maintained and says nothing.

Three deviations from the brief

  1. No REVIEW.md. It would be a fourth rule location nothing gates, beside
    CLAUDE.md, the skills and the gates themselves. The base-branch property —
    a PR cannot loosen the rules it is judged by — comes from reading the
    references at $BASE instead.
  2. No supersession of the bundled /code-review. It is complementary, not
    wrong here, so an override entry would tell a session to discard claims that
    are fine. Routed in prose; the override registry is untouched.
  3. No Terraform / Next.js / DuckDB-on-Kubernetes checklists.
    infra-platform, frontend-bff and ducklake-lakehouse own those, and a
    second copy is the drift the standard exists to prevent.

Routing, both ways

land-pr, security and rust-conventions each name pr-review back.
security and rust-conventions had their what clauses trimmed to pay for
it rather than dropping the routing, per the standard's documented fix — both
now sit with more headroom than the median routing clause needs.

Gates

make skills-check, scripts-home-check and workflow-shell-check all green,
tree clean.

Both halves of the new gate were observed failing, from a source mutation
rather than a hand-edited block, since the standard notes a hand-edit proves
nothing:

  • A decoy source-scanning test under er-schema/tests/ → check exits 1,
    naming the stale reference and showing the exact row it would have added.
  • The review-gates row removed from the standard's generator table →
    generators exits 1 with
    `review-gates` is wired into run_regen but absent from the generator table.

Both reverted clean.

Not covered by any gate here

Whether the model picks this skill at runtime. That needs the eval scenarios
posed in a fresh session by hand — scenario 1 (does it stay silent on a bare
spawn_blocking?) and 4–6 (does it decline in favour of the right neighbour?)
are the ones worth running before trusting it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MFnHDWdSvJoDtZLCg5dyyv

Four questions `make check` cannot answer, because each is a judgment about
code that compiles and passes every test: whether a new path owes a span or a
metric, whether a statement should have been a declared entity pair, whether
the work landed in the right execution tier, and whether it re-rolled a helper
that carries an invariant.

The pipeline is the part that keeps it usable — one read-only reviewer per
dimension in fresh context, a separate verifier scoring every finding against a
verbatim rubric, and a hard cutoff. Both subagents are tool-restricted, so
"the producer never grades its own finding" is structural rather than advised.

Most of the skill is the exclusion list, which is the ratio the open-source
review prompts converge on. Its backbone is generated: `review-gates` derives
every test that scans this workspace's own Rust source and asserts the offender
list is empty, so the "already a red test, do not report it" inventory cannot
drift from the tests. A bare `spawn_blocking`, an `eprintln!` in `er-server` and
an undeclared `lake.main.*` relation are each a build failure, and reporting one
is worse than silence — it is noise that arrives with evidence.

Routing added both ways: `land-pr`, `security` and `rust-conventions` each name
it back. `security`'s "what" clause was trimmed to pay for its clause rather
than drop it, per the standard.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin athvin added the merge-bus eligible for the merge bus label Nov 7, 2026
@github-actions github-actions Bot mentioned this pull request Nov 7, 2026
@github-actions
github-actions Bot merged commit ea83396 into main Nov 7, 2026
41 checks passed
@github-actions
github-actions Bot deleted the skill/pr-review branch November 7, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-bus eligible for the merge bus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants