Skip to content

feat(governance): enforce author-dependent Governance Council approval rules - #59

Open
carolinerg1 wants to merge 7 commits into
mainfrom
feature/gc-author-approval-rules
Open

feat(governance): enforce author-dependent Governance Council approval rules#59
carolinerg1 wants to merge 7 commits into
mainfrom
feature/gc-author-approval-rules

Conversation

@carolinerg1

@carolinerg1 carolinerg1 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

Simplify the Governance Council (GC) dynamic approval rules in pr_validator.py to match the new policy.

  • If the PR author is in the GC, only 1 GC approval is required.
  • If the PR author is not in the GC, the default min_approvals from the repository's rules configuration is respected
  • Updated unit tests to match the simplified logic and added a test case to verify that non-GC authors respect YAML configurations requiring 1 approval.

Category (Required)

Please select one or more categories that apply to this change.

  • Core Protocol: Changes to the base communication layer, global context, or breaking refactors. (Requires Technical Council approval)
  • Governance/Contributing: Updates to GOVERNANCE.md, CONTRIBUTING.md, or CODEOWNERS. (Requires Governance Council approval)
  • Capability: New schemas (Discovery, Cart, etc.) or extensions. (Requires Maintainer approval)
  • Documentation: Updates to README, or documentations regarding schema or capabilities. (Requires Maintainer approval)
  • Infrastructure: CI/CD, Linters, or build scripts. (Requires DevOps Maintainer approval)
  • Maintenance: Version bumps, lockfile updates, or minor bug fixes. (Requires DevOps Maintainer approval)
  • SDK: Language-specific SDK updates and releases. (Requires DevOps Maintainer approval)
  • Samples / Conformance: Maintaining samples and the conformance suite. (Requires Maintainer approval)
  • UCP Schema: Changes to the ucp-schema tool (resolver, linter, validator). (Requires Maintainer approval)
  • Community Health (.github): Updates to templates, workflows, or org-level configs. (Requires DevOps Maintainer approval)

Related Issues

Checklist

  • I have followed the Contributing Guide (including Conventional Commits title requirements and ! for breaking changes).
  • I have updated the documentation (if applicable).
  • My changes pass all local linting and formatting checks.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk.

Screenshots / Logs (if applicable)

@damaz91
damaz91 force-pushed the feature/gc-author-approval-rules branch from 9b109e2 to f783e45 Compare August 12, 2026 09:47
@damaz91
damaz91 marked this pull request as ready for review August 12, 2026 10:02
@damaz91
damaz91 requested review from amithanda and ptiper August 12, 2026 11:39
@damaz91 damaz91 changed the title feat(governance): enforce author-dependent Governance Council approval rulesFeature/gc author approval rules feat(governance): enforce author-dependent Governance Council approval rules Aug 12, 2026
is_satisfied = approved_count >= effective_req.min_approvals
if (
require_total_approvals is not None
and len(approver_usernames) < require_total_approvals

@amithanda amithanda Aug 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

len(approver_usernames) < require_total_approvals

Can you please double check and confirm the logic here?
I haven't looked too closely but I think there may be an edge-case bug here: approver_usernames can contain non-approving reviewers (e.g., users who only commented or requested changes), causing len(approver_usernames) to pass even when there isn't a second actual approval.

To fix this, we should count distinct valid approvals (excluding the PR author):

total_valid_approvals = len([u for u in approver_usernames if u != author])
if total_valid_approvals < require_total_approvals:
    is_satisfied = False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for double-checking @amithanda - that’s actually already handled upstream in _get_all_approvers_and_assigned_usernames():

  1. approver_usernames is only populated from reviews where state == ReviewState.APPROVED (commenters and change requestors are placed into assigned_usernames instead).
  2. The author is already filtered out there (if user != pr.author), so approver_usernames is guaranteed to contain only distinct, non-author approving reviewers.

Because of that, len(approver_usernames) accurately reflects the total number of distinct valid approvals on the PR.

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