Skip to content

# file:has.owner() rule does not respect CODEOWNERS precedence #1396

@chmoncada

Description

@chmoncada

Description

When creating a dashboard in our repo and using a rule like

file:has.owner(Glovo/growth-martech-ios)

I’m seeing files being reported under this owner even though they should belong to a different one according to the CODEOWNERS configuration.

Here’s a simplified excerpt from our CODEOWNERS file:

/GlovoCustomer/Classes/AppServices/Services/IncomingActionsService/    @Glovo/growth-martech-ios @Glovo/growth-ios
/GlovoCustomer/Classes/AppServices/Services/IncomingActionsService/Adjust/    @Glovo/growth-martech-ios @Glovo/growth-ios
/GlovoCustomer/Classes/AppServices/Services/IncomingActionsService/IncomingActions/Deeplinks/Donations    @Glovo/spike-ios
/GlovoCustomer/Classes/AppServices/Services/IncomingActionsService/IncomingActions/Deeplinks/LegacyPromotionAppliedAlertView    @Glovo/growth-discounts-experience-ios @Glovo/growth-ios
/GlovoCustomer/Classes/AppServices/Services/IncomingActionsService/IncomingActions/Deeplinks/PromotionAppliedAlertView    @Glovo/growth-discounts-experience-ios @Glovo/growth-ios
/GlovoCustomer/Classes/AppServices/Services/IncomingActionsService/IncomingActions/Deeplinks/Social    @Glovo/trex-ios @Glovo/ordering-ios
/GlovoCustomer/Classes/AppServices/Services/IncomingActionsService/IncomingActions/Notifications/OrderNotificationHandlers    @Glovo/contact-ios
/GlovoCustomer/Classes/AppServices/Services/IncomingActionsService/IncomingActions/Notifications/Prime    @Glovo/growth-loyalty-ios @Glovo/growth-ios

As shown above, the parent folder (IncomingActionsService/) is assigned to @Glovo/growth-martech-ios, but the subfolder PromotionAppliedAlertView is explicitly assigned to @Glovo/growth-discounts-experience-ios.

However, in the dashboard results, the file

/GlovoCustomer/Classes/AppServices/Services/IncomingActionsService/IncomingActions/Deeplinks/PromotionAppliedAlertView/PromotionAppliedAlertViewController.swift

is being reported as owned by @Glovo/growth-martech-ios instead of @Glovo/growth-discounts-experience-ios.

According to the documentation, "Rules farther down the file take precedence", so the ownership should be inherited from the more specific rule — in this case, PromotionAppliedAlertView.
It seems that Sourcegraph is ignoring this precedence rule when evaluating CODEOWNERS for dashboards or the file:has.owner() filter.


Steps to reproduce

  1. Create a dashboard using:
    file:has.owner(Glovo/growth-martech-ios)
  2. Include a CODEOWNERS file where a parent directory is owned by team A and a subdirectory by team B
  3. Observe that files under the subdirectory are reported as owned by team A instead of team B

Expected behavior

Files should be attributed to the most specific matching rule, consistent with GitHub’s CODEOWNERS precedence rules.


Actual behavior

Files under more specific paths are incorrectly reported as belonging to a higher-level owner.


Environment

  • Sourcegraph version: 6.9.902
  • Repository: Private internal repository
  • Query used: file:has.owner(Glovo/growth-martech-ios)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions