feat: reclaim temporary workspace dependencies - #327
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| let git_probe = match contract { | ||
| RegenerationContract::TemporaryGitWorkspace => Some(path.to_path_buf()), | ||
| RegenerationContract::TemporaryWorkspaceNodeModules | ||
| | RegenerationContract::TemporaryWorkspaceUvEnvironment => temporary_workspace_root(path), | ||
| _ => None, | ||
| }; | ||
| if let Some(git_probe) = git_probe { | ||
| let git_probe = std::fs::canonicalize(&git_probe).unwrap_or(git_probe); | ||
| match bounded_git( | ||
| path, | ||
| &git_probe, | ||
| &["rev-parse", "--path-format=absolute", "--git-common-dir"], | ||
| ) { | ||
| Ok(common) => { | ||
| evidence.git_common_dir = Some(common.trim().into()); | ||
| evidence.git_worktree_registered = | ||
| bounded_git(path, &["worktree", "list", "--porcelain"]).is_ok_and(|output| { | ||
| output | ||
| .lines() | ||
| .any(|line| line.strip_prefix("worktree ") == path.to_str()) | ||
| }); | ||
| evidence.git_dirty = bounded_git(path, &["status", "--porcelain=v1"]) | ||
| bounded_git(&git_probe, &["worktree", "list", "--porcelain"]).is_ok_and( | ||
| |output| { | ||
| output | ||
| .lines() | ||
| .any(|line| line.strip_prefix("worktree ") == git_probe.to_str()) | ||
| }, | ||
| ); | ||
| evidence.git_dirty = bounded_git(&git_probe, &["status", "--porcelain=v1"]) | ||
| .map_or(true, |output| !output.is_empty()); |
There was a problem hiding this comment.
| fn temporary_workspace_artifact_contract(path: &Path) -> Option<RegenerationContract> { | ||
| let workspace = temporary_workspace_root(path)?; | ||
| let parent = path.parent()?; | ||
| match path.file_name()?.to_str()? { | ||
| "node_modules" | ||
| if is_regular_file(&parent.join("package.json")) | ||
| && ["package-lock.json", "pnpm-lock.yaml", "yarn.lock"] | ||
| .iter() | ||
| .any(|name| { | ||
| is_regular_file(&parent.join(name)) | ||
| || is_regular_file(&workspace.join(name)) | ||
| }) => | ||
| { | ||
| Some(RegenerationContract::TemporaryWorkspaceNodeModules) | ||
| } | ||
| ".venv" | ||
| if is_regular_file(&parent.join("pyproject.toml")) | ||
| && (is_regular_file(&parent.join("uv.lock")) | ||
| || is_regular_file(&workspace.join("uv.lock"))) => | ||
| { | ||
| Some(RegenerationContract::TemporaryWorkspaceUvEnvironment) | ||
| } | ||
| _ => None, | ||
| } |
| assert_eq!( | ||
| receipt.execution_issue.as_deref(), | ||
| Some("podman-storage-repair-command-failed") | ||
| Some("podman-storage-repair-provider-exit-status-unexpected") |
There was a problem hiding this comment.
| if fingerprint != plan.content_fingerprint | ||
| || (!locks.is_empty() | ||
| && !matches!( | ||
| plan.contract, | ||
| RegenerationContract::TemporaryWorkspaceUvEnvironment | ||
| )) | ||
| { |
| "node_modules" | ||
| if is_regular_file(&parent.join("package.json")) | ||
| && ["package-lock.json", "pnpm-lock.yaml", "yarn.lock"] | ||
| .iter() | ||
| .any(|name| is_regular_file(&parent.join(name))) => | ||
| { | ||
| Some(RegenerationContract::TemporaryWorkspaceNodeModules) | ||
| } | ||
| ".venv" | ||
| if is_regular_file(&parent.join("pyproject.toml")) | ||
| && is_regular_file(&parent.join("uv.lock")) => |
There was a problem hiding this comment.
| let active = crate::git_worktree::active_use_evidence_with_command_path( | ||
| &staged, path, 5_000, 128, true, | ||
| ); |
There was a problem hiding this comment.
| let active = crate::git_worktree::active_use_evidence_with_command_path( | ||
| &staged, path, 5_000, 128, true, | ||
| ); |
There was a problem hiding this comment.
Outcome
node_modulesand uv.venvsubtrees as separate generated objectsLive read-only evidence
.Jules/palette.mdValidation
rustfmt --edition 2021 src-tauri/src/generated_cache_reclaim.rsgit diff --check