Skip to content

Stop downloading new relay list on every build when building ios 1397#9716

Merged
pinkisemils merged 6 commits intomainfrom
stop-downloading-new-relay-list-on-every-build-when-building-ios-1397
Feb 10, 2026
Merged

Stop downloading new relay list on every build when building ios 1397#9716
pinkisemils merged 6 commits intomainfrom
stop-downloading-new-relay-list-on-every-build-when-building-ios-1397

Conversation

@pinkisemils
Copy link
Collaborator

@pinkisemils pinkisemils commented Jan 27, 2026

I've changed the app to always download the relay list if the bundled one is empty in debug builds. Having an empty prebundled relay list will now fail the build. I've achieved this by changing the relay downloading script to never download relays and instead validate the list itself if it doesn't exist. This way, we can keep the file referenced in the project, and we can stop updating it all the time. MockRelease will require a checked out relay list since it will not include the code that will fetch the list by default.

I've tried to scope all the app changes to only be there in debug builds. The relay list downloading should take place soon after the app delegate has initialized.

To test this out, you can try building a MockRelease build without a relay list.
Then you can set an invalid one and see it fail still:

echo '{}' > ios/MullvadREST/Assets/relays.json

And you should be able to make it build:

curl https://api.mullvad.net/app/v1/relays > ios/MullvadREST/Assets/relays.json

And after removing the relay list, you should still be able to do a fresh Debug install on a device and see it work as expected. This does mean that fresh debug installs will only work when the device can reach the API to fetch a new list.


This change is Reviewable

@pinkisemils pinkisemils added the iOS Issues related to iOS label Jan 27, 2026
@linear
Copy link

linear bot commented Jan 27, 2026

@pinkisemils pinkisemils force-pushed the stop-downloading-new-relay-list-on-every-build-when-building-ios-1397 branch 3 times, most recently from 1c3cd3a to bd1a392 Compare January 27, 2026 20:08
Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

I like the idea here, but I think all the debug flags pollute the code a bit. Also, what are the consequences if we accidentally remove one that shouldn't be removed?

@rablador partially reviewed 15 files and all commit messages, and made 3 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @pinkisemils).


ios/MullvadVPN.xcodeproj/xcshareddata/xcbaselines/58B0A29F238EE67E00BC001D.xcbaseline/0B028554-E830-4027-9640-5C31EBD6454D.plist line 1 at r4 (raw file):

<?xml version="1.0" encoding="UTF-8"?>

What's this file?


ios/MullvadVPN.xcodeproj/xcshareddata/xcbaselines/58B0A29F238EE67E00BC001D.xcbaseline/Info.plist line 1 at r4 (raw file):

<?xml version="1.0" encoding="UTF-8"?>

And this?

Copy link
Collaborator Author

@pinkisemils pinkisemils left a comment

Choose a reason for hiding this comment

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

I can revise the changes such that instead of having the debug flags being a part of a long function, the optional code can be stuffed into a function/method and the whole body of that method can be conditional. What I don't like about this is that the call site will look weird, unless we call the function something like downloadRelayListIfDebug.

@pinkisemils made 3 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @rablador).


ios/MullvadVPN.xcodeproj/xcshareddata/xcbaselines/58B0A29F238EE67E00BC001D.xcbaseline/0B028554-E830-4027-9640-5C31EBD6454D.plist line 1 at r4 (raw file):

Previously, rablador (Jon Petersson) wrote…

What's this file?

This is a baseline for a benchmark for the AllLocationDataSourceBenchmarkTests.


ios/MullvadVPN.xcodeproj/xcshareddata/xcbaselines/58B0A29F238EE67E00BC001D.xcbaseline/Info.plist line 1 at r4 (raw file):

Previously, rablador (Jon Petersson) wrote…

And this?

Same as above. I should've added these earlier.

acb-mv
acb-mv previously approved these changes Feb 2, 2026
Copy link
Contributor

@acb-mv acb-mv left a comment

Choose a reason for hiding this comment

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

@acb-mv partially reviewed 15 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @rablador).


ios/checkRelays.swift line 22 at r4 (raw file):

    }

    print("Validating list")

Any reason for using both print and fputs?

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

Do you mean for all flags in each flag?

@rablador made 1 comment and resolved 2 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved.

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

*in each file

@rablador made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved.

Copy link
Contributor

@mojganii mojganii left a comment

Choose a reason for hiding this comment

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

@mojganii made 2 comments.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @pinkisemils).


ios/checkRelays.swift line 22 at r4 (raw file):

Previously, acb-mv wrote…

Any reason for using both print and fputs?

+1


ios/MullvadVPN/RelayCacheTracker/RelayCacheTracker.swift line 69 at r4 (raw file):

            try hotfixRelaysThatDoNotHaveFeatures()

            #if DEBUG

wasn't it suuposed to create another compiler falg for it?

@pinkisemils pinkisemils force-pushed the stop-downloading-new-relay-list-on-every-build-when-building-ios-1397 branch from bd1a392 to 601330e Compare February 9, 2026 14:04
Copy link
Collaborator Author

@pinkisemils pinkisemils left a comment

Choose a reason for hiding this comment

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

Not all flags for each file, but only where it makes sense. As discussed, I've changed to use a different flag and removed some use of the flags where they weren't absolutely necessary.

@pinkisemils made 2 comments.
Reviewable status: 7 of 16 files reviewed, 1 unresolved discussion (waiting on @acb-mv, @mojganii, and @rablador).


ios/MullvadVPN/RelayCacheTracker/RelayCacheTracker.swift line 69 at r4 (raw file):

Previously, mojganii wrote…

wasn't it suuposed to create another compiler falg for it?

You're right. Should be fixed now.

rablador
rablador previously approved these changes Feb 10, 2026
Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

@rablador reviewed 9 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @mojganii and @pinkisemils).


ios/Configurations/Base.xcconfig.template line 27 at r5 (raw file):


// Flag used to conditionally show features that are in development
SWIFT_ACTIVE_COMPILATION_CONDITIONS[config=Debug] = DEBUG NOT_PRODUCTION_PERMANENT

Nit: I can't think of something better, but reading #if NOT_PRODUCTION_PERMANENT in one swoop makes it sound like it's not production permanent, rather than not production and here to stay.

Copy link
Contributor

@mojganii mojganii left a comment

Choose a reason for hiding this comment

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

@mojganii made 2 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @pinkisemils).


ios/MullvadVPN/RelayCacheTracker/RelayCacheTracker.swift line 69 at r4 (raw file):

Previously, pinkisemils (Emīls Piņķis) wrote…

You're right. Should be fixed now.

shouldn't it be replaced with the new flag which is NOT_PRODUCTION_PERMANENT?


ios/Configurations/Base.xcconfig.template line 28 at r5 (raw file):

// Flag used to conditionally show features that are in development
SWIFT_ACTIVE_COMPILATION_CONDITIONS[config=Debug] = DEBUG NOT_PRODUCTION_PERMANENT
SWIFT_ACTIVE_COMPILATION_CONDITIONS[config=Staging] = DEBUG NOT_PRODUCTION_PERMANENT

nit: : NON_PRODUCTION_ONLY, INTERNAL_ONLY

@pinkisemils pinkisemils force-pushed the stop-downloading-new-relay-list-on-every-build-when-building-ios-1397 branch from 601330e to 7b9e818 Compare February 10, 2026 10:55
Copy link
Collaborator Author

@pinkisemils pinkisemils left a comment

Choose a reason for hiding this comment

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

@pinkisemils made 3 comments.
Reviewable status: 15 of 16 files reviewed, 3 unresolved discussions (waiting on @mojganii and @rablador).


ios/Configurations/Base.xcconfig.template line 27 at r5 (raw file):

Previously, rablador (Jon Petersson) wrote…

Nit: I can't think of something better, but reading #if NOT_PRODUCTION_PERMANENT in one swoop makes it sound like it's not production permanent, rather than not production and here to stay.

How about NEVER_IN_PRODUCTION ?


ios/Configurations/Base.xcconfig.template line 28 at r5 (raw file):

Previously, mojganii wrote…

nit: : NON_PRODUCTION_ONLY, INTERNAL_ONLY

How about NEVER_IN_PRODUCTION ?


ios/MullvadVPN/RelayCacheTracker/RelayCacheTracker.swift line 69 at r4 (raw file):

Previously, mojganii wrote…

shouldn't it be replaced with the new flag which is NOT_PRODUCTION_PERMANENT?

Done.

@pinkisemils pinkisemils force-pushed the stop-downloading-new-relay-list-on-every-build-when-building-ios-1397 branch from 7b9e818 to 4703a4d Compare February 10, 2026 12:06
Copy link
Contributor

@mojganii mojganii left a comment

Choose a reason for hiding this comment

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

:lgtm:

@mojganii made 2 comments and resolved 1 discussion.
Reviewable status: 14 of 16 files reviewed, 2 unresolved discussions (waiting on @pinkisemils and @rablador).


ios/Configurations/Base.xcconfig.template line 28 at r5 (raw file):

Previously, pinkisemils (Emīls Piņķis) wrote…

How about NEVER_IN_PRODUCTION ?

looks good to me.

Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

:lgtm:

@rablador reviewed 2 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @pinkisemils).


ios/Configurations/Base.xcconfig.template line 27 at r5 (raw file):

Previously, pinkisemils (Emīls Piņķis) wrote…

How about NEVER_IN_PRODUCTION ?

Let's go with that.

@pinkisemils pinkisemils force-pushed the stop-downloading-new-relay-list-on-every-build-when-building-ios-1397 branch 2 times, most recently from be8e98e to 08df138 Compare February 10, 2026 13:41
@pinkisemils pinkisemils force-pushed the stop-downloading-new-relay-list-on-every-build-when-building-ios-1397 branch from 08df138 to 370f71a Compare February 10, 2026 13:42
@pinkisemils pinkisemils merged commit f0b4bd7 into main Feb 10, 2026
12 of 14 checks passed
@pinkisemils pinkisemils deleted the stop-downloading-new-relay-list-on-every-build-when-building-ios-1397 branch February 10, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

iOS Issues related to iOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants