Diagnosing Codeac Incremental Cache Misses and Stale Analysis Results
When Codeac rebuilds unchanged modules or returns stale analysis, check cache keys, timestamps, and hermeticity before clearing the cache.
15 Apr 2026, 05:59 UTC

The problem you are seeing
Codeac runs that should be fast are rebuilding unchanged modules, or analysis results look out of date after a dependency change. The useful takeaway is that incremental compilation in Codeac is only reliable when cache keys, timestamps, and build graph hermeticity are consistent. When they drift, you get either wasted rebuilds from cache misses or silent staleness from cache hits on invalid artifacts.
Recognizable conditions
- Incremental run duration is close to a clean run despite no source edits.
- Build logs show repeated cache miss messages for files you did not change.
- Analysis reports reference old symbols after a header or config file was edited.
- Disk usage for the Codeac cache grows quickly in a monorepo with little change in source.
Cause and diagnostic table
| Symptom | Likely cause | First check |
|---|---|---|
| Cache miss on unchanged files | Cache key includes non-hermetic input such as absolute timestamps or environment variables | Cache key inputs for the target | Cache hit but output is stale | Build graph mutation without invalidation, e.g., new dependency not captured | Dependency list vs actual includes | Intermittent misses under parallel builds | Race on cache writes or memory pressure causing eviction | Parallel job count and cache write errors | Cache grows without bound | Retention policy missing, or content hash changes on every run | Cache size and key stability |
Ordered checks
1. Confirm baseline behavior
Run a clean build, then run an incremental build with no source changes. Compare total duration and look for cache hit/miss messages in the Codeac output logs. This establishes whether incremental reuse is working at all.
Run location: project root where Codeac is configured. Permissions: read access to source and cache directory, write access to cache if you intend to update it. Risk: clean build consumes time and resources.
2. Inspect cache key inputs
Incremental compilation reuses previously compiled artifacts when the cache key is stable. Typical key inputs are file path, modification timestamp, and content hash. Check that the key does not include volatile data such as build timestamps or absolute paths that change between machines.
Look for configuration that defines key components. If the project uses a hermeticity setting, verify it is enabled for the relevant targets.
3. Verify dependency capture
Stale cache entries can cause incorrect outputs if the build graph is mutated without cache invalidation. List the declared dependencies for a suspect target and compare with actual includes or imports used during compilation.
Use a hash comparison tool to verify that a cached artifact content matches the expected compiled output for a known source revision. Do not assume the artifact is correct because the cache reported a hit.
4. Check timestamps and file system behavior
Non-hermetic builds can be sensitive to modification times. Ensure source control checkouts preserve timestamps or that Codeac is configured to prefer content hash over mtime. Watch for tools that touch files during formatting or IDE saves.
5. Review parallel and resource limits
Parallel incremental builds can decrease compile latency but may increase memory pressure and cause cache write contention. Reduce parallelism temporarily and observe hit rate stability.
Fixes tied to findings
If cache keys include volatile inputs: update the Codeac configuration to restrict key components to content hash and stable relative paths. Avoid environment-specific values in keys.
If dependencies are missing: add the missing include or config file to the target's dependency list and trigger an invalidation. After the change, expect a one-time rebuild for affected targets.
If timestamps cause misses: enable content-hash based invalidation and ensure checkouts are reproducible. This may increase initial hashing cost.
If cache is stale: remove the specific target entries from the cache rather than clearing the entire cache. A full clear is a last resort because it forces a clean rebuild.
If disk usage is excessive: apply a retention policy and prune old entries. Excessive caching can consume significant disk space, especially in large monorepos.
How to check the result
After a fix, run the incremental build again on unchanged sources and inspect logs for cache hit messages. Compare artifact hashes for a sample of targets against a reference clean build. Monitor cache size over several runs to confirm growth is bounded.
Limitations
Cache staleness may go undetected in non-hermetic builds, leading to subtle bugs. Incremental compilation assumes the build graph accurately describes inputs. Tools that modify files outside the graph will break correctness.
Parallel builds improve latency but increase memory pressure. Large monorepos may still see long initial hashing phases.
Escalation criteria
- Cache hits persist after dependency changes and manual invalidation does not correct outputs.
- Build logs show repeated cache write errors or corruption warnings.
- Hit rate remains low after removing volatile key inputs and stabilizing timestamps.
- You suspect a bug in cache key generation for a specific language plugin.
Escalate with the target name, cache key configuration excerpt, a minimal reproduction showing expected vs actual artifacts, and logs showing hit/miss decisions.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.