Skip to content

remove resolution retry on resolution failure #3853

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
Nov 18, 2021

Conversation

tomerd
Copy link
Contributor

@tomerd tomerd commented Nov 10, 2021

motivation: resolution retry + removing of package resolved in failure is difficult to justify

changes: remove the retry code from package resolution and "give up" after one attempt without mutating the package resolved file

@tomerd
Copy link
Contributor Author

tomerd commented Nov 10, 2021

@neonichu @abertelrud do you agree with this change?

note there is a unit tests that actually checks for this behavior which is naturally now failing. my default posture is we should remove the test, but it does have the following somewhat interesting comment:

        // In this test, we get into a state where add an entry in the resolved
        // file for a transitive dependency whose URL is later changed to
        // something else, while keeping the same package identity.
        //
        // This is normally detected during pins validation before the
        // dependency resolution process even begins but if we're starting with
        // a clean slate, we don't even know about the correct urls of the
        // transitive dependencies. We will end up fetching the wrong
        // dependency as we prefetch the pins. If we get into this case, it
        // should kick off another dependency resolution operation which will
        // have enough information to remove the invalid pins of transitive
        // dependencies.

wdyt?

@abertelrud
Copy link
Contributor

@neonichu @abertelrud do you agree with this change?

In theory I think this is a good change since it removes some source of confusion and "magic" behavior.

note there is a unit tests that actually checks for this behavior which is naturally now failing. my default posture is we should remove the test, but it does have the following somewhat interesting comment:

        // In this test, we get into a state where add an entry in the resolved
        // file for a transitive dependency whose URL is later changed to
        // something else, while keeping the same package identity.
        //
        // This is normally detected during pins validation before the
        // dependency resolution process even begins but if we're starting with
        // a clean slate, we don't even know about the correct urls of the
        // transitive dependencies. We will end up fetching the wrong
        // dependency as we prefetch the pins. If we get into this case, it
        // should kick off another dependency resolution operation which will
        // have enough information to remove the invalid pins of transitive
        // dependencies.

wdyt?

This is an interesting comment though. So now we would just get a failure, and then the user would need to reresolve?

@tomerd tomerd self-assigned this Nov 10, 2021
@tomerd tomerd added the WIP Work in progress label Nov 11, 2021
@tomerd tomerd changed the title remove resolution retry on resolution failure RFC: remove resolution retry on resolution failure Nov 11, 2021
…ailure

motivation: resolution retry + removing of package resolved in failure is difficult to justify

changes:
* remove the retry code from package resolution and "give up" after one attemtp without mutating the package resolved file
* fix the resolver to also compare locations so that resolved file with same identity but different location would work correctly
* add and adjust tests
@tomerd tomerd force-pushed the remove-resolution-retry branch from 11b79c4 to 750b4a7 Compare November 16, 2021 05:02
@tomerd tomerd requested a review from elsh as a code owner November 16, 2021 05:02
@tomerd
Copy link
Contributor Author

tomerd commented Nov 16, 2021

@swift-ci please smoke test

@tomerd tomerd changed the title RFC: remove resolution retry on resolution failure remove resolution retry on resolution failure Nov 16, 2021
@tomerd tomerd removed the WIP Work in progress label Nov 16, 2021
@tomerd
Copy link
Contributor Author

tomerd commented Nov 16, 2021

@swift-ci please test package compatibility

return completion(.success(container))
}

if let prefetchSync = self.prefetches[package] {
// If this container is already being prefetched, wait for that to complete
prefetchSync.notify(queue: .sharedConcurrent) {
if let container = self.containersCache[package] {
if let container = self.containersCache[package], package.equalsIncludingLocation(container.package) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@abertelrud @neonichu fixed the logic so now the test passes, its actually the right thing to do anyways

@tomerd tomerd added the ready Author believes the PR is ready to be merged & any feedback has been addressed label Nov 16, 2021
@tomerd
Copy link
Contributor Author

tomerd commented Nov 16, 2021

@neonichu @abertelrud this is ready, also passes the package compatibility test

Copy link
Contributor

@abertelrud abertelrud left a comment

Choose a reason for hiding this comment

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

Fantastic! LGTM!

@tomerd tomerd merged commit 8516cb5 into swiftlang:main Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Author believes the PR is ready to be merged & any feedback has been addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants