Skip to content

Phase 2: Implement Phased Rollout Support #25

@jozefizso

Description

@jozefizso

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:

  1. Date-based eligibility calculation - Determining when each group becomes eligible based on the update's publication date and rollout interval
  2. Group-aware filtering - Integrating rollout checks into the appcast filtering pipeline
  3. 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 true if current date >= calculated eligibility date
  • Bypasses check for critical updates (always returns true)
  • Uses the parsed date property 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 date property 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)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions