fix: file recurring Todoist imports - #83
Conversation
|
Warning Review limit reached
Next review available in: 18 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughIntroduces an ITaskProjectMoveProvider interface for moving tasks between projects, implements it in TodoistProvider, and integrates automatic post-import project moves into TaskSyncEngine's sync loop based on routing match and recurrence/date criteria. Adds test coverage via FakeProvider enhancements and four new sync tests. ChangesPost-import project move feature
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant TaskSyncEngine
participant ApplyRouting
participant ShouldApplyAutomaticPostImportAction
participant TodoistProvider
TaskSyncEngine->>ApplyRouting: apply routeMatch to task
ApplyRouting-->>TaskSyncEngine: routedTask
TaskSyncEngine->>TaskSyncEngine: upsert routedTask
alt isNewSourceItem
TaskSyncEngine->>ShouldApplyAutomaticPostImportAction: evaluate routeMatch, task
ShouldApplyAutomaticPostImportAction-->>TaskSyncEngine: true
TaskSyncEngine->>TodoistProvider: MoveTaskAsync(taskId, moveToProjectId)
TodoistProvider-->>TaskSyncEngine: move recorded
else existing item
TaskSyncEngine->>TaskSyncEngine: increment sourceItemsUpdated
end
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/Openza.Tasks.Core/Sync/TaskSyncEngine.cs (1)
189-192: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
RemoveProviderProjectPrefixhardcodes the Todoist prefix in a provider-agnostic engine.
ITaskProjectMoveProvideris a generic contract, butRemoveProviderProjectPrefixonly strips"todoist_". If another provider (e.g., Microsoft ToDo with"mstodo_") later implementsITaskProjectMoveProvider,IsInProviderProjectwill fail to detect that a task is already in the target project, causing unnecessary move calls. Consider deriving the prefix fromtask.IntegrationId(the same pattern used inBuildParentExternalId).♻️ Proposed refactor: use IntegrationId to resolve prefix
- private static string RemoveProviderProjectPrefix(string projectId) => - projectId.StartsWith("todoist_", StringComparison.Ordinal) - ? projectId["todoist_".Length..] - : projectId; + private static string RemoveProviderProjectPrefix(string projectId, string integrationId) + { + var prefix = integrationId switch + { + IntegrationIds.Todoist => "todoist_", + IntegrationIds.MicrosoftToDo => "mstodo_", + _ => string.Empty, + }; + return !string.IsNullOrEmpty(prefix) && projectId.StartsWith(prefix, StringComparison.Ordinal) + ? projectId[prefix.Length..] + : projectId; + }Then update the call site in
IsInProviderProjectto passtask.IntegrationId.🤖 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 `@src/Openza.Tasks.Core/Sync/TaskSyncEngine.cs` around lines 189 - 192, `RemoveProviderProjectPrefix` is provider-specific today because it hardcodes the Todoist prefix, which breaks generic `ITaskProjectMoveProvider` handling. Update `TaskSyncEngine` so the prefix is derived from `task.IntegrationId` the same way `BuildParentExternalId` does, and pass `task.IntegrationId` from `IsInProviderProject` into `RemoveProviderProjectPrefix`. Keep the method responsible only for stripping the resolved provider prefix so other integrations like Microsoft To Do work correctly.
🤖 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 `@src/Openza.Tasks.Core/Sync/TaskSyncEngine.cs`:
- Around line 59-65: In TaskSyncEngine.Sync, the current order in the
upsert-and-move flow causes a failed MoveTaskAsync to leave the source item
persisted and prevents retries on later syncs. Update the logic around
UpsertProviderSourceItemAsync and MoveTaskAsync so the automatic post-import
move executes first for new items, then persist the source item only after a
successful move. Keep the check using ShouldApplyAutomaticPostImportAction,
isNewSourceItem, and routeMatch.PostImportAction intact while swapping the
persistence order to preserve retry behavior.
---
Nitpick comments:
In `@src/Openza.Tasks.Core/Sync/TaskSyncEngine.cs`:
- Around line 189-192: `RemoveProviderProjectPrefix` is provider-specific today
because it hardcodes the Todoist prefix, which breaks generic
`ITaskProjectMoveProvider` handling. Update `TaskSyncEngine` so the prefix is
derived from `task.IntegrationId` the same way `BuildParentExternalId` does, and
pass `task.IntegrationId` from `IsInProviderProject` into
`RemoveProviderProjectPrefix`. Keep the method responsible only for stripping
the resolved provider prefix so other integrations like Microsoft To Do work
correctly.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 54419728-e7e0-4e78-8d72-5460f592018f
📒 Files selected for processing (4)
src/Openza.Tasks.Core/Sync/SyncContracts.cssrc/Openza.Tasks.Core/Sync/TaskSyncEngine.cssrc/Openza.Tasks.Core/Sync/TodoistProvider.cssrc/Openza.Tasks.Tests/TaskSyncEngineTests.cs
- Fix P1: retry Todoist filing when the move fails before import persistence (#3553587567) - Fix P2: derive provider project prefixes from the task integration (#PRR_kwDOQn0m5s8AAAABFhNggQ) Addresses: #3553587567, #PRR_kwDOQn0m5s8AAAABFhNggQ
Summary
Tests
Summary by CodeRabbit
New Features
Bug Fixes