# Summary It appears that in the newest version of the gem, newly created team configurations aren't being considered when calling the gem via CLI or programatically. This is at least occurring in apps with partial ownership setup like the one defined below. Unfortunately, I've only been able to reproduce this when running `validate` within an existing app. I haven't been able to reproduce it in the specs for the `code_ownership` gem itself. The reproduction steps listed below cause failures for existing Rails apps already using code ownership and new apps that add code ownership when using v2.1.0. # Reproduction With codeowners already setup with some ownership across the app, adding new team configurations results in new calls to validate to fail. ## Existing Rails app For example, setup a Rails app with ownership defined for a few files but not all files (e.g. `Gemfile`) and validate the app. It should validate correctly and generate `CODEOWNERS`. It should validate correctly with both the CLI (`bin/code_ownership validate`) and programmatically (`CodeOwnership.validate!`). Then add new files to `config/codeownership.yml`, add a new team config to own those files, and validate again. It should fail with an error that the newly declared files are unowned. This is occurring in an app with the most recent version of the gem (v2.1.0). When downgrading to a version before 2, it results in no error as expected (e.g. v1.39.0). ## New Rails app I also tested the below configuration changes in a brand new rails app: 1. Create a new Rails app via CLI: `rails new app_name`. 2. Commit everything as the first commit. 3. Add `code_ownership` to the `Gemfile`, `bundle install`, and generate binstubs for code ownership (`bundle binstubs code_ownership`). 4. Add the "existing configuration" as defined below for the `codeownership.yml` and the `gem_changes.yml`. 5. Run `bin/codeownership validate`. Observe that the validate immediately fails. ## Example existing configuration `config/codeownership.yml`: ```yml owned_globs: - Gemfile - Gemfile.lock js_package_paths: [] codeowners_path: .github ``` `config/teams/gem_changes.yml`: ```yml name: Gem Changes owned_globs: - Gemfile - Gemfile.lock github: team: "@jibarra" ``` Generated `CODEOWNERS`: ``` # STOP! - DO NOT EDIT THIS FILE MANUALLY # This file was automatically generated by "bin/codeownership validate". # # CODEOWNERS is used for GitHub to suggest code/file owners to various GitHub # teams. This is useful when developers create Pull Requests since the # code/file owner is notified. Reference GitHub docs for more details: # https://help.github.com/en/articles/about-code-owners # Team-specific owned globs /Gemfile @jibarra /Gemfile.lock @jibarra # Team YML ownership /config/teams/gem_changes.yml @jibarra ``` ## Example new team configuration `config/codeownership.yml`: ```yml owned_globs: - Gemfile - Gemfile.lock - README.md js_package_paths: [] codeowners_path: .github ``` `config/teams/docs.yml`: ```yml name: Docs owned_globs: - README.md github: team: "@jibarra" ```