Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
388 changes: 387 additions & 1 deletion PLANS.md

Large diffs are not rendered by default.

19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Open Code Review Toolkit

[![Version](https://img.shields.io/pypi/v/open-code-review-toolkit?label=version&color=0A66C2)](https://pypi.org/project/open-code-review-toolkit/)
[![Python](https://img.shields.io/pypi/pyversions/open-code-review-toolkit?logo=python&logoColor=white&label=python)](https://pypi.org/project/open-code-review-toolkit/)
[![License](https://img.shields.io/pypi/l/open-code-review-toolkit?color=0A66C2)](https://github.com/xeonvs/open-code-review-toolkit/blob/main/LICENSE)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/13906/badge)](https://www.bestpractices.dev/projects/13906)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/xeonvs/open-code-review-toolkit/badge)](https://securityscorecards.dev/viewer/?uri=github.com/xeonvs/open-code-review-toolkit)
[![CodeQL](https://github.com/xeonvs/open-code-review-toolkit/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/xeonvs/open-code-review-toolkit/actions/workflows/codeql.yml)
Expand Down Expand Up @@ -28,11 +31,11 @@ python -m pip install open-code-review-toolkit
```

The toolkit does not bundle OCR. Download the platform asset for exact
[Open Code Review 1.11.0](https://github.com/alibaba/open-code-review/releases/tag/v1.11.0),
[Open Code Review 1.11.1](https://github.com/alibaba/open-code-review/releases/tag/v1.11.1),
verify it before installation against the [compatibility manifest](compatibility/ocr-support.json),
and place the verified binary on `PATH`. The current Linux amd64 digest is
`13f68cc2eca1a36d42140e9d37797b68fea5cbbf4b6345ec01ec1b06910fab60`; Darwin arm64 is
`ac8bf5a0fcd176bb9dcc15b169e90f4b52bf32787adef17a850489dbed97fb78`. The manifest owns
`1cdc7d1f776f1cdb69850130b930e40f64accc86ecaf09600573b3600456322f`; Darwin arm64 is
`5fdf72e51aae021ac7bf43d7b9dcb160f04880f623c66e8ada5e6ae5a92e172c`. The manifest owns
the other platform hashes.

Verify the installation without contacting an LLM provider:
Expand All @@ -42,14 +45,14 @@ ocr --version
ocr-ci --help
```

`ocr --version` must report `open-code-review v1.11.0`; `ocr-ci --help` must exit
`ocr --version` must report `open-code-review v1.11.1`; `ocr-ci --help` must exit
successfully. `ocr-ci preflight` is an operational configuration check, not the installation
smoke test.

The exact recommended OCR release and its verified asset checksums live in the [versioned compatibility manifest](compatibility/ocr-support.json). CI should pin that release and checksum before execution.
The [versioned compatibility policy](docs/compatibility.md) records tested assets and evidence and describes the conservative Dependabot-like qualification workflow for later upstream releases.
Review output defaults to English. `OCR_REVIEW_LANGUAGE` accepts another explicit language name when a project needs localized review output; for example, `OCR_REVIEW_LANGUAGE=Russian`.
The current OCR 1.11.0 integration defaults `OCR_REVIEW_EFFORT` to `medium` for two review rounds. `low` and `high` are explicit one- and three-round alternatives; see the [configuration reference](docs/configuration.md#review-effort) for cost, budget, and precedence boundaries.
The current OCR 1.11.1 integration defaults `OCR_REVIEW_EFFORT` to `medium` for two review rounds. `low` and `high` are explicit one- and three-round alternatives; see the [configuration reference](docs/configuration.md#review-effort) for cost, budget, and precedence boundaries.

Stable distributions are published to [PyPI](https://pypi.org/project/open-code-review-toolkit/) and mirrored as checksum-listed, provenance-attested assets in the corresponding [GitHub Release](https://github.com/xeonvs/open-code-review-toolkit/releases). Development snapshots are published only to TestPyPI.

Expand All @@ -59,16 +62,16 @@ On a successful rerun, the toolkit replaces untouched OCR-only notes instead of

Suppression uses both the GitLab diff position and a stable finding fingerprint, so ordinary line shifts do not normally bring the same bug back. A materially changed finding can still receive a new discussion. See [GitLab review operations](docs/operations.md) for the complete lifecycle, posting modes, permissions, failure behavior, and Mermaid state diagram.

After every current review note publishes, the GitLab adapter can add a conservative approval bound to receipt v5's exact reviewed source SHA and merge-request author. This write is enabled by default; set `OCR_AUTO_APPROVE=false` when the bot must remain comment-only. DLP-clean metadata, generic discussions, and adapter records do not independently block approval, while degraded metadata, DLP rejection, required context degradation, admitted remediation history, legacy receipts, publication filtering, any direct external MCP, author movement, or bot self-authorship prevents an approval write. GitLab approval rules and protected-branch policy remain authoritative. The toolkit only adds an eligible approval; it never removes an existing approval when a later review is ineligible or disabled.
After every current review note publishes, the GitLab adapter can add a conservative approval bound to receipt v6's exact reviewed source SHA and merge-request author. This write is enabled by default; set `OCR_AUTO_APPROVE=false` when the bot must remain comment-only. DLP-clean metadata, generic discussions, protected same-revision CI outcomes, and adapter records do not independently block approval, while degraded metadata, DLP rejection, required context degradation, admitted remediation history, legacy receipts, publication filtering, any direct external MCP, author movement, or bot self-authorship prevents an approval write. A CI status is review context, never approval authority. GitLab approval rules and protected-branch policy remain authoritative. The toolkit only adds an eligible approval; it never removes an existing approval when a later review is ineligible or disabled.

Accepted tradeoffs can be recorded in `.opencodereview/accepted-decisions.md`; the evidence collector supplies only applicable target-ref decisions and never lets a source change self-authorize its review. Root and nested target `AGENTS.md`/`CLAUDE.md` guidance is similarly exposed through the existing evidence MCP with deterministic scope and precedence, while any guidance touched by the merge request is excluded. See [Accepted project decisions](docs/configuration.md#accepted-project-decisions) and [Target project guidance](docs/configuration.md#target-project-guidance) for formats and trust boundaries.

## Project architecture

The shipped Repository Evidence Engine reads immutable base/head Git objects, stores bounded typed facts and deltas, creates the compact bootstrap used by OCR, and exposes detailed facts, scoped completeness, and base/head changes through the mandatory built-in read-only MCP server. Protected-policy enriched reviews can acquire stable GitLab discussions, verified remediation history, and authorized external issue/document records before OCR. Forge-specific acquisition and posting stay at provider edges; the broker, DLP, store, MCP, receipts, and tests use common contracts so a future GitHub adapter can reuse them without inheriting GitLab API semantics. The same built-in MCP exposes only opaque committed `context_list`/`context_get` handles; it has no provider network or arbitrary identifier path. Direct external MCP remains a separate privileged, comment-only operator boundary.
The shipped Repository Evidence Engine reads immutable base/head Git objects, stores bounded typed facts and deltas, creates the compact bootstrap used by OCR, and exposes detailed facts, literal search, scoped absence checks, and base/head changes through three fixed tools in the mandatory built-in read-only MCP server. Protected-policy enriched reviews can acquire stable GitLab discussions, verified remediation history, protected same-revision CI outcomes, and authorized external issue/document records before OCR. Forge-specific acquisition and posting stay at provider edges; the broker, DLP, store, MCP, receipts, and tests use common contracts so a future GitHub adapter can reuse them without inheriting GitLab API semantics. The same built-in MCP exposes only opaque committed `context_list`/`context_get` handles; it has no provider network or arbitrary identifier path. Direct external MCP remains a separate privileged, comment-only operator boundary.

- [Toolkit strategy](docs/engineering/toolkit_strategy.md) - durable product boundaries, architecture, invariants, and non-goals.
- [Bounded review context](docs/review-context.md) - protected policy, adapter protocol, GitLab discussions, opaque handles, DLP, receipt, and cleanup contracts.
- [Bounded review context](docs/review-context.md) - protected policy, GitLab discussions and same-revision CI outcomes, adapter protocol, opaque handles, DLP, receipt, and cleanup contracts.
- [Roadmap](ROADMAP.md) - milestone status, dependencies, outcomes, and completion signals.
- [Backlog](docs/codex/TASKS_BACKLOG.md) - inactive implementation-ready work; active execution remains in `PLANS.md`.

Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ flowchart LR
| M2 Ecosystem and framework coverage | Established | Supply framework and template evidence selected from demonstrated use without creating framework-specific review engines. | Established evidence, snapshot/delta, scoped-completeness, and built-in MCP contracts. | Selected static plugins and template review rules have deterministic fixtures, bounds, provenance, component ownership, completeness, first-class source/target delta queries, installed-artifact validation, verified use through the existing built-in MCP, and independently read-back stable delivery. |
| M3 External MCP hardening | Established | Qualify and document the safe-use envelope and residual limits of the shipped generic external-MCP composition boundary. | Existing external MCP and built-in composition plus BL-011 real-OCR qualification. | Canonical security and configuration guidance records the direct-composition trust boundaries, tool-name allowlist limits, server-owned object authorization, shared plan/main exposure, response/session persistence, failure degradation, and receipt non-claims observed with checksum-verified OCR and a real synthetic stdio peer. Managed OAuth remains conditional. |
| M4 Policy and project guidance | Established | Supply relevant target-branch decisions and guidance without allowing self-whitelisting. | Evidence scoping and target/source snapshots. | Stable delivery independently proves backward-compatible structured decisions, bounded target-derived guidance, one read-only MCP lifecycle, and closure of the tracked release work. |
| M5 Bounded review-context enrichment | Established | Extend invocation evidence with bounded forge discussions, verified remediation history, and optional external records through one provider-neutral, capability-constrained context lifecycle, without a second review engine. | Established M1, M3, and M4 boundaries plus the v0.7.0 BL-023 delivery. | v0.7.0 establishes bounded discussion/reference acquisition. The v0.8.0 release tree adds policy-v2 remediation selection, context-store v2 and fixed MCP projection, live bot-root/mention identity, DLP isolation, comment-only remediation, and provider-neutral reuse boundaries. The owner waived the separate enriched OCR+LLM qualification, so no receipt proves model-time `context_list`/`context_get`, still-present/evidence-resolved scenarios, or receipt-level raw-data leakage inspection. Protected release publication and independent external readback remain mandatory delivery evidence but do not replace that absent qualification. |
| M5 Bounded review-context enrichment | Established | Extend invocation evidence with bounded forge discussions, verified remediation history, protected same-revision CI outcomes, and optional external records through one provider-neutral, capability-constrained context lifecycle, without a second review engine. | Established M1, M3, and M4 boundaries plus the v0.7.0 BL-023 delivery. | v0.7.0 establishes bounded discussion/reference acquisition. The v0.8.0 release tree adds policy-v2 remediation selection, context-store v2 and fixed MCP projection, live bot-root/mention identity, DLP isolation, comment-only remediation, and provider-neutral reuse boundaries. v0.8.7 adds policy-v3 exact-head CI outcomes as scoped review evidence without suppression or approval authority. The owner waived the separate enriched OCR+LLM qualification, so no receipt proves model-time `context_list`/`context_get`, still-present/evidence-resolved scenarios, or receipt-level raw-data leakage inspection. Protected release publication and independent external readback remain mandatory delivery evidence but do not replace that absent qualification. |
| M6 Profiles and quality measurement | Established / conditional | Keep the completed review-signal ownership audit current; add model-profile aliases only after demonstrated operational need. | The BL-017 audit establishes OCR/provider telemetry and toolkit lifecycle-signal ownership; a demonstrated alias need and owner-approved matrix are required only for profile implementation. | The audit concludes `no-new-layer`; any later model profiles remain conditional and independent from explicit coverage and budget controls. |
| M7 Later and conditional work | Conditional | Activate routing, more ecosystems, fuzzing, configuration, forge adapters, or governance work only from demonstrated need. | Milestone-specific activation signals and stable preceding contracts. | Each item meets its own trigger and ships as a coherent validated slice without weakening core invariants. |

Expand Down
1 change: 1 addition & 0 deletions changelog.d/157.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add dynamic stable PyPI version, supported-Python, and Apache-2.0 license badges to the root README. The badges derive product metadata from the supported distribution instead of a hardcoded release or the development-only TestPyPI index.
7 changes: 7 additions & 0 deletions changelog.d/158.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Target checksum-verified Open Code Review 1.11.1 as the sole supported runtime for toolkit 0.8.7.

Changed: small change sets use OCR-owned local grouping below four files, while threshold-crossing changes retain semantic grouping; project `rule.json` file references are confined to the canonical repository root; selected session files follow manifest coverage.

Unchanged: result and manifest schemas, inherited completion cap `16384`, explicit positive completion-cap transport, default `medium` effort, effective max-tools, private reasoning/session data, DLP, receipts, telemetry ownership, and approval authority.

Deployment: install OCR 1.11.1 directly and verify the platform checksum from the compatibility manifest; OCR 1.11.0 is historical comparison evidence, not a runtime fallback.
1 change: 1 addition & 0 deletions changelog.d/158.rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Review Pug (`.pug`), Verilog/SystemVerilog (`.v`, `.vh`, `.sv`), and VHDL (`.vhd`, `.vhdl`) through the built-in OCR 1.11.1 allowlist and language-specific Rules. The upstream allowlist does not include `.svh`.
1 change: 1 addition & 0 deletions changelog.d/159.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent incomplete base/head evidence admission from manufacturing dependency deltas. Once admission for a fact kind is incomplete, all semantic deltas for that kind are omitted with an explicit diagnostic because the missing value cannot be attributed safely to one identity.
1 change: 1 addition & 0 deletions changelog.d/160.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add two fixed read-only built-in MCP tools for bounded literal evidence search and exact scoped coverage checks. OCR now receives concise summary/list/search/get/coverage routing, while action receipt v2 and toolkit receipt v6 reconcile all five actions to OCR's per-tool counts. Search applies the same public delta-kind semantics as list, rejects compatibility-normalized operators, and authoritative absence requires an exact component/path scope with no evidence-store admission limit, ambiguous or oversized omission, or incomplete semantic comparison. Evidence admission performs one live secret-value scan per scalar instead of repeating the same scan within a redaction pass. Only non-zero numeric counts may reach GitLab; queries, scopes, matched values, IDs, and results remain private, and incomplete coverage can never prove absence or authorize automatic approval.
1 change: 1 addition & 0 deletions changelog.d/161.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add protected review-context policy v3 for bounded same-revision CI outcomes. Operators may map exact GitLab job names to protected path prefixes; the toolkit twice reads exact-head pipeline/job metadata, ignores unrelated jobs, treats provider response ordering as non-semantic, selects the unambiguously newest requested retry, and exposes only closed status, required/advisory classification, current-or-same-revision provenance, scope, and completion time through the existing private context MCP. Hostile persisted scopes are revalidated against the protected repository-relative path grammar, and optional record rejection does not become required-source degradation. Logs, artifacts, URLs, provider IDs, identities, variables, and raw payloads remain private and unpersisted. CI outcomes provide review context only: they cannot suppress findings, prove unrelated absence, change severity/lifecycle, or authorize approval. Policies v1/v2 remain valid without `ci_outcomes`.
1 change: 1 addition & 0 deletions changelog.d/162.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Keep OCR review-filter survivors unverified across multiple review rounds. The mandatory evidence guidance now requires every prior claim to be checked again against current code, tests, and trusted evidence without changing finding, DLP, receipt, or approval schemas.
1 change: 1 addition & 0 deletions changelog.d/165.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update the pinned CI, CodeQL, TestPyPI, release, and build-provenance actions used by protected workflows.
Loading
Loading