New directory not picked up, files moved into it classed as removed?

Description

Recently I moved a bunch of files in my project into a new directory. For some reason that new directory isn’t showing up on CodeCov and instead all the files moved into it are classed by you as removed from the project.

When I run rspec locally, the HTML reports generated by SimpleCov do include the new directory and the files in it.

My path to CodeCov is push to GitHub, GitHub notifies CircleCI, CircleCI pull and run my tests and then push results to you (I think!) - and I have your GitHub integration enabled so you can comment on PRs etc. I’ll add links to config files where they exist, but mostly I think it’s default settings hooked up via web UIs.

I am perfectly willing to hear that I’ve done something weird here that’s caused this, but at this point I don’t know what else to check :slightly_smiling_face:

Commit SHAs

Here’s the PR that merged moving those files into the new directory:

As you can see in the comments there, I noticed the glitch at the time and did a little investigation. It looked like merging the same feature branch into a fresh fork of main didn’t have the same issue, so I was hoping that the PR report was a caching glitch of some sort, and went ahead with the main merge - sadly with the reported results.

(Sidenote: I’ve subsequently looked back at that test branch and it looks like it did have the same problem after all - unless your system would have updated its stats after the merge to main? - so I probably misread something there)

I’ve made quite a few changes to main since merging this PR, many relating to the moved files (and to unmoved files that you do still see and that depend on the moved files), and whatever is going on hasn’t sorted itself out - the project is still 10% smaller according to you, due to those ‘missing’ files.

Here’s your page for that PR:

Nothing of use there, I don’t think - I wasn’t pushing to GitHub in the early stages of this change, just working locally, so the interesting stuff all happened in ‘contextual commits’ from your point of view.

The base commit for the merge shows 5092 tracked lines, the first push of that branch to GitHub shows 4,528 lines, so I guess that’s where this all happened, rather than when merging the PR - the latter is just when I noticed it.

(I’m having to post this report in pieces, due to the limitation on new users posting more than 10 links)

Repository

CI/CD or Build URL

https://app.circleci.com/pipelines/github/denny/ShinyCMS-ruby

Uploader

I’m sorry, I don’t actually know how this bit works. I think it’s handled between CircleCI and yourselves without my directly configuring much (beyond ticking boxes and adding ENV vars, maybe).

Codecov Output

Coverage report generated to /home/circleci/ShinyCMS/coverage/codecov-result.json.
{"app/controllers/application_controller.rb"=>[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 1], "app/controllers/main_controller.rb"=>[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ...

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _\`|/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                               Ruby-0.5.1
==> Circle CI detected
==> Gzipping contents
==> Uploading reports
    url:   https://codecov.io
    query: token=secret&flags&package=ruby-0.5.1&service=circleci&build=7088&job=0&slug=denny%2FShinyCMS-ruby&pr&branch=test%2Fcodecov%2Fmerge-packwerk-into-main&commit=4925497985068c0258faf34c768930d3ffc99002
->  Pinging Codecov
https://codecov.io/upload/v4?token=secret&flags&package=ruby-0.5.1&service=circleci&build=7088&job=0&slug=denny%2FShinyCMS-ruby&pr&branch=test%2Fcodecov%2Fmerge-packwerk-into-main&commit=4925497985068c0258faf34c768930d3ffc99002
->  Uploading to
https://storage.googleapis.com/codecov/v4/raw/2021-04-06/0CBB4EDF4ABAE8FC111FC8CFC8DAB09D/4925497985068c0258faf34c768930d3ffc99002/241fb0c7-cb72-4cf7-95a5-52d59cd442a2.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOO[snip]DWA%2F20210406%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20210406T234811Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=[snip]
    View reports at https://codecov.io/github/denny/ShinyCMS-ruby/commit/4925497985068c0258faf34c768930d3ffc99002
JSON Coverage report generated for RSpec to /home/circleci/ShinyCMS/coverage.         4157 / 5185 LOC (80.17%) covered.
CircleCI received exit code 0

Expected Results

Please provide what you expect to have happened (e.g. a file that has missing coverage on a particular line).

I expected to see coverage data for the following new directories and the files that I moved into or created in them:

Actual Results

These directories do not appear in my CodeCov coverage data. (I think they’re the only thing that’s missing, but I haven’t dug into that.)

Additional Information

.circleci/config.yml

I don’t have a codecov.yml, and I don’t think I’ve ticked anything spectacularly unusual on your site :slight_smile:

The PR I was merging was adding Packwerk, which does have some config relating to autoload paths and similar - but given that the tests work and that the simplecov reports show the files in question, I don’t think that’s relevant? Let me know if you disagree and I can post links to Packwerk config (or you can look at everything in the repo yourself obviously; it’s a public, open source project).

(Sorry about the duplicate/triplicate posts - I’ll clean them up when I’m allowed) (I’m now blocked from deleting things because I’ve done it too often, this is all getting very meta)

I may have thought of an angle for investigation though - do you ignore /public in your default settings for Ruby/Rails projects, and if so, do you do it in a way that might be catching my app/public directories too? **public/ or something like that?

app/public/ is the default location for public interface files in a project using Packwerk, so that might be worth reconsidering if you are currently ignoring it (although I dread to think how many people could be relying on that behaviour, if you are).

If that is the problem, I assume my best solution is to add a codecov.yml that doesn’t ignore my app/public directories?

@denny sorry for taking so long to get back to you about this. I tracked down the issue and am working on a fix. Basically, this line prevents files with public/ as you suggested. I’m going to make a PR to remove it.

1 Like

@denny I released codecov==0.5.2 which should fix your issue. Let me know if that doesn’t!