# Codecov not blocking PRs

**URL:** <https://community.codecov.com/t/codecov-not-blocking-prs/2893>\
**Category:** Support\
**Tags:** javascript, github\
**Created:** [May 20, 2021, 11:22am UTC](https://community.codecov.com/t/codecov-not-blocking-prs/2893 "2021-05-20T11:22:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![boris](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/boris/32/1868_2.png) [@boris](https://community.codecov.com/u/boris)\
**Post date:** [May 20, 2021, 11:22am UTC](https://community.codecov.com/t/codecov-not-blocking-prs/2893/1 "2021-05-20T11:22:46Z")

</div>

Relevant posts

> [@Threshold confusion](https://community.codecov.com/t/threshold-confusion/88):
>
> Description I only want a failing GitHub status check when a PR drops project coverage by more than 1%. I’ve set a threshold of “1” and also tried with “1%”, but neither seems to actually work, in this PR for example: [Changes to psort to show event counters as status by joachimmetz · Pull Request #2442 · log2timeline/plaso · GitHub](https://github.com/log2timeline/plaso/pull/2442) there’s a failing status even though coverage dropped by 0.02%. Any suggestions for how to get this behavior? Secondarily, is “1” or “1%” the correct way to speci…

> [@Thresholds not working](https://community.codecov.com/t/thresholds-not-working/2134):
>
> Please check the [troubleshooting guide](https://docs.codecov.io/docs/troubleshooting-guide) before creating a ticket. Description CI status is set failed even if coverage difference is within the threshold Repository CI/CD Github Uploader Github actions Commit SHAs 0a4975593bc4585b0c39eeecba8df533bfb2f827 Codecov YAML coverage: round: up range: "50...80" status: project: default: threshold: 5% framework: paths: - src/main/\*/com/framework money: paths: - src/main/\*/c…

```
coverage:

  status:

    default_rules:

      flag_coverage_not_uploaded_behavior: exclude

    project:

      default: off

      client:

        target: auto

        threshold: 0.1%

        flags:

          - client

      backend:

        target: auto

        threshold: 0.1%

        flags:

          - backend

flags:

  backend:

    paths:

      - server/

    carryforward: true

  client:

    paths:

      - client/

    carryforward: true

comment:

  layout: 'reach, diff, flags, files'

  behavior: new

  require_changes: false # if true: only post the comment if coverage changes

  require_base: no # [yes :: must have a base report to post]

  require_head: no

github_checks:

  annotations: true

```

### Description

codecov detects when coverage is dropped below the threshold but does not block a PR from being merged.

### CI/CD or Build URL

Github Actions

### Uploader

Bash.

### Expected Results

The required check to fail and the PR from being blocked from emerging.

### Actual Results

The client flag check is not started and the server flag is not available when setting branch protection rules.  
 ![firefox_w82vy9iG0D](https://canada1.discourse-cdn.com/flex029/uploads/codecov/optimized/2X/6/6f12bf26099e53596c184b253084a63845b01128_2_690x37.png)

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [May 20, 2021, 3:21pm UTC](https://community.codecov.com/t/codecov-not-blocking-prs/2893/2 "2021-05-20T15:21:25Z")

</div>

@boris please provide a commit SHA and/or links to the CI runs

---

<div class="post-metadata">

**Author:** ![boris](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/boris/32/1868_2.png) [@boris](https://community.codecov.com/u/boris)\
**Post date:** [May 20, 2021, 3:51pm UTC](https://community.codecov.com/t/codecov-not-blocking-prs/2893/3 "2021-05-20T15:51:31Z")

</div>

Hi Tom,

My repo is private so idk how a SHA will help you. I was about to send over logs from the CI run when I noticed they have an error message. The checkout’s fetch is already set to 0. Should I try changing the fetch depth?  
 ![image](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/f/f5bcbeb104416653a2e14c8681b583ce63d773c8.png)

---

<div class="post-metadata">

**Author:** ![boris](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/boris/32/1868_2.png) [@boris](https://community.codecov.com/u/boris)\
**Post date:** [May 20, 2021, 4:21pm UTC](https://community.codecov.com/t/codecov-not-blocking-prs/2893/4 "2021-05-20T16:21:05Z")

</div>

I played around with the fetch depth. No errors when running the codecov bash, but in a PR that ads 16k lines of code, it measure the coverage differance as 0%.

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/e/efad33a6043ab21520932572198d4a2e1aeb7f22.png)

```auto
Run cd ./client && bash <(curl -s https://codecov.io/bash) -t *** -c -F client

  _____ _
 / ____ | | |
| | _____ | | ______  _______
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |__/ (_| (_) \ V /
 \ _____\___ / \ __,_|\___ |\ ___\___ / \_/
                              Bash-1.0.2

==> git version 2.31.1 found
==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
==> GitHub Actions detected.
    Env vars used:
      -> GITHUB_ACTIONS: true
      -> GITHUB_HEAD_REF: covtest
      -> GITHUB_REF: refs/pull/1732/merge
      -> GITHUB_REPOSITORY: remo-co/remo-conference
      -> GITHUB_RUN_ID: 861056289
      -> GITHUB_SHA: f5d3449843c53f2795ec4b8fd73683e94e4e4c6d
      -> GITHUB_WORKFLOW: Run Tests
    Fixing merge commit SHA f5d3449843c53f2795ec4b8fd73683e94e4e4c6d -> d263fd2d9072d15c62d5d6b78f8535c39346aa6f
    project root: /home/runner/work/remo-conference/remo-conference
    Yaml found at: codecov.yml
==> Running gcov in /home/runner/work/remo-conference/remo-conference (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
    + /home/runner/work/remo-conference/remo-conference
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + /home/runner/work/remo-conference/remo-conference/coverage/coverage-final.json bytes=2679020
==> Appending adjustments
    https://docs.codecov.io/docs/fixing-reports
    + Found adjustments
==> Gzipping contents
        348K	/tmp/codecov.PcxwCR.gz
==> Uploading reports
    url: https://codecov.io
    query: branch=covtest&commit=d263fd2d9072d15c62d5d6b78f8535c39346aa6f&build=861056289&build_url=http%3A%2F%2Fgithub.com%2Fremo-co%2Fremo-conference%2Factions%2Fruns%2F861056289&name=&tag=&slug=remo-co%2Fremo-conference&service=github-actions&flags=client&pr=1732&job=Run%20Tests&cmd_args=t,c,F
-> Pinging Codecov
https://codecov.io/upload/v4?package=bash-1.0.2&token=secret&branch=covtest&commit=d263fd2d9072d15c62d5d6b78f8535c39346aa6f&build=861056289&build_url=http%3A%2F%2Fgithub.com%2Fremo-co%2Fremo-conference%2Factions%2Fruns%2F861056289&name=&tag=&slug=remo-co%2Fremo-conference&service=github-actions&flags=client&pr=1732&job=Run%20Tests&cmd_args=t,c,F
-> Uploading to
https://storage.googleapis.com/codecov/v4/raw/2021-05-20/7322BE1301D351472BD266A98261C4C5/d263fd2d9072d15c62d5d6b78f8535c39346aa6f/30175029-ca0b-4365-b092-a03941a90ce3.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EQM3VGPYSAFECJRMNAFIPCV2R3P2BOORCJC7NM537NPJQSFLHUDNIDWA%2F20210520%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20210520T161757Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=fc51ace540fb546340bd0c23bdc4f6769959d402d636bef7500827a12525c864
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed

  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 347k 0 0 100 347k 0 1465k --:--:-- --:--:-- --:--:-- 1465k
    -> Reports have been successfully queued for processing at https://codecov.io/github/remo-co/remo-conference/commit/d263fd2d9072d15c62d5d6b78f8535c39346aa6f

```

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [May 24, 2021, 5:36pm UTC](https://community.codecov.com/t/codecov-not-blocking-prs/2893/5 "2021-05-24T17:36:20Z")

</div>

@boris the latest commit SHA (in the uploader text) looks like it was deleted (rebased/merged perhaps?). Do you have another example of this?

---

<div class="post-metadata">

**Author:** ![boris](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/boris/32/1868_2.png) [@boris](https://community.codecov.com/u/boris)\
**Post date:** [May 24, 2021, 5:54pm UTC](https://community.codecov.com/t/codecov-not-blocking-prs/2893/6 "2021-05-24T17:54:18Z")

</div>

@tom I was able to narrow down the source of this problem further. The incorrect calculations were caused by jest being misconfigured. PRs are now blocked if the coverage drops in my `client` project. However I’m still having issues with the `server` projects. I’m unable to add it as a required check in the PR. The client is available (and I’ve already added it), but `server` is not.

What is `patch` and why is `codecov/project/server` missing?

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/b/b4a2d8c86c475edf5259d7bdbe43434c4ac50187.png)

My codecov.yml

```auto
coverage:
  status:
    default_rules:
      flag_coverage_not_uploaded_behavior: exclude
    project:
      default: off
      client:
        target: auto
        threshold: 0.1%
        flags:
          - client
      backend:
        target: auto
        threshold: 0.1%
        flags:
          - backend

flags:
  backend:
    paths:
      - server/
    carryforward: true

  client:
    paths:
      - client/
    carryforward: true

comment:
  layout: 'reach, diff, flags, files'
  behavior: new
  require_changes: false # if true: only post the comment if coverage changes
  require_base: no # [yes :: must have a base report to post]
  require_head: no

github_checks:
  annotations: true

```

The logs from the bash uploader on a PR where coverage for the `server` project is uploaded. In this commit, there’s a 30% drop in coverage.

```auto
==> git version 2.31.1 found
==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
==> GitHub Actions detected.
    Env vars used:
      -> GITHUB_ACTIONS: true
      -> GITHUB_HEAD_REF: del-tests
      -> GITHUB_REF: refs/pull/1744/merge
      -> GITHUB_REPOSITORY: remo-co/remo-conference
      -> GITHUB_RUN_ID: 872211434
      -> GITHUB_SHA: 869fa3d9cdb0ae9c3b836e363d6af239139fbefd
      -> GITHUB_WORKFLOW: Run Tests
    Fixing merge commit SHA 869fa3d9cdb0ae9c3b836e363d6af239139fbefd -> 34fef86e49c852258c1f1933e766c960908a89c2
    project root: /home/runner/work/remo-conference/remo-conference
    Yaml found at: codecov.yml
==> Running gcov in /home/runner/work/remo-conference/remo-conference (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
    + /home/runner/work/remo-conference/remo-conference
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + /home/runner/work/remo-conference/remo-conference/coverage/coverage-final.json bytes=1137592
==> Appending adjustments
    https://docs.codecov.io/docs/fixing-reports
    + Found adjustments
==> Gzipping contents
        148K	/tmp/codecov.Et74tO.gz
==> Uploading reports
    url: https://codecov.io
    query: branch=del-tests&commit=34fef86e49c852258c1f1933e766c960908a89c2&build=872211434&build_url=http%3A%2F%2Fgithub.com%2Fremo-co%2Fremo-conference%2Factions%2Fruns%2F872211434&name=&tag=&slug=remo-co%2Fremo-conference&service=github-actions&flags=server&pr=1744&job=Run%20Tests&cmd_args=t,c,F
-> Pinging Codecov
https://codecov.io/upload/v4?package=bash-1.0.3&token=secret&branch=del-tests&commit=34fef86e49c852258c1f1933e766c960908a89c2&build=872211434&build_url=http%3A%2F%2Fgithub.com%2Fremo-co%2Fremo-conference%2Factions%2Fruns%2F872211434&name=&tag=&slug=remo-co%2Fremo-conference&service=github-actions&flags=server&pr=1744&job=Run%20Tests&cmd_args=t,c,F
-> Uploading to
https://storage.googleapis.com/codecov/v4/raw/2021-05-24/7322BE1301D351472BD266A98261C4C5/34fef86e49c852258c1f1933e766c960908a89c2/b2deea6e-10e5-4304-a62d-5559d1052e29.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EQM3VGPYSAFECJRMNAFIPCV2R3P2BOORCJC7NM537NPJQSFLHUDNIDWA%2F20210524%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20210524T174830Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=82b6a219b6a4d4409fb37f73f2059786c9325459c20f5fbbf1e280a989a4292a
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed

  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 145k 0 0 100 145k 0 478k --:--:-- --:--:-- --:--:-- 478k
    -> Reports have been successfully queued for processing at https://codecov.io/github/remo-co/remo-conference/commit/34fef86e49c852258c1f1933e766c960908a89c2
0

```

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [May 25, 2021, 7:27pm UTC](https://community.codecov.com/t/codecov-not-blocking-prs/2893/7 "2021-05-25T19:27:12Z")

</div>

@boris, have you uploaded a coverage report with the `backend` (I think you meant `backend`, there is no `server` status in your yaml) flag? If that has never happened, it might explain why GitHub is unaware of the status check.

The `patch` check deals with coverage on new code changes detailed [here](https://docs.codecov.io/docs/commit-status#patch-status) (as opposed to `project` which is meant to encompass the entire repository).

---

<div class="post-metadata">

**Author:** ![boris](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/boris/32/1868_2.png) [@boris](https://community.codecov.com/u/boris)\
**Post date:** [May 26, 2021, 1:50pm UTC](https://community.codecov.com/t/codecov-not-blocking-prs/2893/8 "2021-05-26T13:50:25Z")

</div>

It was starting me in the face and I still didn’t see it. Once I renamed the flag from `backend` to `server` everything started working correctly. Thank you Tom!
