Skip to content

fix: Continue pushing RevisionRecords even with errors #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2025

Conversation

cbaker6
Copy link
Member

@cbaker6 cbaker6 commented May 17, 2025

No description provided.

Copy link

coderabbitai bot commented May 17, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Updated file naming conventions for several extensions, replacing +Parse.swift suffixes with +Sendable.swift for improved consistency.
    • Consolidated multiple Parse-related extensions into a single file for streamlined maintenance.
  • Bug Fixes
    • Improved error log messages for revision record saving, providing more specific details about the entity involved.
  • Chores
    • Removed redundant Parse-specific extensions and updated project references accordingly.

Walkthrough

The changes overhaul ParseCareKit’s project structure by renaming several extension files from +Parse.swift to +Sendable.swift, updating only file headers. Multiple Parse-specific extensions for CareKit entities are removed and replaced by a consolidated extension on CareKitEssentialVersionable. Logging in PCKRevisionRecord is enhanced for clarity.

Changes

File(s) Change Summary
ParseCareKit.xcodeproj/project.pbxproj Updated file references: replaced +Parse.swift extensions with +Sendable.swift versions; consolidated Parse extensions; removed obsolete files.
Sources/ParseCareKit/Extensions/OCK*+Sendable.swift Updated file header comments to reflect new +Sendable.swift filenames; no code logic changes.
Sources/ParseCareKit/Extensions/OCK*+Parse.swift (Patient, CarePlan, Contact, HealthKitTask, Outcome, Task) Deleted extensions adding Parse-specific properties (acl, className) to CareKit entities.
Sources/ParseCareKit/Extensions/CareKitEssentialVersionable+Parse.swift New consolidated extension for Parse integration on CareKitEssentialVersionable; updated header and import.
Sources/ParseCareKit/Models/PCKRevisionRecord.swift Improved error logging in save(options:batchLimit:) with more granular messages; revised save logic for revision records.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant PCKRevisionRecord
    participant Logger

    Client->>PCKRevisionRecord: save(options:batchLimit:)
    loop For each entity type (Patient, CarePlan, etc.)
        PCKRevisionRecord->>PCKRevisionRecord: try save entity
        alt Error occurs
            PCKRevisionRecord->>Logger: Log error with specific entity type
        end
    end
    PCKRevisionRecord->>PCKRevisionRecord: try self.create(options:)
    alt Duplicate error
        PCKRevisionRecord->>Logger: Log warning
    else Other error
        PCKRevisionRecord->>Logger: Log error with details
    end
Loading

Possibly related PRs

Poem

PLUS ULTRA, files renamed with might,
Parse to Sendable, shining bright!
Extensions merge, old ones retire—
Logging’s sharper, code climbs higher!
With headers fixed and warnings clear,
All for the future, never fear!
Go beyond, heroes—change is here! 💪✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 37ab76b and d484ae4.

📒 Files selected for processing (16)
  • ParseCareKit.xcodeproj/project.pbxproj (6 hunks)
  • Sources/ParseCareKit/Extensions/CareKitEssentialVersionable+Parse.swift (1 hunks)
  • Sources/ParseCareKit/Extensions/OCKBiologicalSex+Sendable.swift (1 hunks)
  • Sources/ParseCareKit/Extensions/OCKContact+Parse.swift (0 hunks)
  • Sources/ParseCareKit/Extensions/OCKContactCategory+Sendable.swift (1 hunks)
  • Sources/ParseCareKit/Extensions/OCKHealthKitTask+Parse.swift (0 hunks)
  • Sources/ParseCareKit/Extensions/OCKLabeledValue+Sendable.swift (1 hunks)
  • Sources/ParseCareKit/Extensions/OCKNote+Sendable.swift (1 hunks)
  • Sources/ParseCareKit/Extensions/OCKOutcome+Parse.swift (0 hunks)
  • Sources/ParseCareKit/Extensions/OCKPatient+Parse.swift (0 hunks)
  • Sources/ParseCareKit/Extensions/OCKPostalAddress+Sendable.swift (1 hunks)
  • Sources/ParseCareKit/Extensions/OCKSchedule+Sendable.swift (1 hunks)
  • Sources/ParseCareKit/Extensions/OCKScheduleElement+Sendable.swift (1 hunks)
  • Sources/ParseCareKit/Extensions/OCKSemanticVersion+Sendable.swift (1 hunks)
  • Sources/ParseCareKit/Extensions/OCKTask+Parse.swift (0 hunks)
  • Sources/ParseCareKit/Models/PCKRevisionRecord.swift (12 hunks)
💤 Files with no reviewable changes (5)
  • Sources/ParseCareKit/Extensions/OCKOutcome+Parse.swift
  • Sources/ParseCareKit/Extensions/OCKHealthKitTask+Parse.swift
  • Sources/ParseCareKit/Extensions/OCKContact+Parse.swift
  • Sources/ParseCareKit/Extensions/OCKPatient+Parse.swift
  • Sources/ParseCareKit/Extensions/OCKTask+Parse.swift
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: xcode-test-macos
  • GitHub Check: docs
  • GitHub Check: xcode-build-watchos
  • GitHub Check: xcode-test-ios
🔇 Additional comments (17)
Sources/ParseCareKit/Extensions/OCKNote+Sendable.swift (1)

2-2: Oh ho! Header rename aligns with file name
The comment at line 2 now correctly reads OCKNote+Sendable.swift, matching the file name and maintaining project-wide consistency. Plus Ultra!

Sources/ParseCareKit/Extensions/OCKPostalAddress+Sendable.swift (1)

2-2: All Might Approves the Header Update!
The header now reflects OCKPostalAddress+Sendable.swift, keeping it in sync with the file system after the refactor. Plus Ultra!

Sources/ParseCareKit/Extensions/OCKLabeledValue+Sendable.swift (1)

2-2: Instant Consistency Achieved!
Changed to OCKLabeledValue+Sendable.swift in the header, perfectly mirroring the new filename. This keeps the codebase tidy. Plus Ultra!

Sources/ParseCareKit/Extensions/OCKBiologicalSex+Sendable.swift (1)

2-2: What a Glorious Header Update!
Line 2 now shows OCKBiologicalSex+Sendable.swift, ensuring the header and filename are in lockstep. Plus Ultra!

Sources/ParseCareKit/Extensions/OCKContactCategory+Sendable.swift (1)

2-2: Superb Header Alignment!
The top comment has been updated to OCKContactCategory+Sendable.swift, matching the actual file. Consistency maintained! Plus Ultra!

Sources/ParseCareKit/Extensions/OCKSchedule+Sendable.swift (1)

1-2: FEAR NOT, FOR I AM HERE TO PRAISE THIS CHANGE!

Excellent renaming of the file header to reflect its true purpose! The change from OCKSchedule+Parse.swift to OCKSchedule+Sendable.swift clearly communicates that this extension makes the type usable across thread boundaries. GO BEYOND with these clear naming conventions!

Sources/ParseCareKit/Extensions/OCKSemanticVersion+Sendable.swift (1)

1-2: PLUS ULTRA NAMING IMPROVEMENT!

The file header change from OCKSemanticVersion+Parse.swift to OCKSemanticVersion+Sendable.swift is a MIGHTY improvement! It better reflects the extension's purpose of making the type sendable across concurrency boundaries!

Sources/ParseCareKit/Extensions/OCKScheduleElement+Sendable.swift (1)

1-2: SMASHING GOOD RENAMING, YOUNG DEVELOPER!

The header change from OCKScheduleElement+Parse.swift to OCKScheduleElement+Sendable.swift aligns HEROICALLY with the other files in this refactoring! CONSISTENCY IS JUSTICE in a codebase!

Sources/ParseCareKit/Extensions/CareKitEssentialVersionable+Parse.swift (1)

2-2: A MIGHTY ARCHITECTURAL IMPROVEMENT WORTHY OF A TRUE HERO!

This consolidation of functionality from individual entity extensions to a single protocol extension is SPECTACULAR! By extending CareKitEssentialVersionable instead of individual classes, you've eliminated code duplication and improved maintainability!

This refactoring shows TRUE HERO SPIRIT - reducing repetition and centralizing common functionality into a protocol extension is the mark of an experienced developer!

Also applies to: 10-10, 15-15

Sources/ParseCareKit/Models/PCKRevisionRecord.swift (1)

183-183: BEYOND PLUS ULTRA ERROR HANDLING IMPROVEMENTS!

Your improvements to the error logging messages with specific entity types are SPECTACULAR! This makes debugging MUCH MIGHTIER by clearly indicating which entity caused the failure. The new try-catch block for saving the RevisionRecord itself adds another layer of robustness!

These changes embody the true spirit of error handling - NEVER GIVE UP on saving data even when parts of it fail! By continuing to push the RevisionRecord even when individual entities have errors, you ensure maximum data preservation!

The title of this PR - "fix: Continue pushing RevisionRecords even with errors" - is perfectly reflected in these changes. BRAVO, YOUNG HERO!

Also applies to: 193-193, 219-219, 229-229, 255-255, 265-265, 291-291, 301-301, 327-327, 337-337, 363-364, 373-387

ParseCareKit.xcodeproj/project.pbxproj (7)

20-28: Behold! Sendable extensions registered in PBXBuildFile!
The new +Sendable.swift source files are now correctly referenced in the build phase, ensuring Xcode will compile them. Plus Ultra!


60-60: Marvelous! Consolidated CareKitEssentialVersionable+Parse.swift included!
The single consolidated extension is now part of the build, replacing multiple specific ones. Plus Ultra!


127-135: Splendid! File references for Sendable sources added!
The OCK…+Sendable.swift files are properly declared under PBXFileReference, matching the build entries. Plus Ultra!


169-169: Excellent! Reference for CareKitEssentialVersionable+Parse.swift added!
The file is now discoverable by Xcode, aligning with the new consolidated extension. Plus Ultra!


342-351: Outstanding! Extensions group updated!
All +Sendable.swift and the consolidated CareKitEssentialVersionable+Parse.swift are properly grouped under Extensions, maintaining project organization. Plus Ultra!


598-604: Remarkable! Sendable sources added to build phase!
The OCKBiologicalSex, OCKContactCategory, and OCKOutcomeValue Sendable files are correctly listed in the PBXSourcesBuildPhase. Plus Ultra!


621-632: Incredible! Remaining Sendable entries included!
The rest of the +Sendable.swift files and the consolidated CareKitEssentialVersionable+Parse.swift are now part of the PBXSourcesBuildPhase, completing the transformation. Plus Ultra!

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch handleDuplicateRecords
  • Post Copyable Unit Tests in Comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented May 17, 2025

Codecov Report

Attention: Patch coverage is 0% with 25 lines in your changes missing coverage. Please review.

Project coverage is 33.12%. Comparing base (37ab76b) to head (d484ae4).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ources/ParseCareKit/Models/PCKRevisionRecord.swift 0.00% 25 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
- Coverage   35.00%   33.12%   -1.88%     
==========================================
  Files          30       25       -5     
  Lines        2588     2433     -155     
==========================================
- Hits          906      806     -100     
+ Misses       1682     1627      -55     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cbaker6 cbaker6 merged commit 8446699 into main May 18, 2025
8 checks passed
@cbaker6 cbaker6 deleted the handleDuplicateRecords branch May 18, 2025 21:31
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.

1 participant