coance configuration

This is the specification of coance.yml, the file that tells coance how carefully each file in a repository must be reviewed and who may approve it.

Status: draft specification. Nothing here is implemented yet.

File

levels

A level says how carefully a file must be reviewed. There are no built-in levels: each repository defines its own. Levels are listed strictest first, and that order decides which level wins when rules overlap.

Setting Values Default Meaning
description markdown required What a reviewer must do. Shown in each file’s thread, in the summary comment and in the app.
approvals 1–10 1 How many different eligible people must approve each file.
self_review true, false true Whether the pull request author’s own approval counts.

self_review defaults to true because the author of an AI-assisted pull request is often the right person to review the generated code. Set it to false on levels that need a second person.

rules

rules.from says where the rules come from: coance (the default) or codeowners.

from: coance

Rules live under rules.paths, with one entry per level. Each level uses one of two forms:

Mixing the two forms within one level is a config error.

from: codeowners

Levels are assigned by annotation comments in CODEOWNERS, and owners come from the CODEOWNERS lines themselves. GitHub ignores comments, so the annotations do not change how CODEOWNERS works.

# coance: critical
/lib/payments/   @solid-software/payments

Files that need no review

Who can approve

In the pull request

File threads

coance opens one review thread on each file that needs review, attached to the file in “Files changed” and written from template. An eligible reviewer approves the file by resolving the thread or replying /approve in it.

Summary comment

coance posts one comment in the pull request conversation and keeps it updated in place. It shows:

template

The text of every file thread. One template is used for all levels; the level’s description is what varies between them.

Placeholder Value
{level} The level’s name
{description} The level’s description
{approvals} Approvals required
{owners} Eligible reviewers as @mentions, or “anyone with write access”
{file} The file path
{lines} Lines changed in this file

If template is left out, coance uses a built-in default much like the one in example 2.

Approval lifecycle

  1. The pull request opens or updates. coance works out each file’s level and eligible reviewers, then posts or updates the threads, the summary comment and the check.
  2. Reviewers approve files in their threads.
  3. A file is done when it has approvals approvals from eligible people.
  4. New commits: a commit that changes an approved file clears that file’s approvals and reopens its thread. Files the commit does not touch keep their approvals.

Status check

coance reports a check named coance:

Config errors:

Metrics

Generated and vendored files are left out of every count.

Examples

1. Minimal: anyone can review

levels:
  careful:
    description: Read every changed line before approving.
  quick:
    description: Skim the file and check it makes sense.

rules:
  paths:
    careful: ["/lib/payments/", "/lib/auth/"]
    quick: ["*.dart"]

2. Everything in coance.yml

levels:
  critical:
    approvals: 2
    self_review: false
    description: |
      Money or auth code. Read every changed line, run it locally,
      and check the tests cover the failure cases.
  review:
    description: Read the file as a whole. Does the change make sense?

template: |
  **{level}** · {approvals} approval(s) needed · {owners}

  {description}

  Resolve this thread or reply `/approve` once you're done.
  Review guide: https://solid.software/review-guide

rules:
  from: coance
  paths:
    critical:
      /lib/payments/: "@solid-software/payments @solid-software/security"
      /lib/auth/: "@solid-software/security @solid-software/leads"
    review:
      "*.dart": "@solid-software/mobile"
# .gitattributes
*.g.dart        linguist-generated=true
*.freezed.dart  linguist-generated=true

A pull request that touches lib/payments/charge.dart, lib/ui/button.dart and lib/ui/button.g.dart:

3. Rules from CODEOWNERS

# .github/coance.yml
levels:
  critical:
    approvals: 2
    self_review: false
    description: Read every changed line and run it locally.
  review:
    description: Read the file as a whole.

rules:
  from: codeowners
# .github/CODEOWNERS
# No annotation: these files need no review.
*.md             @solid-software/docs

# coance: review
/lib/            @solid-software/mobile

# coance: critical
/lib/payments/   @solid-software/payments @solid-software/security
/lib/auth/       @solid-software/security

The critical paths come last, so the last-match rule gives them both the right owners and the critical level.