Expand Cache.hs test coverage for cache path, write, and staleness semantics - #22
Conversation
Co-authored-by: iustin <550045+iustin@users.noreply.github.com>
|
@copilot see the CI failure. |
Co-authored-by: iustin <550045+iustin@users.noreply.github.com>
I checked the failing run and fixed it in commit |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #22 +/- ##
==========================================
+ Coverage 55.12% 55.47% +0.35%
==========================================
Files 61 61
Lines 6384 6437 +53
Branches 406 411 +5
==========================================
+ Hits 3519 3571 +52
+ Misses 2462 2455 -7
- Partials 403 411 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@copilot - I don't think the threadDelay approach is a good one. Can you switch to explicitly setting mtime on the file in the past, instead? |
Co-authored-by: iustin <550045+iustin@users.noreply.github.com>
Updated in commit |
There was a problem hiding this comment.
🟢 Approval recommended
The added tests align with the current Cache.hs behavior and improve coverage of key cache IO and freshness decision paths without introducing correctness risks.
Pull request overview
This PR expands the Haskell backend test suite’s coverage around Cache.hs behavior by adding focused unit tests that exercise cache path construction, cache writes, and the staleness/validation decision paths used by readCacheFile.
Changes:
- Added a unit test for
cachedBasenamepath construction. - Added coverage for
writeCacheFileensuring parent directories are created and written bytes match expectations. - Added a set of tests covering
readCacheFilebehavior for cache misses, validation-disabled reads, and validation-enabled freshness checks against source and extra dependencies.
File summaries
| File | Description |
|---|---|
| test/CacheSpec.hs | Adds new specs for cachedBasename, writeCacheFile, and readCacheFile validation/staleness semantics. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Cache.hshad limited coverage (~40%), with most behavior around cache IO and freshness validation untested. This adds focused tests for the public cache API and staleness checks to exercise the core decision paths.Coverage expansion: cache path + IO primitives
cachedBasenamepath construction.writeCacheFileensuring parent directories are created and bytes are written to the expected target.Coverage expansion:
readCacheFiledecision matrixNothingon absent cache file).