Vexil icon indicating copy to clipboard operation
Vexil copied to clipboard

Remove dangerous FlagValueDictionary functionality

Open KeithBauerANZ opened this issue 1 year ago • 1 comments

📒 Description

Remove dangerous FlagValueDictionary functionality:

  • It's internally locked, so not safe for it to conform to Collection
  • It's a reference type, so shouldn't conform to Equatable

🔍 Detailed Design

Include any additional information about the design here. At minimum, show any new API:

... FlagValueDictionary {

    // MARK: - Dictionary Access

    /// Returns a copy of the current values in this source
    var allValues: DictionaryType { get }

}

📓 Documentation Plan

I noticed CustomSources.md is outdated with the new FlagValueSource/NonSendableFlagValueSource split, but updating that seems to be a separate task.

🗳 Test Plan

Unit tests.

🧯 Source Impact

  • Removes FlagValueDictionary's conformance to Collection. This is a breaking change. Existing users of this conformance will need to use allValues, but that alone can't replace all uses of the Collection API. I didn't want to make allValues a mutable property though, because that would reintroduce the same kinds of unsafety that the Collection conformance did.

  • Removes FlagValueDictionary's conformance to Equatable. This is a breaking change. Existing users of this conformance will need to check sourceA.id == sourceB.id && sourceA.allValues == sourceB.allValues to get an equivalent check (and also be aware that they may have a race condition since the FVD is Sendable)

✅ Checklist

  • [x] I've added at least one test that validates that my change is working, if appropriate
  • [x] I've followed the code style of the rest of the project
  • [x] I've read the Contribution Guidelines
  • [x] I've updated the documentation if necessary

KeithBauerANZ avatar Aug 02 '24 01:08 KeithBauerANZ