Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ final class AttributionFetcher {
return nil
}

private static let zeroAdvertisingIdentifier = UUID(uuidString: "00000000-0000-0000-0000-000000000000")
// Non-optional construction via `init(uuid:)` — `init(uuidString:)` returns
// an Optional which would make the equality check silently false-positive
// if the literal ever failed to parse.
Comment on lines +59 to +61
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The comment says "silently false-positive" but the failure mode is a false-negative: if zeroAdvertisingIdentifier were nil, the equality check would return false, the if block would not fire, and the all-zeros IDFA would pass through unfiltered — the opposite of a false-positive.

Suggested change
// Non-optional construction via `init(uuid:)` — `init(uuidString:)` returns
// an Optional which would make the equality check silently false-positive
// if the literal ever failed to parse.
// Non-optional construction via `init(uuid:)` — `init(uuidString:)` returns
// an Optional which would make the equality check silently false-negative
// (zero-IDFA passes through unfiltered) if the literal ever failed to parse.
Prompt To Fix With AI
This is a comment left during a code review.
Path: Sources/SuperwallKit/Analytics/Attribution/AttributionFetcher.swift
Line: 59-61

Comment:
The comment says "silently false-positive" but the failure mode is a false-negative: if `zeroAdvertisingIdentifier` were `nil`, the equality check would return `false`, the `if` block would not fire, and the all-zeros IDFA would pass through unfiltered — the opposite of a false-positive.

```suggestion
  // Non-optional construction via `init(uuid:)` — `init(uuidString:)` returns
  // an Optional which would make the equality check silently false-negative
  // (zero-IDFA passes through unfiltered) if the literal ever failed to parse.
```

How can I resolve this? If you propose a fix, please make it concise.

private static let zeroAdvertisingIdentifier = UUID(uuid: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))

/// Whether this build/environment can ever produce an AdServices token.
/// `false` on builds that didn't link AdServices.framework and on debug
Expand Down
Loading