Skip to content

Review rules: detail (score, short or full) in .kai-review.yaml - #220

Merged
jschatz1 merged 1 commit into
mainfrom
review-rules/detail
Oct 26, 2026
Merged

jschatz1 merged 1 commit into
mainfrom
review-rules/detail

Conversation

@jschatz1

@jschatz1 jschatz1 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

This lets a repository set the review detail level from kaicontext/kai-server#527 in .kai-review.yaml:

detail: short   # score | short | full
  • rcParseRules accepts detail. The value is case-insensitive, and anything else is an error naming the three levels. Like any other broken file, an error means the review runs without the rules file.
  • The finding bundle carries it as "detail", and leaves it out when the file doesn't set one. kai-server reads it in a companion PR and prefers it to the Atlas setting.
  • The review log line now includes detail <level>.

Rollout: this needs a CLI release and a kai-ci pin before a repo's detail: line takes effect. Until then, current CLIs reject the unknown key and review without the rules file, so repos shouldn't add the line before the release.

Tests: TestParseRulesDetail covers parsing, lowercasing, rejecting bad values, unset values and the log line. The rules and review-commit tests pass, and go vet is clean.

🤖 Generated with Claude Code


Kai context

Written by Kai from the change itself. Kai only edits this section; everything above it is the author's.

This adds a detail key to .kai-review.yaml that lets a repository choose how much of the review kai-server posts on the pull request (score, short, or full), carrying the choice in the finding bundle for kai-server to read.

Changes

  • review_commit_reporules.go: adds the detail field to rcRepoRules, the rcReviewDetails list of valid levels (score, short, full), and rcActiveDetail() returning the active rules' detail or ""; rcParseRules reads detail from the YAML, lowercases and trims it, and rejects anything not in the list with an error naming the three levels; rcDescribeRules appends detail <level> to the review log line when set.
  • review_commit.go: the finding bundle struct gains a Detail string field with json:"detail,omitempty", populated from rcActiveDetail(); it is omitted from the bundle when no detail is set.
  • review_commit_reporules_test.go: adds TestParseRulesDetail covering case-insensitive parsing and lowercasing, the log line, rejection of bad values, and unset detail.

Testing

  • TestParseRulesDetail verifies that detail: Short lowercases to short, the log line contains detail short, an invalid value produces an error naming score, short, full, and a file without detail leaves the field unset.

A repository can set how much of Kai's review kai-server posts on the
pull request in the same versioned file as its other review rules:

  detail: short    # score | short | full

The value is checked like the rest of the file (an unknown level is an
error naming the three) and rides the finding bundle as "detail";
kai-server prefers it to the repository's Atlas setting. The review log
line names it. Omitted from the bundle when the file sets none.

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

@kaicontext kaicontext Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewView in KaiKai review · Your call, then merge (9/10)

Nothing I'd call a defect, but 1 decision to say yes to.

Next: say yes or no to 1 decision below, then merge when you're happy.

Findings
  1. Your call · correct as written, but someone should say yes

    [contract] The finding bundle now emits a new "detail" JSON field that kai-server (a sibling repo) reads in a companion PR and prefers to the repository's Atlas setting; this repo is the producer side of that contract. Affects any repository that sets detail: in .kai-review.yaml — it changes how much of Kai's review is posted on its pull requests. The author notes the rollout gate (CLI release + kai-ci pin) before the field takes effect.
To get to 10/10
  • −1 · say yes or no to 1 decision above
Important files changed
File Change
cmd/kai/review_commit.go modified · +5 −1
cmd/kai/review_commit_reporules.go modified · +33 −0
cmd/kai/review_commit_reporules_test.go modified · +20 −0
How I reviewed it — 4 files, 11 turns, 40s

0 confirmed findings, 1 refuted. Intent verified.

What I opened

  • cmd/kai/review_commit.go
  • cmd/kai/review_commit_reporules.go
  • cmd/kai/review_commit_reporules_test.go
  • cmd/kai/ui.go
Full read-through

Scope

  • cmd/kai/review_commit_reporules.go (parse, validation, describe, rcActiveDetail)
  • cmd/kai/review_commit_reporules_test.go (TestParseRulesDetail, helper patterns)
  • cmd/kai/review_commit.go bundle struct literal

No proposed defect was confirmed by this check within the reviewed scope.

Decisions (need your call)

  • [contract] The finding bundle now emits a new "detail" JSON field that kai-server (a sibling repo) reads in a companion PR and prefers to the repository's Atlas setting; this repo is the producer side of that contract. Affects any repository that sets detail: in .kai-review.yaml — it changes how much of Kai's review is posted on its pull requests. The author notes the rollout gate (CLI release + kai-ci pin) before the field takes effect.

Size S · Risk M · +58 −1 · 3 files · reaches 62 · the full analysis · Reply to any of my comments and I'll answer, or say @kaicontext anywhere on this PR — a question, or "take another look at the retry logic".

@jschatz1
jschatz1 merged commit 02b1d59 into main Oct 26, 2026
7 checks passed
@jschatz1
jschatz1 deleted the review-rules/detail branch October 26, 2026 12:17
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