Skip to content

Conversation

@rileyseaburg
Copy link
Contributor

Summary

Fix the CircleCI Cargo cache key to include source file checksum, ensuring Rust source changes trigger rebuilds.

Problem

The cache key only included Cargo.lock checksum. When template_renderer.rs was modified but Cargo.lock didn't change, CircleCI restored the cached (old) compiled library.

Solution

Cache key now includes both:

  • Cargo.lock checksum (dependency changes)
  • template_renderer.rs checksum (source code changes)

Also bumped version to v4 to guarantee a fresh build.

The cache key now includes both Cargo.lock AND template_renderer.rs checksums.
This ensures source code changes trigger a rebuild, not just dependency changes.

Previous cache keys only used Cargo.lock which didn't change when the Rust
source code was modified.
Copilot AI review requested due to automatic review settings December 22, 2025 19:02
@rileyseaburg rileyseaburg merged commit 84b1031 into production Dec 22, 2025
18 of 19 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a caching issue in CircleCI where Rust source code changes weren't triggering rebuilds. The cache key previously only included Cargo.lock, causing the CI to use stale compiled libraries when source files changed. The solution adds template_renderer.rs checksum to the cache key and bumps the cache version from v3 to v4.

Key Changes:

  • Added template_renderer.rs checksum to the Cargo cache key
  • Bumped cache version from v3 to v4 to force fresh builds

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

keys:
- v3-cargo-{{ checksum "ext/widget_renderer/Cargo.lock" }}
- v3-cargo-
- v4-cargo-{{ checksum "ext/widget_renderer/Cargo.lock" }}-{{ checksum "ext/widget_renderer/src/template_renderer.rs" }}
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache key only includes the checksum of template_renderer.rs, but the Rust project has multiple source files (form_data.rs, lib.rs, and template_renderer.rs). Changes to form_data.rs or lib.rs would not invalidate the cache, potentially causing stale builds. Consider using a checksum of the entire src directory or all .rs files instead of just template_renderer.rs. CircleCI supports checksumming directories, e.g., checksum "ext/widget_renderer/src" which would hash all files in the directory.

Suggested change
- v4-cargo-{{ checksum "ext/widget_renderer/Cargo.lock" }}-{{ checksum "ext/widget_renderer/src/template_renderer.rs" }}
- v4-cargo-{{ checksum "ext/widget_renderer/Cargo.lock" }}-{{ checksum "ext/widget_renderer/src" }}

Copilot uses AI. Check for mistakes.
- ~/.cargo/registry
- ~/.cargo/git
key: v3-cargo-{{ checksum "ext/widget_renderer/Cargo.lock" }}
key: v4-cargo-{{ checksum "ext/widget_renderer/Cargo.lock" }}-{{ checksum "ext/widget_renderer/src/template_renderer.rs" }}
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache key only includes the checksum of template_renderer.rs, but the Rust project has multiple source files (form_data.rs, lib.rs, and template_renderer.rs). Changes to form_data.rs or lib.rs would not invalidate the cache, potentially causing stale builds. Consider using a checksum of the entire src directory or all .rs files instead of just template_renderer.rs. CircleCI supports checksumming directories, e.g., checksum "ext/widget_renderer/src" which would hash all files in the directory.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants