Skip to content

[Collections] Removed local package collection comes back alive #3617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2021

Conversation

yim-lee
Copy link
Contributor

@yim-lee yim-lee commented Jul 16, 2021

Steps to reproduce:

  1. Add a local collection
  2. Delete the collection file on local disk
  3. Refresh collections
  4. The unavailable local collection is back!

This is caused by us not deleting unavailable/invalid collections from storage when refresh fails.

rdar://80388968

Steps to reproduce:
1. Add a local collection
2. Delete the collection **file** on local disk
3. Refresh collections
4. The unavailable local collection is back!

This is caused by us not deleting unavailable/invalid collections from storage when refresh fails.

rdar://80388968
@yim-lee
Copy link
Contributor Author

yim-lee commented Jul 16, 2021

@swift-ci please smoke test

@@ -454,16 +454,16 @@ public struct PackageCollections: PackageCollectionsProtocol {
private func refreshCollectionFromSource(source: PackageCollectionsModel.CollectionSource,
trustConfirmationProvider: ((PackageCollectionsModel.Collection, @escaping (Bool) -> Void) -> Void)?,
callback: @escaping (Result<Model.Collection, Error>) -> Void) {
if let errors = source.validate()?.errors() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have the same logic in the provider. Removing this so we don't have to duplicate storage removal logic (i.e., L464-466) here.

@tomerd
Copy link
Contributor

tomerd commented Jul 16, 2021

what is the expected behavior if the collection is on the network and there is a network issue? i.e. the refresh fails because it cant reach the server.... would deleting the collection still make sense?

@yim-lee
Copy link
Contributor Author

yim-lee commented Jul 16, 2021

The collection URL remains in the config file so on next refresh it will become available again if the network issue goes away or the local file is placed back.

@yim-lee
Copy link
Contributor Author

yim-lee commented Jul 16, 2021

We can distinguish between a) bad local file, b) not found (404), and c) unavailable (non-404 error codes) such that we only remove from storage in cases (a) and (b). Do we want to do that?

But then, we can't tell in case of (c) if it's temporary or permanent.

@tomerd
Copy link
Contributor

tomerd commented Jul 16, 2021

We can distinguish between a) bad local file, b) not found (404), and c) unavailable (non-404 error codes) such that we only remove from storage in cases (a) and (b). Do we want to do that?

But then, we can't tell in case of (c) if it's temporary or permanent.

if the next refresh will try to fetch again (since still in config) it I think its fine, no?

@yim-lee
Copy link
Contributor Author

yim-lee commented Jul 16, 2021

21:17:38 Test Case 'BuildPlanTests.testExplicitSwiftPackageBuild' started at 2021-07-15 21:15:43.762
21:17:38 SwiftDriver/ClangVersionedDependencyResolution.swift:165: Fatal error: Unresolved placeholder dependencies at planning stage: swiftPlaceholder("C")
21:17:38 Exited with signal code 4

@swift-ci please smoke test Linux

@tomerd
Copy link
Contributor

tomerd commented Jul 16, 2021

the linux CI failure seems like a regression in driver, other PRs are failing the same way cc @artemcm

@tomerd
Copy link
Contributor

tomerd commented Jul 16, 2021

@swift-ci please smoke test linux

@yim-lee yim-lee merged commit 7a80d25 into swiftlang:main Jul 16, 2021
@yim-lee yim-lee deleted the dead-local-collection branch July 16, 2021 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants