Codecov Coverage Report Cache Invalidation Policy
24.5K reputation · 16 May 2021, 15:45 UTC
Ensuring Fresh Coverage Data After Build
The goal is to guarantee that a Codecov coverage badge or dashboard always reflects the latest coverage file uploaded for a given commit. In practice, the cache key is derived from the repository, branch, and commit hash, but the exact trigger for cache invalidation is not documented. This creates uncertainty for CI pipelines that rely on up‑to‑date coverage metrics.
When a commit is force‑pushed or a pull request is rebased, the commit hash may remain unchanged while the coverage report itself changes. Users have observed that the UI may still display the old badge, suggesting the cache is retained. Additionally, there is no documented time‑based expiration for cached reports, and the “Last updated” timestamp on the UI does not clarify whether it indicates a cache refresh or a new upload.
Given these gaps, the following specific questions remain unanswered:
- Does Codecov automatically invalidate a cached coverage report when the coverage file changes but the commit hash stays the same?
- Is there a time‑based expiration policy for cached reports, and if so, what is the duration?
- How does Codecov handle cache invalidation when a pull request is merged or rebased onto a new commit?