Skip to content

codeownership validate --diff not respecting owned_globs #147

Closed

Description

@kendix

I recently noticed that my calls to codeownership validate --diff had started to fail for files that were not specifically included in the owned_globs part of our code_ownership.config file.

I first verified that when running just codeownership validate without --diff that the validation was still succeeding (which it was).

Then I verified that adding the extension of the file I was expecting to not fail validation to my owned_globs did cause it to fail.

Additionally, I verified that specifically excluding the file path in unowned_globs did not allow the --diff command to succeed.

Then I decided to figure out the last version that the --diff command was running successfully for my setup.

I determined that the change occurred in the 2.0.0.5 release and has been an issue since.

The specific error that occurs in the validate command is:

% bin/codeownership validate --diff
.local/share/mise/installs/ruby/3.4.6/lib/ruby/gems/3.4.0/gems/code_ownership-2.0.0.pre.5-arm64-darwin/lib/code_ownership.rb:236:in 'RustCodeOwners.generate_and_validate': Unowned files detected: (RuntimeError)

I suspect that for some reason the --diff command is somehow ignoring the config file.

Activity

  1. dduugg commented on Sep 25, 2026

    @dduugg
    Contributor

    This is fixed as of code_ownership 2.1.2 (released 2026-04-17), which picked up codeowners-rs v0.3.2 and with it rubyatscale/codeowners-rs#89, "Fix validate to respect owned_globs when files specified."

    I reproduced your setup — owned_globs: ['app/**/*.rb'], with a file outside that glob (script/deploy.rb) staged — and ran codeownership validate --diff against each release:

    version result
    2.0.0.pre.5 Unowned files detected: script/deploy.rb
    2.1.1 Unowned files detected
    2.1.2 passes
    2.1.4 (latest) passes

    As a control, an unowned file inside owned_globs still fails --diff on 2.1.4, so staged files are genuinely being validated — out-of-glob files are just correctly ignored now.

    Upgrading to 2.1.2 or later should resolve it. Closing, but please reopen if you still see it on a current version.

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

    triageA new issue that needs review by the core team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions