Skip to content

Handle GitHub team hierarchy in ownership reconciliation #4

Description

@raiderrobert

Problem

GitHub teams have parent/child hierarchy. If CODEOWNERS references a parent team and catalog-info.yaml references a child team (or vice versa), the tool reports "mismatched" even though the child inherits the parent's permissions.

Example:

  • CODEOWNERS: @acme-corp/platform (parent)
  • catalog-info.yaml: group:platform-frontend (child)
  • Current result: mismatched
  • Arguably correct: child inherits parent permissions

Context

In practice, when a parent team (department/org-level) is listed as owner instead of a specific child team, it often signals that nobody has claimed real ownership — it's a default that was never narrowed down. This is worth surfacing differently from a genuine parent-vs-child mismatch.

Possible approach

  • Fetch team hierarchy via GitHub API (GET /orgs/{org}/teams/{team}/children)
  • When comparing teams, check if one is an ancestor of the other
  • Consider a distinct alignment status (e.g., HierarchyMismatch) to differentiate from unrelated team mismatches
  • Potentially flag parent-team-as-owner as a smell ("owned by a department, not a team")

Complexity

Adds API calls to resolve hierarchy and complicates the reconciliation logic. Not needed for v1 where exact string matching is sufficient and broadly correct.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions