-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Feature Description
Implement time-based phased rollout logic for gradual update distribution. This allows updates to be rolled out incrementally to different user groups over time, reducing the impact of potential issues and enabling safer deployments.
Background
Sparkle's Appcast system supports phased rollouts where updates become available to users gradually over a specified time interval. Users are assigned to groups (0-6), and each group becomes eligible for the update at staggered times based on the rollout interval. Critical updates bypass this mechanism and are made immediately available to all users.
Analysis
The Swift implementation currently parses the phasedRolloutInterval attribute but does not enforce the phased rollout logic during update filtering. The missing components are:
- Date-based eligibility calculation - Determining when each group becomes eligible based on the update's publication date and rollout interval
- Group-aware filtering - Integrating rollout checks into the appcast filtering pipeline
- Critical update bypass - Ensuring critical updates ignore phased rollout restrictions
Proposed Solution
1. Verify Phased Rollout Interval Parsing
File: Sources/Appcast/SUAppcastItem.swift
Confirm that phasedRolloutInterval is correctly parsed from the <sparkle:phasedRolloutInterval> element as an integer representing seconds.
2. Implement Date-based Rollout Eligibility
File: Sources/Appcast/SUAppcastDriver.swift
Add itemIsReadyForPhasedRollout(_:) method that:
- Calculates eligibility using:
publicationDate + (interval × groupNumber) - Returns
trueif current date >= calculated eligibility date - Bypasses check for critical updates (always returns
true) - Uses the parsed
dateproperty from Phase 1
3. Update Filtering Pipeline
File: Sources/Appcast/SUAppcastDriver.swift
Integrate phased rollout check into filterSupportedAppcast(_:):
- Call
itemIsReadyForPhasedRollout(_:)for each item - Filter out items not yet eligible for the user's group
- Verify logic matches Sparkle's behavior for groups 0-6
Dependencies
- Phase 1 completion required - Depends on
dateproperty parsing implementation from Phase 1 (Extended Attributes Support)
Testing
Ensure existing phased rollout tests pass:
SUAppcastPhasedGroupRolloutsTests- Verify behavior across all user groups (0-6)
- Test critical update bypass
- Test edge cases (missing dates, invalid intervals)