Skip to content

Add CODEOWNERS for automatic PR reviewer assignment#2825

Open
npow wants to merge 6 commits intomasterfrom
add-codeowners-v2
Open

Add CODEOWNERS for automatic PR reviewer assignment#2825
npow wants to merge 6 commits intomasterfrom
add-codeowners-v2

Conversation

@npow
Copy link
Copy Markdown
Collaborator

@npow npow commented Feb 20, 2026

Maps repository components to their primary maintainers based on git history analysis, enabling GitHub to auto-assign reviewers on PRs.

Maps repository components to their primary maintainers based on git
history and PR activity analysis, enabling GitHub to auto-assign
reviewers on PRs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@npow npow force-pushed the add-codeowners-v2 branch from ebbe02e to 584b60f Compare February 20, 2026 18:43
@npow
Copy link
Copy Markdown
Collaborator Author

npow commented Feb 20, 2026

@greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 20, 2026

Greptile Summary

Added CODEOWNERS file to automatically assign reviewers based on component ownership. Maps core runtime files, plugins, infrastructure, and tooling to their primary maintainers.

Issues Found:

  • Two non-existent directory paths that will not match any files (metaflow/metadata/ on line 42 and metaflow/plugins/metadata/ on line 120)
  • Line 120 appears to be a duplicate of line 118 with slightly different path

Confidence Score: 3/5

  • Safe to merge after fixing the two non-existent directory references
  • The CODEOWNERS file is well-structured and comprehensive, but contains references to two directories that don't exist in the repository, which means those rules will never match any files
  • .github/CODEOWNERS lines 42 and 120 reference non-existent directories

Important Files Changed

Filename Overview
.github/CODEOWNERS New CODEOWNERS file mapping components to maintainers; contains 2 paths to non-existent directories

Last reviewed commit: 584b60f

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Copy link
Copy Markdown
Collaborator

@savingoyal savingoyal left a comment

Choose a reason for hiding this comment

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

Thanks! How is this file generated and kept fresh? Also given the small number of reviewers, do we need it at this point? I am okay either way as long as this file auto-updates.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 22, 2026

Greptile Summary

This PR introduces a distributed CODEOWNERS system using codeowners-generator. Individual CODEOWNERS files are placed in 35+ subdirectories throughout the repository, mapping each component to its primary maintainers. These are then merged into a single .github/CODEOWNERS file that GitHub uses for automatic PR reviewer assignment. A CI workflow validates that the generated file stays in sync with the distributed sources.

  • All referenced directory paths in the generated .github/CODEOWNERS have been verified to exist in the repository.
  • The CI workflow (.github/workflows/codeowners.yml) runs npx codeowners-generator without pinning a version, which is a supply-chain risk — a compromised or broken npm publish would silently affect CI. The workflow also lacks explicit permissions (other workflows in this repo use permissions: read-all).
  • The generated .github/CODEOWNERS is missing a trailing newline.

Confidence Score: 4/5

  • This PR is safe to merge — it only adds CODEOWNERS files and a CI check with no impact on runtime code.
  • Score of 4 reflects that the PR is purely additive configuration with no code changes. All referenced paths are valid. The main concern is the unpinned npx dependency in the CI workflow, which poses a supply-chain risk but does not affect the repository's source code or builds.
  • .github/workflows/codeowners.yml needs attention for the unpinned npx codeowners-generator call and missing permissions block.

Important Files Changed

Filename Overview
.github/CODEOWNERS Auto-generated CODEOWNERS mapping maintainers to paths. All referenced directories verified to exist. Missing trailing newline.
.github/workflows/codeowners.yml CI workflow using unpinned npx package without setup-node step or explicit permissions — supply-chain risk.
.codeowners-generatorrc Configuration for codeowners-generator. Outputs to .github/CODEOWNERS, excludes auto-generated file from input. Straightforward.
CODEOWNERS Root CODEOWNERS with default core maintainers and .github/ override. Correct and clean.
metaflow/cmd/CODEOWNERS CODEOWNERS for cmd directory with subdirectory-specific overrides for develop/ and code/. Both subdirectories verified to exist.
metaflow/plugins/CODEOWNERS Single file-specific ownership rule for events_decorator.py. File verified to exist at this path.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Root CODEOWNERS\n(default owners)"] --> G["codeowners-generator"]
    B["devtools/CODEOWNERS"] --> G
    C["metaflow/*/CODEOWNERS\n(core modules)"] --> G
    D["metaflow/plugins/*/CODEOWNERS\n(plugin modules)"] --> G
    E["metaflow/cmd/CODEOWNERS\n(subdirectory overrides)"] --> G
    F["metaflow/plugins/CODEOWNERS\n(file-specific rule)"] --> G
    G -->|"generates"| H[".github/CODEOWNERS\n(merged output)"]
    H -->|"used by"| I["GitHub PR\nReviewer Assignment"]
    J["CI Workflow\ncodeowners.yml"] -->|"validates sync"| H
Loading

Last reviewed commit: 96af80e

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

38 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 22, 2026

Greptile Summary

Introduces a distributed CODEOWNERS system using codeowners-generator to auto-assign PR reviewers based on directory ownership. Individual CODEOWNERS files are placed in 34 directories throughout the repository, and these are aggregated into a single .github/CODEOWNERS file by the generator. A CI workflow (.github/workflows/codeowners.yml) validates that the generated file stays in sync with the source files on PRs that touch CODEOWNERS.

  • Adds .codeowners-generatorrc config targeting .github/CODEOWNERS as output
  • Distributes ownership across core modules (metaflow/datastore, metaflow/client, etc.) and all plugin subdirectories
  • Root CODEOWNERS sets @savingoyal, @saikonen, @romain-intel as default reviewers for all files
  • CI workflow uses actions/checkout@v4 while the rest of the repo has moved to v6 — minor inconsistency worth aligning

Confidence Score: 4/5

  • This PR is safe to merge — it only adds CODEOWNERS metadata and a read-only CI check with no impact on application code or behavior.
  • Score of 4 reflects that this is a low-risk, configuration-only change. All referenced directories and files have been verified to exist. The one minor issue is the outdated actions/checkout@v4 in the CI workflow compared to the rest of the repo using v6. No application logic is affected.
  • .github/workflows/codeowners.yml — uses actions/checkout@v4 instead of v6 used elsewhere, and lacks the permissions block other workflows set.

Important Files Changed

Filename Overview
.github/workflows/codeowners.yml New CI workflow to verify generated CODEOWNERS stays in sync. Uses outdated actions/checkout@v4 (rest of repo uses v6) and lacks permissions block that other workflows set.
.github/CODEOWNERS Auto-generated CODEOWNERS file mapping directories to reviewers. Missing trailing newline (POSIX). File is generated output, so issues should be fixed via source CODEOWNERS files or generator config.
.codeowners-generatorrc Configuration for codeowners-generator. Outputs to .github/CODEOWNERS, collects from distributed CODEOWNERS files, excludes node_modules and the output file itself. Clean and correct.
CODEOWNERS Root CODEOWNERS defining default core maintainers and CI/GitHub Actions ownership. Straightforward and correct.
metaflow/cmd/CODEOWNERS Assigns cmd directory ownership with granular rules for develop/ and code/ subdirectories. Both subdirectories verified to exist.
metaflow/plugins/CODEOWNERS Assigns ownership for events_decorator.py specifically. File verified to exist at metaflow/plugins/events_decorator.py.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Root CODEOWNERS\n(default owners)"] --> G["codeowners-generator"]
    B["devtools/CODEOWNERS"] --> G
    C["metaflow/*/CODEOWNERS\n(core modules)"] --> G
    D["metaflow/plugins/*/CODEOWNERS\n(plugin modules)"] --> G
    E["metaflow/cmd/CODEOWNERS\n(granular rules)"] --> G
    F["metaflow/plugins/CODEOWNERS\n(file-specific rule)"] --> G
    G -->|"generates"| H[".github/CODEOWNERS\n(aggregated output)"]
    H -->|"used by"| I["GitHub PR\nauto-reviewer assignment"]
    
    J["PR touches CODEOWNERS"] -->|"triggers"| K["codeowners.yml\nCI workflow"]
    K -->|"npx codeowners-generator\ngenerate --check"| L{"In sync?"}
    L -->|"Yes"| M["✓ Check passes"]
    L -->|"No"| N["✗ Check fails"]
Loading

Last reviewed commit: b4d5e24

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

38 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Add missing trailing newline to .github/CODEOWNERS and set
permissions: read-all on the codeowners workflow for least-privilege.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 22, 2026

Greptile Summary

This PR introduces automated CODEOWNERS management using codeowners-generator. It distributes 34 CODEOWNERS files across the repository's directory structure, each declaring directory-level maintainers based on git history analysis. These are aggregated into the canonical .github/CODEOWNERS by the generator tool. A CI workflow (.github/workflows/codeowners.yml) verifies the generated file stays in sync with the distributed source files on PRs that touch any CODEOWNERS file.

  • Ownership is mapped for all major modules: core metaflow, CLI, client, plugins (airflow, argo, AWS, Azure, GCP, Kubernetes, cards, pypi, uv, etc.), runner, datastore, and more
  • Default catch-all assigns @savingoyal, @saikonen, @romain-intel as reviewers for any file not covered by a more specific rule
  • The CI workflow now pins codeowners-generator@2.4.0 and sets permissions: read-all, addressing earlier review feedback
  • Previous issues with non-existent directory paths (metaflow/metadata/, metaflow/plugins/metadata/) and missing trailing newline have been resolved in follow-up commits

Confidence Score: 4/5

  • This PR is safe to merge — it only adds CODEOWNERS configuration files with no impact on runtime code.
  • Score of 4 reflects that this is a configuration-only change with no runtime code impact. The ownership mappings appear well-reasoned based on git history. The CI workflow has been improved with pinned versions and proper permissions. One minor issue remains: actions/checkout@v4 is inconsistent with the rest of the repo (v6), which was already flagged in prior review threads. All other previously raised issues have been addressed.
  • .github/workflows/codeowners.yml still uses actions/checkout@v4 while the rest of the repo uses v6 (already flagged in prior review).

Important Files Changed

Filename Overview
.github/CODEOWNERS Auto-generated CODEOWNERS file mapping 30+ directories to their maintainers. Rules are correctly ordered (catch-all first, specific overrides after). Previous issues (missing trailing newline, non-existent paths) have been addressed.
.github/workflows/codeowners.yml CI workflow to verify generated CODEOWNERS is up to date. Uses pinned codeowners-generator@2.4.0 and permissions: read-all. Still uses actions/checkout@v4 while rest of repo uses v6 (flagged in prior review).
.codeowners-generatorrc Configuration for codeowners-generator tool. Outputs to .github/CODEOWNERS, collects from distributed CODEOWNERS files, excludes node_modules and the output file itself.
CODEOWNERS Root CODEOWNERS defining default reviewers (@savingoyal, @saikonen, @romain-intel) and .github/ directory owners.
metaflow/cmd/CODEOWNERS Assigns default cmd/ owners and specific owners for develop/ and code/ subdirectories.
metaflow/plugins/CODEOWNERS Assigns @talsperre, @savingoyal as owners of events_decorator.py specifically. Other files in plugins/ fall to the default catch-all.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Distributed CODEOWNERS files\n(34 files across repo)"] -->|"npx codeowners-generator generate"| B[".github/CODEOWNERS\n(auto-generated)"]
    C[".codeowners-generatorrc\n(config: output path, includes)"] -->|configures| B
    D["PR touches **/CODEOWNERS\nor .codeowners-generatorrc"] -->|triggers| E["codeowners.yml workflow"]
    E -->|"npx codeowners-generator@2.4.0\ngenerate --check"| F{"Generated file\nup to date?"}
    F -->|Yes| G["CI passes ✓"]
    F -->|No| H["CI fails ✗\n(developer must regenerate)"]
    B -->|"GitHub reads on PR"| I["Auto-assign reviewers\nbased on changed files"]
Loading

Last reviewed commit: 2b75d42

The previous commit manually adjusted formatting that didn't match
what codeowners-generator produces, causing --check to fail in CI.

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

greptile-apps bot commented Feb 22, 2026

Greptile Summary

This PR introduces a distributed CODEOWNERS system using codeowners-generator to automatically map repository components to their primary maintainers, enabling GitHub to auto-assign reviewers on PRs.

  • Adds 34 distributed CODEOWNERS files across the repository, each defining ownership for its directory based on git history analysis
  • Adds .codeowners-generatorrc config to aggregate distributed files into .github/CODEOWNERS
  • Adds a CI workflow (.github/workflows/codeowners.yml) that verifies the generated .github/CODEOWNERS stays in sync with the distributed source files on every PR that touches them
  • All referenced directories have been verified to exist in the repository
  • The generator version is pinned (codeowners-generator@2.4.0) and the workflow sets permissions: read-all, consistent with repo practices
  • The generated .github/CODEOWNERS is missing a trailing newline — this appears to be a codeowners-generator output behavior (tracked in previous review threads)

Confidence Score: 4/5

  • This PR is safe to merge — it only adds configuration files with no impact on application code or runtime behavior.
  • All 38 files are new CODEOWNERS or configuration files with no runtime code changes. All referenced directories were verified to exist. Previously reported issues (missing paths, unpinned version, missing permissions) have been addressed. The remaining minor inconsistency (actions/checkout@v4 vs v6 used elsewhere) was already flagged in prior review threads. Score is 4 rather than 5 due to the missing trailing newline in the generated file, which could theoretically cause tool compatibility issues.
  • .github/workflows/codeowners.yml uses actions/checkout@v4 while the rest of the repo uses v6 (already noted in previous review threads). .github/CODEOWNERS is missing a trailing newline (also previously noted).

Important Files Changed

Filename Overview
.github/CODEOWNERS Auto-generated CODEOWNERS file with ownership rules for all major directories. Missing trailing newline (known issue from generator). The /**/.github/ pattern is overly broad (matches at any depth) but functionally correct for this repo.
.github/workflows/codeowners.yml CI workflow to verify generated CODEOWNERS stays in sync. Uses pinned codeowners-generator@2.4.0 and permissions: read-all. Uses actions/checkout@v4 instead of v6 used elsewhere in the repo.
.codeowners-generatorrc Configuration for codeowners-generator. Outputs to .github/CODEOWNERS, collects from distributed CODEOWNERS files excluding .github/CODEOWNERS and node_modules.
CODEOWNERS Root CODEOWNERS defining default reviewers (core maintainers) for all files and specific reviewers for .github/ directory.
metaflow/cmd/CODEOWNERS Multi-rule file: default owners for cmd/, specific owners for develop/ and code/ subdirectories. All directories verified.
metaflow/plugins/CODEOWNERS Only assigns ownership for events_decorator.py. Other top-level plugin files fall through to root catch-all, which is intentional.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Distributed CODEOWNERS files\n(34 files across repo)"] -->|"aggregated by"| B[".codeowners-generatorrc\n(config)"]
    B -->|"generates"| C[".github/CODEOWNERS\n(GitHub-consumed file)"]
    C -->|"used by"| D["GitHub PR auto-reviewer\nassignment"]
    
    E["PR modifies any\nCODEOWNERS file"] -->|"triggers"| F[".github/workflows/codeowners.yml"]
    F -->|"runs"| G["npx codeowners-generator@2.4.0\ngenerate --check"]
    G -->|"verifies"| H{"Generated file\nin sync?"}
    H -->|"Yes"| I["CI passes"]
    H -->|"No"| J["CI fails —\nregeneration needed"]
Loading

Last reviewed commit: bf3ea34

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@npow
Copy link
Copy Markdown
Collaborator Author

npow commented Feb 22, 2026

Switched to distributed (colocated) CODEOWNERS files. Those will need to be updated when:

  1. a new module is added
  2. someone contributes significant code to an existing module

@npow npow requested a review from savingoyal February 22, 2026 18:10
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 22, 2026

Greptile Summary

This PR introduces a distributed CODEOWNERS system using codeowners-generator to auto-assign PR reviewers based on component ownership. Rather than maintaining a single monolithic CODEOWNERS file, ownership is defined in per-directory CODEOWNERS files (35 total) that are aggregated into .github/CODEOWNERS by the generator tool. A CI workflow validates the generated file stays in sync on PRs that touch any CODEOWNERS or config file.

  • 35 distributed CODEOWNERS files map repository components to 6 maintainers (@savingoyal, @saikonen, @romain-intel, @npow, @madhur-ob, @talsperre) plus @valayDave for airflow/cards/kubernetes plugins
  • CI validation workflow (.github/workflows/codeowners.yml) runs npx codeowners-generator@2.4.0 generate --check with permissions: read-all to verify the generated file matches the distributed sources
  • Root-level defaults ensure all files have at least three core maintainers as reviewers, with component-specific overrides for more targeted review assignment
  • Previous review feedback about missing trailing newline, non-existent directory paths, unpinned npx version, and workflow permissions has been addressed in follow-up commits

Confidence Score: 4/5

  • This PR is safe to merge — it only adds CODEOWNERS metadata and a read-only CI check with no impact on application code or behavior.
  • Score of 4 reflects that this is a configuration-only change with no runtime impact. All 35 source CODEOWNERS files map to verified existing directories. The CI workflow uses a pinned generator version and read-only permissions. Minor concerns: the actions/checkout@v6 tag is not SHA-pinned like some other workflows in the repo (e.g., test.yml uses @8e8c483db84b4bee98b60c0593521ed34d9990e8), which is a minor consistency gap but was already discussed in a previous review thread.
  • .github/workflows/codeowners.yml and .github/CODEOWNERS are the key files — the distributed per-directory CODEOWNERS files are all simple single-line ownership declarations.

Important Files Changed

Filename Overview
.github/CODEOWNERS Auto-generated CODEOWNERS file with 84 lines mapping 35 source CODEOWNERS files to consolidated ownership rules. All source files are correctly represented. Previous review flagged missing trailing newline and non-existent directory paths (already addressed in latest commits).
.github/workflows/codeowners.yml CI workflow that validates generated CODEOWNERS stays in sync. Runs npx codeowners-generator@2.4.0 generate --check on PRs touching CODEOWNERS or config files. Uses pinned generator version and permissions: read-all. Previous review suggestions for checkout version pinning and npx supply chain concerns were addressed.
.codeowners-generatorrc Configuration for codeowners-generator tool. Outputs to .github/CODEOWNERS, collects from all **/CODEOWNERS files excluding .github/CODEOWNERS and node_modules. Standard configuration.
CODEOWNERS Root-level CODEOWNERS defining default reviewers (@savingoyal, @saikonen, @romain-intel) for all files, with a specific override for .github/ directory. Clean and well-commented.
metaflow/cmd/CODEOWNERS Multi-rule file: default owners for cmd, plus specific owners for develop/ and code/ subdirectories. Both directories verified to exist.
metaflow/plugins/CODEOWNERS Assigns @talsperre and @savingoyal specifically for events_decorator.py. No wildcard — other files in plugins/ fall through to root default owners.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["PR touches **/CODEOWNERS or .codeowners-generatorrc"] --> B["CI: codeowners.yml triggered"]
    B --> C["actions/checkout@v6"]
    C --> D["npx codeowners-generator@2.4.0 generate --check"]
    D --> E{"Generated .github/CODEOWNERS matches?"}
    E -- Yes --> F["✅ Check passes"]
    E -- No --> G["❌ Check fails — developer must regenerate"]

    H["Developer edits per-directory CODEOWNERS"] --> I["Run: npx codeowners-generator generate"]
    I --> J[".github/CODEOWNERS regenerated"]
    J --> K["Commit both source + generated files"]

    subgraph "Distributed Sources (35 files)"
        S1["CODEOWNERS (root defaults)"]
        S2["devtools/CODEOWNERS"]
        S3["metaflow/*/CODEOWNERS"]
        S4["metaflow/plugins/*/CODEOWNERS"]
    end

    S1 & S2 & S3 & S4 --> I
Loading

Last reviewed commit: cf17985

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.

2 participants