Skip to content
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

Fix greedy resolver failure (producing an invalid solution) #4032

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/Resolve/Resolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ function greedysolver(graph::Graph)
return (false, Int[])
elseif old_v1 == spp[p1]
sol[p1] = v1
fill!(gconstr[p1], false)
gconstr[p1][v1] = true
push!(staged_next, p1)
end
end
Expand Down
34 changes: 33 additions & 1 deletion test/resolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,6 @@ end
)
@test resolve_tst(deps_data, reqs_data, want_data)


# require A, D, and lower version of Y
reqs_data = Any[
["A", "*"],
Expand All @@ -638,6 +637,39 @@ end
)
@test resolve_tst(deps_data, reqs_data, want_data)


VERBOSE && @info("SCHEME 15")
## DEPENDENCY SCHEME 15: A GRAPH WITH A WEAK DEPENDENCE
## (REDUCED VERSION OF A REALISTIC SCHEME, ref Pkg.jl issue #4030)
deps_data = Any[
["A", v"1"],
["A", v"2", "C", "*"],
["B", v"1", "D", "1", :weak],
["C", v"1", "E", "*"],
["C", v"2", "E", "*"],
["C", v"2", "B", "1"],
["E", v"1", "D", "1"],
["E", v"2", "F", "1"],
["F", v"1", "D", "*"],
["D", v"1"],
["D", v"2"],
]

@test sanity_tst(deps_data)

reqs_data = Any[
["A", "*"],
]
want_data = Dict(
"A" => v"2",
"B" => v"1",
"C" => v"2",
"D" => v"1",
"E" => v"2",
"F" => v"1",
)
@test resolve_tst(deps_data, reqs_data, want_data)

end

@testset "realistic" begin
Expand Down
Loading