📝 CodeRabbit Chat: Implement requested code changes - #77
📝 CodeRabbit Chat: Implement requested code changes#77coderabbitai[bot] wants to merge 2 commits into
Conversation
Add tracked `Cargo.lock` discovery and refresh support after manifest version rewrites so nested workspace lockfiles stay aligned with bumped path dependency versions. Validate tracked lockfiles before publish preflight cargo checks and report stale files with the exact `cargo generate-lockfile` repair command. Cover the behaviour with unit and BDD tests for live bump, dry-run bump, and publish preflight failures.
|
Important Review skippedThis PR was authored by the user configured for CodeRabbit reviews. CodeRabbit does not review PRs authored by this user. It's recommended to use a dedicated user account to post CodeRabbit review feedback. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Reviewer's GuideRefactors Cargo.lock discovery to always use Sequence diagram for updated discover_tracked_lockfiles flowsequenceDiagram
participant Caller
participant discover_tracked_lockfiles
participant _query_git_tracked_lockfiles
participant runner
participant _filter_lockfiles_with_manifests
participant LOGGER
Caller->>discover_tracked_lockfiles: discover_tracked_lockfiles(workspace_root, runner)
discover_tracked_lockfiles->>discover_tracked_lockfiles: workspace_root.rglob("Cargo.lock")
discover_tracked_lockfiles-->>Caller: () [no lockfiles]
opt [at least one Cargo.lock]
discover_tracked_lockfiles->>_query_git_tracked_lockfiles: _query_git_tracked_lockfiles(workspace_root, runner)
_query_git_tracked_lockfiles->>runner: runner(("git","ls-files","*/Cargo.lock","Cargo.lock"), cwd=workspace_root)
runner-->>_query_git_tracked_lockfiles: exit_code, stdout, stderr
alt [exit_code == 0]
_query_git_tracked_lockfiles-->>discover_tracked_lockfiles: stdout
else [exit_code != 0]
alt ["not a git repository" in detail]
_query_git_tracked_lockfiles->>LOGGER: warning("Skipping Cargo.lock discovery because ... is not a git repository")
else
_query_git_tracked_lockfiles->>LOGGER: warning("Skipping Cargo.lock discovery after git ls-files failed: %s", detail)
end
_query_git_tracked_lockfiles-->>discover_tracked_lockfiles: None
end
alt [stdout is None]
discover_tracked_lockfiles-->>Caller: ()
else [stdout is not None]
discover_tracked_lockfiles->>_filter_lockfiles_with_manifests: _filter_lockfiles_with_manifests(workspace_root, stdout)
_filter_lockfiles_with_manifests-->>discover_tracked_lockfiles: tuple[Path,...]
discover_tracked_lockfiles-->>Caller: tuple[Path,...]
end
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
discover_tracked_lockfiles, you're walking the tree withrglob("Cargo.lock")only to computehas_lockfiles; consider reusing the discovered paths (e.g., store them in a tuple and use it for the early-empty check) to avoid a redundant filesystem walk if you later need those paths for other work. - The
refresh_lockfilefunction no longer has a-> Pathreturn annotation but its docstring still says it returns the lockfile path; align the type hint and docstring with the actual behavior for consistency.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `discover_tracked_lockfiles`, you're walking the tree with `rglob("Cargo.lock")` only to compute `has_lockfiles`; consider reusing the discovered paths (e.g., store them in a tuple and use it for the early-empty check) to avoid a redundant filesystem walk if you later need those paths for other work.
- The `refresh_lockfile` function no longer has a `-> Path` return annotation but its docstring still says it returns the lockfile path; align the type hint and docstring with the actual behavior for consistency.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
cfaa044 to
527c7a8
Compare
Code changes was requested by @leynos.
The following files were modified:
lading/commands/lockfile.pySummary by Sourcery
Refine discovery of tracked Cargo.lock files by delegating git querying and manifest filtering to helper functions and adding safeguards for non-git workspaces or missing lockfiles.
Enhancements:
git ls-filesfor Cargo.lock discovery with clearer logging on failure and non-git repositories.