feedback icon indicating copy to clipboard operation
feedback copied to clipboard

[Self-hosted] Flags filtering is broken in the Tree view/Code tree/File list, when flag_regexes is added in component_management

Open nikosatwork opened this issue 1 year ago • 12 comments

Describe the bug [Self-hosted] Flags filtering is broken in the Tree view/Code tree/File list, when flag_regexes is added in component_management entries

Environment (please complete the following information):

  • Browser: All
  • System: CI, UI
  • Version: 25.1.16, 25.1.3, 25.3.3

To Reproduce Steps to reproduce the behavior:

  1. Setup a component(s) in component_management in codecov.yml, using both paths and flag_regexes, or just flag_regexes
  2. Upload a new report that targets the component, as expected
  3. Having selected the component in the Codecov dashboard > in Tree view, the coverage percentage is correct, based on the flag_regex and path ~union~ intersection.
  4. Still in the Tree view and having selected any flag in the Flags dropdown, the coverage percentage is wrong, and represents the total coverage, regardless the Component filter.

Expected behavior Having selected a flag in the Flags dropdown, the coverage percentage is calculated based on the ~union~ intersection of the path and flag_regex in component_management, or just the flag_regex when the path is not specified, and the flag(s) selected.

nikosatwork avatar Jan 20 '25 12:01 nikosatwork

Hi team. Have you had a chance to look at this issue? Thanks.

nikosatwork avatar Mar 10 '25 11:03 nikosatwork

Hi @nikosatwork! Thanks for the bug report and sorry for the delay in getting back to you on this. I've added the bug label and this should get assigned for an upcoming sprint.

spalmurray-codecov avatar Mar 10 '25 15:03 spalmurray-codecov

This actually looks like a duplicate of this: https://github.com/codecov/engineering-team/issues/2765

I will follow up with the relevant folks about the status here.

spalmurray-codecov avatar Mar 10 '25 15:03 spalmurray-codecov

Thank you @spalmurray-codecov. I am not sure how the issue you linked above is related. Could you please explain in case I missed the connection?

nikosatwork avatar Mar 10 '25 22:03 nikosatwork

Np @nikosatwork! Given the context in the other issue, I'm lead to believe your issue is also caused by us not supporting file coverage filtered by flag. I don't think the component is relevant. To confirm this I'd think that, after your steps to reproduce, when you deselect the component and have only flags selected, the coverage shown does not change. (You may have actually tested this already if I'm reading what you've said correctly)

Please let me know if you think I'm misunderstanding the problem here!

spalmurray-codecov avatar Mar 10 '25 22:03 spalmurray-codecov

That is not the case. After my repro steps, deselecting the component works as expected i.e. the results are filtered correctly by just the selected flag.

For some context this is the component in codecov.yml:

Image

And this is the behavior in Codecov:

Image

Note: I have opened another ticket which is relevant too, in case it helps with reproducing on your side -> https://github.com/codecov/feedback/issues/629

nikosatwork avatar Mar 11 '25 09:03 nikosatwork

Ahh okay you're right this is different. I thought you were saying the coverage numbers were wrong, not that the actual files shown are wrong. Thanks for correcting me and providing an example, this helps a lot!

spalmurray-codecov avatar Mar 11 '25 12:03 spalmurray-codecov

I thought you were saying the coverage numbers were wrong

The numbers are wrong.

In the example above when just the Asteroid Controller component is selected the coverage for AsteroidController.cs is 100% which is correct, based on the component setup in codecov.yml.

When the CameraTests flag is selected while the Asteroid Controller component is selected the coverage for AsteroidController.cs is still 100%, which is wrong, as the CameraTests flag contributes 0% coverage to the file, therefore the coverage should have been 0%.

the actual files shown are wrong

The files shown are correct, as when you deselect the Asteroid Controller component leaving just the CameraTests flag selected, the Tree view/Code tree/File list result is not limited/filtered to the path in the component setup in codecov.yml. Therefore, the files shown are all the files that have been inlcuded in the upload with the CameraTests flag.

nikosatwork avatar Mar 11 '25 18:03 nikosatwork

I was under the impression your expected behavior is that we show the union of everything selected. Is this accurate? In you previous message it sounds like you might actually be looking for the intersection of the flag and component.

The union of everything selected would mean showing all covered lines captured by the component and all covered lines captured by the flag.

The intersection would mean showing only covered lines captured by the flag that are also captured by the component.

I think I could make in argument in favor of either tbh. Let me know what you think @nikosatwork

edit: I did have the thought that the current behavior for selecting multiple flags or multiple components is to union, so it may make sense to carry that logic over to this case also.

spalmurray-codecov avatar Mar 11 '25 18:03 spalmurray-codecov

My bad @spalmurray-codecov - I used union instead of intersection, but I meant intersection

nikosatwork avatar Mar 11 '25 19:03 nikosatwork

Got it, apologies for any confusion!

If we're talking about the intersection, I believe this is what the code is trying do to based on the files shown being correct, but we just don't support breaking down line coverage by flag today (this is the ask in https://github.com/codecov/engineering-team/issues/2765).

For example, say lines 1-5 are covered by flagA and lines 3-8 are covered by flagB. My understanding is that we don't currently have the ability to tell you that lines 3-5 are covered by both flags.

Selecting multiple flags (union) doesn't work today for this reason also.

Whether it's union or intersection, it seems like we need to solve 2765 first, which is good to know!

Thinking out loud, you might be able to compute the values you're looking for now if you get creative with our public API

spalmurray-codecov avatar Mar 11 '25 19:03 spalmurray-codecov

Hi @spalmurray @thomasrockhu-codecov. Could you please provide an update on the status of this ticket? I could provide additional details if required. Thank you!

nikosatwork avatar Nov 12 '25 17:11 nikosatwork