Repository navigation
feat: repeatable dhruv check for committed changes - #179
Merged
Merged
Conversation
Add dhruv check --base <git-ref>: reviews merge-base..HEAD with argument-safe Git calls, deterministic size limits and new-side changed lines, starts without loading Plugin Commands, and is authorized in the separate security allowlist.
A request with cache: false neither reads nor writes .dhruv-cache, so a caller reviewing an untrusted checkout can keep model responses off disk.
Ask the model for structured candidates and report only those on a new-side changed line of an analyzed file, with a documented severity, reason, evidence and recommendation. Invalid and off-diff candidates are omitted and counted, duplicates collapse deterministically, and an unparseable response fails the run without echoing it. Text shows a summary; JSON is one schemaVersion 1 object for success and failure. check bypasses the response cache so model output stays off disk.
Read a versioned policy, .dhruv-check.json, from the HEAD commit as JSON data: include and exclude globs, changed-file and patch-byte limits and a minimum shown severity. An invalid policy or option fails before any AI request, and each setting has a command-line option that replaces it for one run without touching the checked-in file. Source Ingestion now reports ignored, unreadable and truncated changes besides the existing reasons, counts exclusions by reason, and truncates an oversized patch at a hunk boundary instead of dropping the file. Incomplete coverage stays advisory and visible in text and JSON; --strict-coverage turns it into status "incomplete" with exit code 2. The JSON result grows additively and stays schemaVersion 1.
The Ollama client was built without a host, so every request went to 127.0.0.1:11434 while only the status probe read OLLAMA_HOST: status could report a remote server that generation never used. Both now read the same endpoint, which is what lets a command run against an Ollama service on another machine. An empty OLLAMA_HOST means the local default.
A Built-in Command can now carry help notes, printed after its examples. check uses them for what its options do not say: it reads commits only, findings are advisory, --json writes one versioned object, what each exit code means, and where the adoption guide lives.
docs/check.md leads with the local command and a copyable workflow for a self-hosted runner that reaches a company-operated Ollama service, then keeps the options, policy file, exclusion reasons, JSON result, exit codes and error kinds in reference tables. The workflow lives in the guide, so this repository does not run it. The guide states the behaviour as built: the policy is read from the HEAD commit, so a pull request can loosen its own review and the result shows it; limits count patch bytes; removal-only changes and unsupported file types are not sent; findings are advisory and validation covers location and structure only; check writes logs/ where it runs. The README links the guide, separates check from review --diff, documents OLLAMA_HOST, and notes that check never loads plugins. CONTEXT.md gains Committed Range, Check Policy, Finding and Coverage.
A contract test reads docs/check.md and the README and checks them against the definitions and against real runs with a fake AIClient: every shown command line uses options check accepts, the guide's text and JSON examples are reproduced exactly, the example policy is accepted and applied, and the option, policy, exclusion, severity, JSON key, exit code and error kind tables match what runs produce. The GitHub Actions example is parsed and checked for full history, the pull request head, no credentials, no repository code, and a result that reaches only the artifact. Its command is then run for real against a stand-in Ollama service through OLLAMA_HOST, in a checkout that carries a plugin and its own Dhruv configuration. COVERAGE_BREAKING is exported so the documented reasons stay in step.
rahul05ranjan
marked this pull request as ready for review
October 9, 2026 19:23
Contributor
|
🎉 This PR is included in version 1.14.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a read-only Built-in Command for local branches and CI. The optional
.dhruv-check.jsonpolicy is read from the resolved base commit, so a pull request cannot narrow its own review scope.checkbypasses repository Plugin Commands and sends only bounded selected changes to the configured Ollama endpoint. The adoption guide includes local usage, policy and JSON contracts, and a GitHub Actions example.Closes #165. Closes #166. Closes #167. Closes #168. Closes #169.
Evidence
review --diffcovers uncommitted edits; no command reviewed a committed merge-base range with machine-readable Findings and coverage.After: command-level tests cover Git ranges, changed-line validation, invalid model output, JSON failures, policy overrides, strict coverage, plugin avoidance, and prompt byte limits.
Merge Danger
Door: two-way
Blast Radius: CLI dispatch, Git Source Ingestion, configured Ollama requests, JSON Command Presentation, and local/CI review policy.
Findings remain advisory. Complete coverage means the selected source fit the configured scope and limits; it does not establish that the model found every problem. Pull request code can contain prompt-injection text, so the example CI job keeps the result as an artifact for human review.