Using <https://github.com/rubyatscale/code_ownership> for performance improvements without generating CODEOWNERS file?

This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.

Quick question: is anyone using https://github.com/rubyatscale/code_ownership and not using it to generate your .github/CODEOWNERS file? I’m looking into some performance improvements that should speed up some CLI commands by 10x, but it’d require using the tool to generate your CODEOWNERS file.

Message originally sent by slack user U71UHPKPZS4

I have a PR up for this right now where we’ve set skip_codeowners_validation: true in config/code_ownership.yml but were going to run bin/codeownership validate --skip-autocorrect --skip-stage in CI. We eventually want to auto gen but have a CODEOWNERS in root we want to port owned_globs to config/teams/<TEAM>.yml first.

Message originally sent by slack user U70I61FD0VD

We are. We’re using it to identify owners to tag logs/exceptions, but we’re still allowing any team to review MRs (so not using the CODEOWNERS part of code_ownership)

<@U71UHPKPZS4> Unfortunately we’ve overloaded the term owned_globs (I’d like to rename the one in config/code_ownership.yml). Are you referring to owned_globs in config/code_ownership.yml (used to specify which files are validated for ownership) or owned_globs in team YML files (used to specify what globs that team owns)

<@U70I61FD0VD> – Is your current CODEOWNERS file is currently carefully maintained and you don’t want to have it be updated with possibly incomplete ownership information from code_ownership? Or do you not want to require reviews from specific folks (note requiring review from codeowners can be turned off in github)?

Message originally sent by slack user U71UHPKPZS4

sorry, owned_globs in the team YMLs. I’ve been going back and forth between scripting that conversion in this PR but wanted to keep things small.

Thanks for clarifying. What do you mean when you say porting owned globs to team YML files? Will that make it easier for you to adopt codeowners file generation? (Just trying to better understand use cases.)

Message originally sent by slack user U71UHPKPZS4

Exactly. Also using it as a stepping stone to having a team owner listed in package.yml files. We’re just embarking on our modularization journey so everything is :spaghetti:.

Message originally sent by slack user U70I61FD0VD

The former, our current CODEOWNERS file is carefully maintained, we have some specific files locked to specific teams (for example, schema.rb is required to be reviewed by our data team). Generically, unless a file is explicitly listed in CODEOWNERS, we allow anyone on the team to review it. If it helps any, we’re really only using ownership at the packs level

Can you tell me how long time bin/codeownership validate takes for you? The change I’m making involves memoizing results of code ownership up front during app initialization (rather than doing it incrementally each time we check ownership for a file). We can keep the same behavior for the mappers but I’m concerned it’ll slow down app boot for users not using the codeowners file. Another option is to cache the result from the mappers into a git ignored file tmp/cache/codeownership so it doesn’t affect local dev for users.

Message originally sent by slack user U71UHPKPZS4

Since we don’t have much setup yet, everything is relatively quick:

$ time bin/codeownership validate
Fetching gem metadata from <https://rubygems.org/>..
Resolving dependencies...
Using bundler 2.3.12
Using sorbet-runtime 0.5.10746
Using packs 0.0.6
Using code_teams 1.0.1
Using code_ownership 1.32.2

real    0m2.014s
user    0m1.114s
sys     0m0.476s 

Message originally sent by slack user U70I61FD0VD

Not sure if you wanted timing from me too or not, but here it is:

time bin/codeownership validate

real	1.305
user	0.904
sys	0.304