Skip to content

Add YAML-based PR Gates to Code Coverage docs#34625

Open
ManuelPalenzuelaDD wants to merge 7 commits intomasterfrom
mpalenzuela/code-coverage-yaml-pr-gates
Open

Add YAML-based PR Gates to Code Coverage docs#34625
ManuelPalenzuelaDD wants to merge 7 commits intomasterfrom
mpalenzuela/code-coverage-yaml-pr-gates

Conversation

@ManuelPalenzuelaDD
Copy link
Contributor

@ManuelPalenzuelaDD ManuelPalenzuelaDD commented Feb 16, 2026

Summary

  • Document the new gates field in code-coverage.datadog.yml that allows users to define PR coverage gates as code in their repository
  • Update configuration.md with full gate syntax reference, field descriptions, and collapsible examples (basic, service-scoped, code owner-scoped)
  • Update setup.md PR Gates section to present both UI and YAML configuration options
  • Update monorepo_support.md to add a "Using the YAML configuration file" subsection for service/code owner-scoped gates

This PR shouldn't be merged until we finalize deploying the feature.

  • Ready to merge: NO

Document the new `gates` field in `code-coverage.datadog.yml` that allows
users to define PR coverage gates as code in their repository, alongside
the existing UI-based configuration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ManuelPalenzuelaDD ManuelPalenzuelaDD marked this pull request as ready for review February 16, 2026 17:38
@ManuelPalenzuelaDD ManuelPalenzuelaDD requested a review from a team as a code owner February 16, 2026 17:38
Copy link
Contributor

@nikita-tkachenko-datadog nikita-tkachenko-datadog left a comment

Choose a reason for hiding this comment

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

The YAML gates work for flags too, right? We should mention this, and maybe add a per-flag gate to the list of examples

…d YAML gates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

@domalessi domalessi left a comment

Choose a reason for hiding this comment

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

Left a few suggestions, but overall this looks fantastic! Thanks for the PR!


## PR Gates

You can define [PR Gates][2] directly in the configuration file to enforce code coverage thresholds on pull requests. Gates defined in the configuration file work alongside gates configured in the [Datadog UI][2]—both sets of rules are evaluated when a PR is opened or updated.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
You can define [PR Gates][2] directly in the configuration file to enforce code coverage thresholds on pull requests. Gates defined in the configuration file work alongside gates configured in the [Datadog UI][2]both sets of rules are evaluated when a PR is opened or updated.
You can define [PR Gates][2] in the configuration file to enforce code coverage thresholds on pull requests. If gates are also configured in the [Datadog UI][2], Datadog evaluates both the configuration file rules and the UI rules when a PR is opened or updated.

Comment on lines 183 to 189
- `type` (required): The type of coverage gate. Supported values:
- `total_coverage_percentage`: Enforces a minimum overall coverage percentage for the repository (or scoped services/code owners).
- `patch_coverage_percentage`: Enforces a minimum coverage percentage on code changed in the pull request.
- `config` (required): Gate configuration options.
- `threshold` (required): The minimum coverage percentage required (0–100).
- `services`: (optional) List of service name patterns to scope the gate to. Use `*` as a wildcard. When specified, the gate evaluates coverage for matching services independently.
- `codeowners`: (optional) List of code owner patterns to scope the gate to. Use `*` as a wildcard. When specified, the gate evaluates coverage for matching code owners independently.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- `type` (required): The type of coverage gate. Supported values:
- `total_coverage_percentage`: Enforces a minimum overall coverage percentage for the repository (or scoped services/code owners).
- `patch_coverage_percentage`: Enforces a minimum coverage percentage on code changed in the pull request.
- `config` (required): Gate configuration options.
- `threshold` (required): The minimum coverage percentage required (0–100).
- `services`: (optional) List of service name patterns to scope the gate to. Use `*` as a wildcard. When specified, the gate evaluates coverage for matching services independently.
- `codeowners`: (optional) List of code owner patterns to scope the gate to. Use `*` as a wildcard. When specified, the gate evaluates coverage for matching code owners independently.
- `type` (required): The type of coverage gate. Supported values:
- `total_coverage_percentage`: The minimum overall coverage percentage for the repository (or for the scoped services or code owners).
- `patch_coverage_percentage`: The minimum coverage percentage on code changed in the pull request.
- `config` (required): Gate configuration options. Supported values:
- `threshold` (required): The minimum coverage percentage (0-100).
- `services`: (optional) A list of service name patterns to scope the gate to. Use `*` as a wildcard. When set, coverage is evaluated separately for each matching service.
- `codeowners`: (optional) A list of code owner patterns to scope the gate to. Use `*` as a wildcard. When set, coverage is evaluated separately for each matching code owner.

ManuelPalenzuelaDD and others added 4 commits February 17, 2026 16:06
Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com>
Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com>
Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com>
…d rename example

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

3 participants