Skip to content

Conversation

Boshen
Copy link
Member

@Boshen Boshen commented Sep 28, 2025

Summary

  • Fixes Canonicalized path was dropped error #732 - "Canonicalized path was dropped" error that could occur in CI environments
  • Ensures canonicalized paths have at least one strong reference in the cache to prevent premature dropping
  • Adds comprehensive tests to prevent regression

Problem

The resolver was experiencing "Canonicalized path was dropped" errors due to weak references being used without ensuring a strong reference existed. When canonicalize_impl stored only weak references to canonicalized paths, if those paths weren't already in the cache, the Arc would be immediately dropped, causing the weak reference to fail on upgrade.

Solution

Modified canonicalize_impl in src/cache/cache_impl.rs to ensure canonicalized paths are added to the cache (if not already present) before downgrading to weak references. This maintains at least one strong reference while preserving the weak reference pattern needed to avoid memory leaks from circular references.

Test Plan

  • Added test_canonicalized_path_not_dropped to verify canonicalization works correctly
  • Added test_canonicalized_path_weak_reference to ensure the error doesn't occur
  • All existing tests pass, including the memory leak test
  • cargo test passes
  • cargo clippy passes
  • cargo check passes

🤖 Generated with Claude Code

Copy link

graphite-app bot commented Sep 28, 2025

How to use the Graphite Merge Queue

Add the label merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copy link

codecov bot commented Sep 28, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.58%. Comparing base (cebe9fc) to head (9e971fa).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/cache/cache_impl.rs 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #733      +/-   ##
==========================================
- Coverage   94.64%   94.58%   -0.06%     
==========================================
  Files          15       15              
  Lines        2914     2920       +6     
==========================================
+ Hits         2758     2762       +4     
- Misses        156      158       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Boshen Boshen force-pushed the fix-canonicalized-path-dropped branch from 395834e to b70e409 Compare September 28, 2025 08:13
Fixes #732 - "Canonicalized path was dropped" error that could occur in CI environments.

The issue was that canonicalized paths were only stored as weak references without ensuring
a strong reference existed in the cache. This could cause the Arc to be immediately dropped,
leading to the weak reference failing to upgrade.

The fix ensures canonicalized paths are added to the cache (if not already present) before
downgrading to weak references, maintaining at least one strong reference while preserving
the weak reference pattern needed to avoid memory leaks.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Boshen Boshen force-pushed the fix-canonicalized-path-dropped branch from b70e409 to 9e971fa Compare September 28, 2025 08:16
@Boshen Boshen added the merge label Sep 28, 2025
Copy link
Member Author

Boshen commented Sep 28, 2025

Merge activity

  • Sep 28, 8:17 AM UTC: The merge label 'merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 28, 8:18 AM UTC: Boshen added this pull request to the Graphite merge queue.
  • Sep 28, 8:20 AM UTC: The Graphite merge queue couldn't merge this PR because it failed for an unknown reason.

Copy link

codspeed-hq bot commented Sep 28, 2025

CodSpeed Performance Report

Merging #733 will not alter performance

Comparing fix-canonicalized-path-dropped (9e971fa) with main (7c29092)

Summary

✅ 7 untouched
⏩ 2 skipped1

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Boshen Boshen merged commit 4cd0893 into main Sep 28, 2025
14 checks passed
@Boshen Boshen deleted the fix-canonicalized-path-dropped branch September 28, 2025 08:19
graphite-app bot pushed a commit that referenced this pull request Sep 28, 2025
…es (#733)

## Summary

- Fixes #732 - "Canonicalized path was dropped" error that could occur in CI environments
- Ensures canonicalized paths have at least one strong reference in the cache to prevent premature dropping
- Adds comprehensive tests to prevent regression

## Problem

The resolver was experiencing "Canonicalized path was dropped" errors due to weak references being used without ensuring a strong reference existed. When `canonicalize_impl` stored only weak references to canonicalized paths, if those paths weren't already in the cache, the Arc would be immediately dropped, causing the weak reference to fail on upgrade.

## Solution

Modified `canonicalize_impl` in `src/cache/cache_impl.rs` to ensure canonicalized paths are added to the cache (if not already present) before downgrading to weak references. This maintains at least one strong reference while preserving the weak reference pattern needed to avoid memory leaks from circular references.

## Test Plan

- [x] Added `test_canonicalized_path_not_dropped` to verify canonicalization works correctly
- [x] Added `test_canonicalized_path_weak_reference` to ensure the error doesn't occur
- [x] All existing tests pass, including the memory leak test
- [x] `cargo test` passes
- [x] `cargo clippy` passes
- [x] `cargo check` passes

🤖 Generated with [Claude Code](https://claude.ai/code)
@graphite-app graphite-app bot removed the merge label Sep 28, 2025
This was referenced Sep 28, 2025
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.

Canonicalized path was dropped error

1 participant