Stubs

Teams

Governance

On the Teams plan and above, an organisation can check every push against its rules before anyone depends on it.

Policies

An organisation's owners and admins set a lint and a breaking-change policy in the organisation's Settings → Policies; a module's admins can set its own, which wins. Each uses stubs lint and stubs breaking rules (use, except, ignore, as in stubs.yaml) and a mode:

ModeA push that breaks the rules
Offgoes through
Warngoes through; the commit page shows the findings
Blockis refused, with the findings
Require approvalwaits in the approval queue, unlabelled

A refused push fails with the findings, for example:

acme/v1/money.proto:3:1: Previously present field "3" with name "nanos" on message "Money" was deleted. (FIELD_NO_DELETE)

Registry policies

A registry policy is a set of lint and breaking-change rules pushed to the registry, so many modules share one set. Write it as a buf.policy.yaml and push it, as you'd push a module:

version: v2
name: stubs.dev/acme/rules
lint:
  use:
    - STANDARD
breaking:
  use:
    - FILE
stubs policy push buf.policy.yaml --create --create-visibility public

A project uses it from its stubs.yaml, and stubs policy update pins it in stubs.lock; stubs lint and stubs breaking then check with its rules:

version: v2
policies:
  - policy: stubs.dev/acme/rules

An organisation's or a module's policy can name one instead of listing rules, so every push is checked with the same rules the developers use: under Rules from a registry policy, give acme/rules, or acme/rules:v1 for a label or commit (its main label otherwise). Its mode and its paths to leave out are still the policy's own. It must be public, or the organisation's own (the module owner's, for a module's policy), and a registry policy that's named can't be deleted.

Publishing registry policies and using them from the CLI is on every plan; naming one in a policy needs the Teams plan, as policies do. A private one counts as a private repository.

Approvals

A push that needs approval is stored as a pending commit; nothing depends on it yet. The module's admins are emailed, and approve or reject it in the organisation's Settings → Approvals, where they see what it changes. Approving moves the labels the push asked for to it.