Skip to content

Add todo cloud migrate - #45

Merged
yesseruser merged 3 commits into
masterfrom
migrate
Jul 16, 2026
Merged

yesseruser merged 3 commits into
masterfrom
migrate

Conversation

@yesseruser

@yesseruser yesseruser commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

Closes #37

Summary by CodeRabbit

  • New Features
    • Added a cloud migration command for transferring local tasks to a specified cloud host and port.
    • Preserves task completion status during migration and skips tasks already present in the cloud.
    • Local incomplete tasks are cleared after a successful migration by default; use the keep option to retain them.
  • Improvements
    • Cloud connection handling is now more consistent across CLI commands.

@yesseruser
yesseruser marked this pull request as ready for review July 16, 2026 08:04
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@yesseruser, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 13b37248-886c-486f-b4e0-8e96eeb26ae7

📥 Commits

Reviewing files that changed from the base of the PR and between c57b20b and 273aa3b.

📒 Files selected for processing (4)
  • cli/src/bin/todo/args.rs
  • cli/src/bin/todo/command_impl_cloud.rs
  • cli/src/bin/todo/main.rs
  • cli/src/bin/todo/utils.rs

Walkthrough

Adds todo cloud migrate, shared optional cloud client construction, task upload and completion synchronization, and optional removal of migrated local tasks.

Changes

Cloud migration

Layer / File(s) Summary
Migration arguments and dispatch
cli/src/bin/todo/args.rs
Adds host, optional port, and keep arguments, then routes CloudSubcommand::Migrate to handle_migrate.
Shared cloud client initialization
cli/src/bin/todo/utils.rs, cli/src/bin/todo/main.rs
Introduces get_client and uses it to initialize the optional cloud client.
Task migration execution
cli/src/bin/todo/command_impl_cloud.rs
Uploads local tasks, ignores already-existing task errors, synchronizes completed tasks, and clears non-completed local tasks unless keep is set.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant handle_migrate
  participant Client
  participant SaveData
  CLI->>handle_migrate: host, port, keep
  handle_migrate->>Client: Add local tasks
  handle_migrate->>Client: Mark completed tasks done
  handle_migrate->>SaveData: Clear and save local tasks when keep is false
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the new todo cloud migrate command.
Linked Issues check ✅ Passed The PR adds the migrate command, moves local notes to the server, and supports --keep, matching issue #37.
Out of Scope Changes check ✅ Passed The client helper refactor and command plumbing support the migrate feature and do not introduce unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migrate

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
cli/src/bin/todo/main.rs (1)

12-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove unused import.

Since client initialization was refactored to use get_client, process_cloud_config is no longer used in this file and can be safely removed from the imports.

♻️ Proposed fix
-use crate::utils::{get_client, process_cloud_config};
+use crate::utils::get_client;
🤖 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 `@cli/src/bin/todo/main.rs` at line 12, Remove the unused process_cloud_config
import from the crate::utils import list in the todo CLI main module, while
retaining get_client.
cli/src/bin/todo/utils.rs (1)

44-50: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify Option mapping.

You can use the built-in .map() method to make this code slightly more idiomatic and concise.

♻️ Proposed refactor
 pub(crate) fn get_client(args: Option<&TodoArgs>, data: &dyn SaveData) -> Option<Client> {
-    if let Some((hostname, port)) = process_cloud_config(args, data) {
-        Some(Client::new(hostname, Some(port)))
-    } else {
-        None
-    }
+    process_cloud_config(args, data).map(|(hostname, port)| Client::new(hostname, Some(port)))
 }
🤖 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 `@cli/src/bin/todo/utils.rs` around lines 44 - 50, Update get_client to replace
the explicit if-let/else branching with Option::map on the result of
process_cloud_config, constructing Client from the hostname and port while
preserving the existing None behavior.
🤖 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.

Inline comments:
In `@cli/src/bin/todo/command_impl_cloud.rs`:
- Around line 657-659: Update the save_tasks error handling in the command
implementation to replace the empty DataError what field with a concise
descriptive context for the task-saving operation, while preserving the original
err value and return behavior.
- Around line 640-653: Replace the per-task calls to handle_add_cloud and
handle_done_undone_cloud with batched processing: fetch the cloud task list
once, build one TasksCommand containing all local task names for addition, then
synchronize completed-state changes in a single operation while preserving
TaskExists handling and existing error propagation.

---

Nitpick comments:
In `@cli/src/bin/todo/main.rs`:
- Line 12: Remove the unused process_cloud_config import from the crate::utils
import list in the todo CLI main module, while retaining get_client.

In `@cli/src/bin/todo/utils.rs`:
- Around line 44-50: Update get_client to replace the explicit if-let/else
branching with Option::map on the result of process_cloud_config, constructing
Client from the hostname and port while preserving the existing None behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4d414ee6-07f3-455d-9443-e8836e79afa6

📥 Commits

Reviewing files that changed from the base of the PR and between 3f8145b and c57b20b.

📒 Files selected for processing (4)
  • cli/src/bin/todo/args.rs
  • cli/src/bin/todo/command_impl_cloud.rs
  • cli/src/bin/todo/main.rs
  • cli/src/bin/todo/utils.rs

Comment thread cli/src/bin/todo/command_impl_cloud.rs
Comment thread cli/src/bin/todo/command_impl_cloud.rs
@yesseruser
yesseruser merged commit bf5afc7 into master Jul 16, 2026
3 checks passed
@yesseruser
yesseruser deleted the migrate branch July 16, 2026 08:28
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.

Add todo cloud migrate

1 participant