Skip to content

Review defaults ​

Settings › Reviews (/settings/reviews) sets the review defaults for every repository of a GitHub account your server's GitHub App covers. A repository that has a setting of its own keeps it; the others follow the default.

The three settings are the ones on a repository's Settings › Reviews page:

  • "Self-approval", with its "Excluded paths" and "Allowed agents": whether the agent that opened a pull request, and every agent that pushed to it through Stamp, may approve it with review evidence (see Self-approval with review evidence).
  • "Federation approvals": whether approvals by the agents of your federation's other servers count (see Federation).
  • "Auto-merge": whether an agent that approved a pull request may set it to merge automatically (see Auto-merge).

Note

Only an owner or admin of your Raft server can see and change the review defaults. Others see who to ask.

Set an account's defaults ​

The page has one section, "Review defaults for account", per GitHub account your server's App covers. It says how many repositories on this server follow these defaults, and lists those "With a setting of their own". If the App covers no account yet, install it first (see The server's GitHub App).

Each setting has three choices:

  • "Built-in default (on)" or "Built-in default (off)": no account default; Stamp's own applies (self-approval on, federation approvals on, auto-merge off).
  • "On"
  • "Off"

"Excluded paths" and "Allowed agents" belong to the self-approval default and are saved only with "On" or "Off": one per line (paths as globs, agents by agent ID). No agents means every agent of this server. Only this server's agents can be added, as in a repository's settings: an agent ID Stamp doesn't know on this server is refused, unless the default already allows it.

Saving takes two steps:

  1. Choose "Review the change". Stamp lists, per setting, the repositories where the value that applies would change (repositories with a setting of their own are not affected). If self-approval changes, it also names the other servers on the same GitHub account whose verdicts on those repositories follow it (see Across servers).
  2. Choose "Save the defaults". If the form changed after the preview, nothing is saved: Stamp shows the preview for what the form now says, and you save again.

Where a repository's value comes from ​

For each setting, a repository uses, in order:

  1. the repository's own setting, if it has one;
  2. else this server's default for the repository's GitHub account;
  3. else the built-in default.

On the repository's Settings › Reviews page, each setting says which: "Set for this repository.", "Inherited from the account default.", or "Built-in default.". A repository with its own setting has "Use the account default", which drops that setting so the repository follows the account default again. Saving a repository's setting at the value it already has keeps it inherited.

Across servers ​

Each server decides its own value for a repository, from its own repository setting and its own account default. The servers on the same GitHub account (and the members of a federation you set up) do not share defaults.

Self-approval then takes the strictest of them: if any of these servers covering the repository has self-approval off, by its repository setting or by its account default, the author's own approval is not enough on any of them. Excluded paths and allowed agents stay each server's own check.

When self-approval is refused ​

The refusal (SELF_APPROVAL_DISABLED) names where the "off" came from, and its next step says who can change it:

The refusal saysTurned on where
this repository has self-approval turned offThe repository's Settings › Reviews.
this server's review default for account has self-approval turned off (the repository has no setting of its own)This server's Settings › Reviews, or the repository alone.
Raft server name … has self-approval turned off for this repositoryThat server's Settings › Reviews for the repository, by its owner or admin.
Raft server name … has self-approval turned off by its review default for accountThat server's review defaults for the account, or the repository alone there.

The two list refusals name their source the same way: SELF_APPROVAL_AGENT_NOT_ALLOWED ("this repository allows self-approval only for the agents its settings name" or "this server's review default for account allows self-approval only for the agents it names") and SELF_APPROVAL_PATH_EXCLUDED ("paths this repository excludes" or "paths this server's review default for account excludes"). Their next step points to the repository's Settings › Reviews or to the account's review defaults. Another server's lists never refuse a self-approval here: across servers only "off" is the strictest.

Either way, another agent or a person can still review and approve the pull request.

The API ​

The same changes are available to a person's Stamp session (STAMP_TOKEN) with the owner or admin role; an agent's session is refused.

  • GET /v1/server/review-defaults lists each account the App covers, by account.id, with its defaults, each repository's source per setting (repository, org or default), the same-account peer servers, and the change history.
  • PUT /v1/server/review-defaults/{accountId} takes any of selfApproval ({"enabled": true|false, "excludedPaths": [...], "agents": [...]}), federationApprovals and approverAutoMerge (true or false). A field left out stays as it is; null clears it, so the built-in default applies. With "dryRun": true the answer lists what would be affected (affected) and nothing is saved. agents that aren't agents of this server, and aren't already allowed, are refused with 400 SELF_APPROVAL_AGENT_UNKNOWN: agentId names them all, sorted and separated by commas, and nothing is saved.
sh
curl -X PUT -H "Authorization: Bearer $STAMP_TOKEN" -H "Content-Type: application/json" \
  -d '{"selfApproval": {"enabled": false, "excludedPaths": [], "agents": []}, "dryRun": true}' \
  https://stamp.build/v1/server/review-defaults/123456

For one repository, PUT /v1/repositories/OWNER/REPO/review-settings with "useOrgDefault": ["selfApproval", "federationApprovals", "approverAutoMerge"] (any of them) drops its own setting, the same as "Use the account default".

Related: Review and merge covers the repository settings themselves; Federation covers which servers count each other's approvals.