-
Notifications
You must be signed in to change notification settings - Fork 13
Add lookupZones, fetchRecordChanges, and uploadAssets operations #204
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
base: v1.0.0-alpha.4
Are you sure you want to change the base?
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v1.0.0-alpha.4 #204 +/- ##
==================================================
- Coverage 14.29% 13.63% -0.66%
==================================================
Files 67 73 +6
Lines 7200 7517 +317
==================================================
- Hits 1029 1025 -4
- Misses 6171 6492 +321
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Review: Add lookupZones, fetchRecordChanges, and uploadAssets operationsSummaryThis PR adds three important CloudKit Web Services operations, improving API coverage from 35% to 53%. The implementation is well-structured and follows MistKit patterns consistently. Great work overall! 🎉 ✅ StrengthsCode Quality
Architecture
Demo Integration
🔍 Issues & ConcernsCritical: Missing Test Coverage
|
|
Hi, I'm trying to use the .uploadAssets function on this branch, however it fails with the following error message: Any ETA when it becomes stable? I want to use it for mp3 audio assets. |
I'm in the very early stages of adding this. It's good to know someone is interested. I'll bump this up in my priorities for now. Probably in the next 2 weeks or so. I need to:
|
…#46, #30) Implement three CloudKit Web Services operations to improve API coverage from 35% to 53% (9/17 operations): - lookupZones(): Batch zone lookup by ID with validation - fetchRecordChanges(): Incremental sync with pagination support (manual and automatic) - uploadAssets(): Binary asset uploads with multipart/form-data encoding New public types: - ZoneID: Zone identifier (zoneName, ownerName) - RecordChangesResult: Change result with syncToken and moreComing flag - AssetUploadToken/AssetUploadResult: Upload tokens for record association MistDemo integration tests: - Add --test-lookup-zones flag for zone lookup demonstrations - Add --test-fetch-changes flag with --fetch-all and --sync-token support - Add --test-upload-asset flag with optional --create-record association Created GitHub issues for future enhancements: - #200: AsyncSequence wrapper for fetchRecordChanges streaming - #201: Batch asset upload support (multiple files) - #202: Upload progress tracking for large files - #203: Automatic token retry logic for expired tokens All operations follow MistKit patterns: async/await, typed errors, proper logging, and comprehensive error handling. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implements proper CLI subcommand architecture and integration tests that demonstrate the three new CloudKit operations (lookupZones, fetchRecordChanges, uploadAssets) working together in realistic workflows. New CLI Subcommands: - upload-asset: Upload binary assets to CloudKit - lookup-zones: Look up specific zones by name - fetch-changes: Fetch record changes with incremental sync - test-integration: Run comprehensive 8-phase integration tests Integration Test Suite (8 Phases): 1. Zone verification with lookupZones 2. Asset upload with uploadAssets (programmatic PNG generation) 3. Record creation with uploaded assets 4. Initial sync with fetchRecordChanges 5. Record modifications 6. Incremental sync demonstrating sync token usage 7. Final zone verification 8. Automatic cleanup Infrastructure: - CloudKitCommand protocol for shared functionality across subcommands - IntegrationTestRunner orchestrates all test phases - IntegrationTestData generates test PNG images programmatically - IntegrationTestError provides typed error handling - schema.ckdb defines MistKitIntegrationTest record type Architecture Changes: - Converted MistDemo from flag-based to subcommand architecture - Added Commands/ directory for subcommand implementations - Added Integration/ directory for test infrastructure - CloudKitCommand protocol resolves API tokens from env or options Documentation: - README-INTEGRATION-TESTS.md with complete usage guide - Schema deployment instructions - Troubleshooting guide - Example outputs for all commands All subcommands support: - API token from --api-token or CLOUDKIT_API_TOKEN env var - Container identifier configuration - Development/production environment selection Test integration features: - Configurable record count (--record-count) - Configurable asset size (--asset-size) - Verbose mode for detailed output (--verbose) - Skip cleanup flag for manual inspection (--skip-cleanup) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1badf6d to
4cc91cf
Compare
…ew CloudKit APIs - Add private database support to integration tests with AdaptiveTokenManager - Implement web authentication server with CloudKit.js integration - Add web auth token options to CLI commands (--web-auth-token) - Support CLOUDKIT_WEBAUTH_TOKEN environment variable - Update integration test runner to handle both public/private databases - Add comprehensive CloudKit.js authentication flow with multiple token extraction methods - Create browser-based authentication interface with proper error handling - Document testing status and next steps in TESTING_STATUS.md New CLI options: - test-integration --database [public|private] --web-auth-token TOKEN - All commands now support web authentication for private database access Authentication flow: 1. swift run mistdemo auth (starts web server) 2. Browser-based Apple ID sign-in with CloudKit.js 3. Automatic web auth token extraction and display 4. Use token with integration tests and individual operations Ready to test lookupZones, fetchRecordChanges, and uploadAssets APIs once web authentication token extraction is working correctly. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…g status MAJOR IMPROVEMENTS: - Enhanced postMessage listener with origin verification (icloud.com, apple-cloudkit.com) - Added network request interception (fetch/XHR) as fallback token capture method - Extended timeout from 5s to 10s for token arrival - Added browser debugging helpers (mistKitDebug.*) - Simplified handleAuthentication() removing 160+ lines of non-working detection code IMPLEMENTATION DETAILS: Phase 1: Enhanced postMessage capture - Origin validation for security - Support for multiple token formats (plain string `158__54__...`, object properties) - Global token storage in window.cloudKitWebAuthToken Phase 2: Network interception fallback - Intercepts fetch() and XMLHttpRequest - Captures tokens from CloudKit API responses - Logs all CloudKit requests for debugging Phase 3: Simplified authentication flow - Removed localStorage, cookies, property access strategies (didn't work) - Clean token promise with 10s timeout - Manual extraction instructions on failure Phase 5: Debugging helpers - mistKitDebug.container() - Get CloudKit container - mistKitDebug.token() - Get current token - mistKitDebug.setToken(tok) - Manually set token - mistKitDebug.sendToServer() - Send token to server - mistKitDebug.inspectContainer() - Inspect container for token TESTING STATUS UPDATE: - Web auth token successfully extracted manually (158__54__... format verified) - Implementation complete and ready for testing - Blocked on CloudKit container configuration (421 Misdirected Request) - Need to verify container setup at icloud.developer.apple.com/dashboard FILES MODIFIED: - Examples/MistDemo/Sources/MistDemo/Resources/index.html - Examples/MistDemo/Sources/MistDemo/MistDemo.swift - Examples/MistDemo/TESTING_STATUS.md Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…, #46, #30)
Implement three CloudKit Web Services operations to improve API coverage from 35% to 53% (9/17 operations):
New public types:
MistDemo integration tests:
Created GitHub issues for future enhancements:
All operations follow MistKit patterns: async/await, typed errors, proper logging, and comprehensive error handling.
Perform an AI-assisted review on