Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
ChangesWorkspace path resolution
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…heck impact_for_path's NotInWorkspace check compares a caller-supplied file path against each crate's manifest_dir from cargo metadata via a plain prefix match. Both sides can come back in different path representations for the same real location, so the match silently fails even when the file is genuinely inside the workspace: - On macOS, cargo metadata resolves manifest_path through /var's symlink to /private/var, but a path built from a caller-supplied root (e.g. from tempfile::tempdir()) isn't resolved the same way. - On GitHub Actions Windows runners, manifest_path can come back with an 8.3 short-name path component (RUNNER~1) instead of the long form (runneradmin) that a plain-canonicalized caller path resolves to. Canonicalize both the candidate file (in impact_for_path) and each crate's manifest_dir (in WorkspaceGraph::from_metadata_json) with dunce::canonicalize, so they're always compared in the same representation. dunce (already present transitively via same-file, now a direct dependency) matches std::fs::canonicalize's symlink/short-name resolution but skips the \\?\ UNC prefix std adds on Windows, which would otherwise reintroduce the same mismatch against cargo's unprefixed paths. Falls back to the original path wherever canonicalization fails (nonexistent target, synthetic fixture paths in unit tests), preserving existing behavior there. Added a Unix-portable regression test that reproduces the macOS asymmetry via a real symlink, since the actual bug is invisible on ubuntu-latest CI. The Windows short-name mismatch was found and confirmed fixed via a temporary diagnostic against the actual CI runner, since it isn't reproducible outside that environment. Agentflare-Agent: claude-code Agentflare-Branch: task/72 Agentflare-Item: 72
Summary
resolve_owner_crate's prefix check compares the candidate file path againstmanifest_dirfromcargo metadata, which cargo returns already canonicalized (symlink-free). The candidate path was never canonicalized the same way, so a genuinely-in-workspace file got rejected asNotInWorkspacewhenever the workspace root was reached through a symlink — notably macOS's/var->/private/var, which is whyci / build (macos-latest)failed on master (29b1031) while ubuntu-latest was unaffected.impact_for_pathbefore the membership check, falling back to the original path when canonicalization fails (nonexistent path, preserving the existing "clear error" test)./var, but the identical mechanism), since the actual macOS bug is invisible on ubuntu-latest CI.Test plan
cargo test --test code_impact_test— all 5 tests pass (verified with the locallean-ctxbinary excluded fromPATHto match the CI environment; see PR description caveat below)cargo clippy --lib --testsclean on touched filesci / build (macos-latest)goes green on this PR (pending CI run)Note: one pre-existing, unrelated test-flakiness issue was found and left alone —
confirm::search_crate_dirsilently misparseslean-ctx grep's sandboxing error as zero hits when thelean-ctxCLI happens to be onPATHand refuses to search outside its own project root. This only affects local dev machines withlean-ctxinstalled; CI runners don't have that binary and are unaffected.Summary by CodeRabbit
Bug Fixes
Tests