Skip to content

tooling(review): repo-owned Greptile review policy for the CLI producer (META-321) - #22

Merged
qmarcelle merged 2 commits into
mainfrom
feature/meta-321-toolingcli-add-repo-owned-greptile-review-policy-and
Aug 12, 2026
Merged

tooling(review): repo-owned Greptile review policy for the CLI producer (META-321)#22
qmarcelle merged 2 commits into
mainfrom
feature/meta-321-toolingcli-add-repo-owned-greptile-review-policy-and

Conversation

@qmarcelle

@qmarcelle qmarcelle commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Closes the policy half of META-321. Calibration and the required-check decision follow on the canary, in a second PR.

What this is

A repo-owned Greptile policy (.greptile/config.json, .greptile/rules.md, .greptile/files.json) plus REVIEW.md, the review/merge contract.

The rules are written for this repository, not copied from workspacejson/standard. The standard's rules govern a schema surface the CLI does not own; carried across wholesale they would fire on things this repository cannot do and stay silent on the things it can.

Where the rules come from

Every CLI-specific rule is a specialization of one defect: a producer emitting a plausible-looking artifact for evidence it did not gather.

The concrete precedent is the P1 Greptile found on PR #20 — an explicit mineHistory: true request could fall back to stale preserved history and return a successful-looking result, with the refusal reason computed and then thrown away. From the artifact alone that is indistinguishable from a refresh that completed. That is why the CLI needs its own semantic vocabulary rather than a generic config.

15 CLI-specific rules cover: refresh-refusal observability, ordinary generation never mining, basisRevision never advancing without recomputation, incomplete history emitting nothing rather than an empty block, canonical UTF-8 endpoint ordering, byte-for-byte carry-forward, validator non-bypass, the exact registry dependency boundary, candidate substitution detection, the frozen agents-audit bridge, no derived/prescriptive emission, reader-tolerance not relaxing producer obligations, deterministic artifact bytes, daemon-free output, and no local schema redefinition.

5 ecosystem rules are carried because they are genuinely repository-independent: load-bearing evidence, absence-is-not-success, metrics-perturb, bidirectional checks, clean-room boundary.

7 standard rules are deliberately not carried. .greptile/rules.md ends with a table naming each and why — four survive in producer form (stated from the emitting side rather than the schema-authoring side), three have no equivalent surface here. The omissions are recorded so they read as decisions.

What REVIEW.md settles

  • A completed Greptile Review check means review ran on that head. It is not approval. The status check and conversation resolution answer different questions and are not interchangeable.
  • Review evidence is bound to the commit it was produced on; an earlier head's result does not satisfy a later head.
  • Findings are reconciled individually. Bulk resolution records that someone clicked resolve, not that each finding was read.
  • Sourcery stays defense-in-depth and is explicitly not promoted to a required check. A Sourcery review check run existing on recent heads is not calibration evidence.

What this deliberately does not do

Greptile Review is not made a required branch-protection status in this PR. A rule that has not been shown to fail for the defect it names is not eligible to be a hard gate — installing one before calibration would report conformance it never measured, which is the same defect these rules exist to catch in the producer.

Branch protection on main is untouched here. Current required contexts remain test (20), test (22), Compatibility parity vs frozen source.

Release impact — measured, not assumed

None. No changeset.

  • All five changed paths are outside packages/.
  • Each publishable manifest's files field lists only directory-local entries (dist, README.md, LICENSE, CHANGELOG.md) — nothing escapes the package directory.
  • No workflow copies root files into a package before pack/publish (grepped .github/workflows/*.yml).

No published bytes, public exports, schema behavior, or package metadata change.

Scope

Producer behavior, history/co-change semantics (META-297/META-310), release workflows, and NPM_TOKEN authority are all untouched. No publish of any kind.

Summary by Sourcery

Introduce a repo-owned Greptile review policy and contract for workspacejson/cli without changing any producer or release behavior.

Enhancements:

  • Add repo-local Greptile configuration and file mapping to support automated semantic review tailored to the CLI producer.

Documentation:

  • Add REVIEW.md documenting the review and merge contract, check semantics, and expectations for reconciling automated findings.
  • Update CONTRIBUTING.md to reference the repo-owned review policy and Greptile rules for changes to producer and mining code.
  • Document CLI-specific and ecosystem-wide review rules in .greptile/rules.md, including explicitly recorded deviations from the standard policy.

… failure classes (META-321)

The standard's rollout pattern is proven, but its rules are about a schema
surface this repository does not own. Copying them would have installed a gate
that fires on things the CLI cannot do and stays silent on the things it can.

So the rules here are derived from defects this producer has actually shipped or
nearly shipped. The load-bearing one is the P1 Greptile found on PR #20: an
explicit `mineHistory: true` request could fall back to stale preserved history
and return a successful-looking result, with the refusal reason computed and
then discarded. From the artifact alone that is indistinguishable from a refresh
that completed.

Every CLI-specific rule is a specialization of that one failure class — a
producer emitting a plausible artifact for evidence it did not gather:
refusal reported as success, an empty coChange block for a repository that could
not be analyzed, a basis pin advanced without recounting, a preserved block
rebuilt rather than passed through, UTF-16 ordering substituted for the UTF-8
byte order two producers are compared on.

Five ecosystem rules are carried because they are genuinely
repository-independent. Seven standard rules are deliberately not carried, and
`.greptile/rules.md` records which and why, so the omissions read as decisions
rather than oversights — four of them survive in producer form, stated from the
emitting side rather than the schema-authoring side.

`REVIEW.md` states what the checks mean. Check completion is not semantic
approval: the status check answers "did review complete on this head", and
conversation resolution answers "was every actionable finding dealt with".
Greptile Review is deliberately NOT made a required status here. A rule that has
not been shown to fail for the defect it names is not eligible to be a hard
gate, and installing one before calibration would be the same defect these rules
exist to catch in the producer. That decision follows the canary, on evidence.

Sourcery stays defense-in-depth. A check run existing on recent heads is not
calibration.

No release impact: every changed path is outside `packages/`, each publishable
manifest's `files` field lists only directory-local entries, and no workflow
copies root files into a package before pack. No published bytes, exports,
schema, or package metadata change, so no changeset accompanies this.
Copilot AI lite review requested due to automatic review settings August 12, 2026 13:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sourcery-ai

sourcery-ai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduces a repo-owned Greptile review policy for workspacejson/cli by adding semantic review rules, defining the review/merge contract, and wiring these into contributor docs and Greptile configuration, without touching producer or release behavior.

File-Level Changes

Change Details Files
Document the review and merge contract, clarifying how Greptile and other checks interact with branch protection and conversation resolution.
  • Add REVIEW.md describing all CI checks, which are required, and how status checks differ from semantic approval.
  • Define the current-head rule for review evidence and require per-thread reconciliation of findings.
  • Clarify the distinct roles of Greptile and Sourcery and document the staged rollout and calibration requirement for making Greptile a required gate.
  • Add guidance for agents/automated contributors regarding ownership boundaries and evidence recording.
REVIEW.md
Introduce a repo-owned Greptile ruleset that encodes CLI-specific producer failure classes and selected ecosystem-wide rules.
  • Create .greptile/rules.md with ecosystem-wide rules around evidence, absence, metrics, checks, and clean-room boundaries.
  • Define CLI-specific rules covering history refresh observability, commit-history mining defaults, basisRevision behavior, shallow history handling, canonical ordering, preservation of mined history, validator usage, dependency boundaries, candidate verification, frozen agents-audit behavior, derived/prescriptive emissions, reader vs producer obligations, determinism, daemon-free artifacts, and schema ownership.
  • Explicitly record which standard rules are intentionally not carried over and how some are transformed into producer-oriented variants.
.greptile/rules.md
Wire the new review policy and Greptile rules into contributor documentation.
  • Extend CONTRIBUTING.md with a Review section pointing to REVIEW.md and .greptile/rules.md.
  • Explain that Greptile rules are repo-owned and derived from actual producer failure classes seen in this repository.
  • Advise contributors to read the rules before touching producer and mining-core code paths.
CONTRIBUTING.md
Add Greptile configuration and file mapping to support the repo-owned policy.
  • Create .greptile/config.json to configure Greptile’s behavior for this repository (e.g., rule enforcement and PR review settings).
  • Create .greptile/files.json to declare which repo files and paths are relevant to Greptile’s analysis and rule application.
.greptile/config.json
.greptile/files.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider aligning .greptile/rules.md more tightly with the machine-enforced config by referencing concrete rule IDs or config keys in the prose, so changes to config.json cannot silently drift from the documented semantics.
  • The scope lists in .greptile/rules.md and the paths called out in REVIEW.md and CONTRIBUTING.md should be periodically checked against the actual directory layout (e.g., if files move or new producer surfaces are added) to avoid rules accidentally no longer covering the intended code.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider aligning `.greptile/rules.md` more tightly with the machine-enforced config by referencing concrete rule IDs or config keys in the prose, so changes to `config.json` cannot silently drift from the documented semantics.
- The scope lists in `.greptile/rules.md` and the paths called out in `REVIEW.md` and `CONTRIBUTING.md` should be periodically checked against the actual directory layout (e.g., if files move or new producer surfaces are added) to avoid rules accidentally no longer covering the intended code.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds repository-owned Greptile configuration, semantic review rules, and a documented review contract. It also updates the architecture guard with exact policy-file exemptions and adds regression coverage that keeps the rest of .greptile/ scanned.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
.greptile/config.json Adds structured Greptile configuration and repository-specific review rules.
.greptile/rules.md Documents producer-focused semantic, evidence-integrity, and architecture rules.
REVIEW.md Defines current-head review evidence, finding reconciliation, and merge-check semantics.
scripts/check-architecture.mjs Adds exact exemptions for the two self-referential policy files while retaining scanning of other policy content.
scripts/check-architecture.test.mjs Adds regression coverage proving the .greptile exemption is file-specific rather than directory-wide.

Reviews (2): Last reviewed commit: "fix(review): let the clean-room policy n..." | Re-trigger Greptile

Comment thread .greptile/config.json
…TA-321)

The policy files tripped the guard they describe. `check:architecture` reported
four clean-room violations on `.greptile/config.json` and `.greptile/rules.md`,
both for `@marcelle-labs/` and `workspace.vreko.json` — the vocabulary the rule
has to name to be enforceable at all.

Greptile flagged this itself on PR #22 as a P1, citing the very rule the files
had just introduced, which is the first evidence that branch-local
configuration is read.

There were two ways out and only one of them is honest. Paraphrasing the scopes
out of the policy would turn the build green while leaving the reviewer without
the strings it matches on — adjusting the measurement to fit the behavior, which
is the move `.greptile/rules.md` explicitly prohibits. So the two files join
`SELF_REFERENTIAL`, which already holds OWNERSHIP.md, CONTRIBUTING.md, README.md
and the guard's own source for exactly this reason, and whose comment already
anticipated "the ownership documentation that explains the rules".

Membership is by exact path, not directory prefix. That distinction is invisible
from a passing run — "two files are exempt" and "the whole directory is exempt"
produce identical green — so it is asserted rather than commented: a new red
case writes `@marcelle-labs/` into `.greptile/notes.md` and requires the guard
to still reject it. Injecting the directory-wide mistake takes the suite to
20 passed / 1 failed; restoring it returns 21 / 0.

REVIEW.md is deliberately NOT exempted. It does not name the forbidden
vocabulary, and exempting a file against a hypothetical future edit would give
up real coverage for nothing.

Waived coverage, stated rather than glossed: `SELF_REFERENTIAL` gates four
checks. For `rules.md` the other three cannot apply — `copied-schema` is
JSON-only, `shadowed-standard-types` is `.d.ts`-only, `neutral-producer-purity`
is scoped to `packages/cli/`. For `config.json` the one additional waiver is
`copied-schema`, which needs `$schema` + `$id` + `type: "object"` + `properties`;
the Greptile config has none of them.
@qmarcelle
qmarcelle merged commit f11d430 into main Aug 12, 2026
7 checks passed
qmarcelle added a commit that referenced this pull request Aug 12, 2026
…eck status does not (META-321) (#24)

Canary PR #23 answered the question META-321 actually asked, and the answer is
not the one the staged rollout was set up to expect.

The rules caught 3/3 positive controls, each citing the rule by name and each
sourced from `.greptile`, which also proves branch-local configuration is read.
Typecheck was clean on all three defects, so none of them is visible to the
compiler — the semantic layer earned its place.

The check STATUS is a different question, and it fails in both directions:

- cannot-ever-fail: on PR #22 the reviewer posted a P1 at 13:30:16 and the
  Greptile Review check concluded success at 13:30:18;
- cannot-ever-pass: on the canary's revert head, whose diff nets to empty
  against main, no Greptile Review check run was posted at all.

A required context that goes green with an open P1 and can also never appear
would neither block a bad head nor clear a good one. That is the vacuous-check
shape .greptile/rules.md prohibits, so it is not installed. Branch protection is
unchanged: test (20), test (22), Compatibility parity vs frozen source, strict,
required conversation resolution.

What does enforce review was measured rather than assumed. With the rollup at
SUCCESS and the branch MERGEABLE, PR #22 sat at BLOCKED on one unresolved
thread and moved to CLEAN when that thread resolved, head and rollup unchanged.
Conversation resolution is the load-bearing mechanism; Greptile produces the
findings it counts.

Sourcery keeps its non-required status on new evidence rather than inheritance:
it concluded success on the head carrying all three deliberate defects.

No release impact: REVIEW.md is outside packages/, no published bytes change,
no changeset.
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.

2 participants