fix(ios): verify livesync payload delivery on physical devices and stop swallowing upload errors#6058
fix(ios): verify livesync payload delivery on physical devices and stop swallowing upload errors#6058NathanWalker wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR adds an optional ChangesiOS Directory Verification and LiveSync Integration
Sequence DiagramsequenceDiagram
participant LiveSync as IOSLiveSyncService
participant Device as IOSDeviceFileSystem
participant Ops as iosDeviceOperations
LiveSync->>Device: transferDirectory(deviceAppData, paths, projectFilesPath)
Device->>Ops: transferFiles(...)
Ops-->>Device: transferred
LiveSync->>Device: getDirectoryEntries(deviceProjectRootPath, appId)
Device->>Ops: listDirectory(deviceProjectRootPath)
Ops-->>Device: entries[] or error
Device-->>LiveSync: entries[] or null
alt sync.zip not found
LiveSync->>Device: transferDirectory (retry)
Device->>Ops: transferFiles(...)
Ops-->>Device: transferred
LiveSync->>Device: getDirectoryEntries(verify)
Device-->>LiveSync: entries[] or null
alt still not found
LiveSync-->>LiveSync: throw detailed error
end
end
LiveSync->>LiveSync: setTransferredAppFiles(filesToTransfer)
LiveSync-->>LiveSync: return fullSyncResult
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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
🤖 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 `@lib/services/livesync/ios-livesync-service.ts`:
- Around line 74-86: The verification currently treats a null directory listing
as success and only checks for any "*sync.zip" entry, allowing stale or failed
uploads to pass; update the verification logic used after transferSyncZip and in
the other similar blocks (the verifySyncZipDelivered call sites) so that
verifySyncZipDelivered returns false when entries === null, and change the check
to match the exact device filename (deviceAppData.deviceSyncZipPath basename)
and verify file integrity (preferably compare file size or a checksum of tempZip
against the remote entry) before returning true; if the integrity check fails,
retry the transfer (using device.fileSystem.transferFiles / transferSyncZip) a
limited number of times and ultimately throw or return a failure so callers of
transferSyncZip / verifySyncZipDelivered cannot report success on stale
payloads.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e2ca07f5-e217-46e7-bd7f-1175ffa50c8b
📒 Files selected for processing (3)
lib/common/definitions/mobile.d.tslib/common/mobile/ios/device/ios-device-file-system.tslib/services/livesync/ios-livesync-service.ts
889af27 to
4a0b119
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@lib/services/livesync/ios-livesync-service.ts`:
- Around line 122-125: The containsSyncZip predicate currently compares AFC
listing entries to syncZipDevicePath (full path) and
entry.endsWith("/sync.zip"), which fails for bare "sync.zip" names returned by
AFC; fix it by deriving the basename (e.g., const syncZipBasename =
path.basename(syncZipDevicePath) or hardcode "sync.zip") and change the checks
in containsSyncZip to return true if entry === syncZipDevicePath, entry ===
syncZipBasename, or entry.endsWith("/sync.zip") (to still handle nested paths),
so bare entries, full path and nested paths are all matched; update the
containsSyncZip function accordingly.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b453c882-cc02-4ac6-88a1-e58732c665f3
📒 Files selected for processing (1)
lib/services/livesync/ios-livesync-service.ts
…op swallowing upload errors On physical iOS devices a full sync transfers the app as a single sync.zip over AFC (house_arrest) which the runtime's TKLiveSync extracts at next boot. When that delivery failed, nothing noticed: upload errors whose deviceId didn't exactly match the target device (including errors with no deviceId at all) were silently dropped, there was no post-transfer verification, and "Successfully synced" printed regardless — leaving the app running the stale JavaScript baked into the installed .app payload with no indication anywhere. - After transferring sync.zip, list the LiveSync directory on the device and confirm the zip actually landed; retry the transfer once, then fail the sync loudly (with a --clean remediation hint) instead of reporting success over stale code. Note: the listing targets the LiveSync ROOT — getDeviceProjectRootPath() returns .../LiveSync/app, one level below where the zip is uploaded. - uploadFilesCore now rethrows unattributed upload errors and logs errors attributed to other devices instead of ignoring them. - New optional IDeviceFileSystem.getDirectoryEntries(), implemented for physical iOS devices (AFC), backs the verification.
4a0b119 to
469e8a5
Compare
On physical iOS devices a full sync transfers the app as a single sync.zip over AFC (house_arrest) which the runtime's TKLiveSync extracts at next boot. When that delivery failed, nothing noticed: upload errors whose deviceId didn't exactly match the target device (including errors with no deviceId at all) were silently dropped, there was no post-transfer verification, and "Successfully synced" printed regardless — leaving the app running the stale JavaScript baked into the installed .app payload with no indication anywhere.
Summary by CodeRabbit
New Features
Bug Fixes