Repository navigation
feat: add remote diff and patch commands - #147
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds two remote workspace inspection CLI subcommands. ChangesRemote workspace diff and patch CLI
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
coding-agent/src/coding_agent/remote/client.py (1)
272-287: 💤 Low valueOptional: Remove redundant
dict()call.Line 287 calls
dict(data)butdatais already adict[str, object]returned by_get_remote_json(line 321), making the conversion redundant.♻️ Simplify return statement
- return dict(data) + return data🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@coding-agent/src/coding_agent/remote/client.py` around lines 272 - 287, The return uses dict(data) redundantly in download_workspace_diff even though _get_remote_json already returns a dict; simply return the existing data object instead (replace "return dict(data)" with "return data") to remove the unnecessary copy while keeping the validation checks for files, additions, and deletions intact.coding-agent/src/coding_agent/__main__.py (1)
920-929: 💤 Low valueOptional: Remove redundant validation.
Lines 922-929 re-validate fields (
files,additions,deletions) that were already validated indownload_workspace_diffat lines 280-286 ofclient.py. The client function already raisesclick.ClickExceptionfor invalid responses, making this duplication unnecessary.♻️ Remove redundant checks
endpoint = get_remote(name) diff = download_workspace_diff(endpoint, session_id) files = diff.get("files") - if not isinstance(files, list): - raise click.ClickException("Remote workspace diff response missing files") workspace_id = diff.get("workspace_id") workspace_label = workspace_id if isinstance(workspace_id, str) else "unknown" additions = diff.get("additions") deletions = diff.get("deletions") - if not isinstance(additions, int) or not isinstance(deletions, int): - raise click.ClickException("Remote workspace diff response missing totals") click.echo(The client-side validation guarantees these types.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@coding-agent/src/coding_agent/__main__.py` around lines 920 - 929, Remove duplicated validation in the caller after using download_workspace_diff: delete the type checks and ClickException raises for files, additions, and deletions (the block that inspects files, additions, deletions and raises click.ClickException) since download_workspace_diff already validates and raises; keep only retrieval of workspace_id and setting of workspace_label from the diff. Ensure references to variables files, additions, deletions, workspace_id/workspace_label remain consistent with the rest of the function and do not re-check types or re-raise click.ClickException.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@coding-agent/src/coding_agent/__main__.py`:
- Around line 920-929: Remove duplicated validation in the caller after using
download_workspace_diff: delete the type checks and ClickException raises for
files, additions, and deletions (the block that inspects files, additions,
deletions and raises click.ClickException) since download_workspace_diff already
validates and raises; keep only retrieval of workspace_id and setting of
workspace_label from the diff. Ensure references to variables files, additions,
deletions, workspace_id/workspace_label remain consistent with the rest of the
function and do not re-check types or re-raise click.ClickException.
In `@coding-agent/src/coding_agent/remote/client.py`:
- Around line 272-287: The return uses dict(data) redundantly in
download_workspace_diff even though _get_remote_json already returns a dict;
simply return the existing data object instead (replace "return dict(data)" with
"return data") to remove the unnecessary copy while keeping the validation
checks for files, additions, and deletions intact.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 25108d64-5cb4-40e6-9fbc-1e1a17054128
📒 Files selected for processing (3)
coding-agent/src/coding_agent/__main__.pycoding-agent/src/coding_agent/remote/client.pycoding-agent/tests/cli/test_remote_client.py
Summary
coding-agent remote diffto print changed-file summariescoding-agent remote patchto print unified patchesValidation
uv run pytest tests/cli/test_remote_client.py -k "remote_diff or remote_patch or remote_run or remote_repl_with_repo or download" -quv run basedpyright --level error src/coding_agent/__main__.py src/coding_agent/remote/client.py tests/cli/test_remote_client.pyuv run ruff format --check src/coding_agent/__main__.py src/coding_agent/remote/client.py tests/cli/test_remote_client.pygit diff --checkSummary by CodeRabbit
Release Notes
New Features
remote diffcommand to download and display changes in remote session workspaces with per-file summariesremote patchcommand to retrieve and display unified patch files for remote session workspacesTests