Drop all v1 deprecations for v2#214
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v2-DEV #214 +/- ##
==========================================
+ Coverage 84.31% 93.85% +9.54%
==========================================
Files 12 10 -2
Lines 848 700 -148
==========================================
- Hits 715 657 -58
+ Misses 133 43 -90 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I've allocated some bandwidth to review this tomorrow |
| @testset "legacy deserialization" begin | ||
| # Serialized string generated on Intervals@1.2 with: | ||
| # `julia --project -E 'using Serialization, Intervals; sprint(serialize, AnchoredInterval{-1,Int}(2, true, false))'`. | ||
| buffer = IOBuffer( | ||
| SERIALIZED_HEADER * | ||
| "\x004\x10\x01\x10AnchoredInterval\x1f\v՞\x84\xec\xf7-`\x87\xbb" * | ||
| "S\xe1Á\x88A\xd8\x01\tIntervalsD\x02\0\0\x001\xff\xff\xff\xff\0\b\xe14\x10" * | ||
| "\x01\vInclusivity\x1f\v՞\x84\xec\xf7-`\x87\xbbS\xe1Á\x88A\xd8,\x02\0DML" | ||
| ) | ||
|
|
||
| interval = deserialize(buffer) | ||
| @test interval isa AnchoredInterval | ||
| @test interval == AnchoredInterval{-1,Int,Closed,Open}(2) | ||
| end | ||
|
|
There was a problem hiding this comment.
You removed the legacy deserialization tests but didn't remove the code from compat.jl which is what this tests. I think the reason you removed this is that the removal of Inclusivity broke the code in compat.jl but we can make a minor change to continue supporting deserialization of the old Interval 1.2 types. It's definitely not necessary with a breaking version change but it's not hard to support:
# These `deserialize` methods are used to be able to deserialize intervals using the
# structure that was used before Intervals 1.3.
abstract type Inclusivity end
function Serialization.deserialize(s::AbstractSerializer, ::Type{Inclusivity})
L = bound_type(deserialize(s))
R = bound_type(deserialize(s))
return L, R
end
function Serialization.deserialize(s::AbstractSerializer, ::Type{Interval{T}}) where T
left = deserialize(s)
right = deserialize(s)
L, R = deserialize(s) # Deserialize `Inclusivity`
return Interval{T,L,R}(left, right)
end
function Serialization.deserialize(s::AbstractSerializer, ::Type{AnchoredInterval{P,T}}) where {P,T}
anchor = deserialize(s)
L, R = deserialize(s) # Deserialize `Inclusivity`
return AnchoredInterval{P,T,L,R}(anchor)
endWith this updated compat.jl code these tests should pass.
There was a problem hiding this comment.
Since this is already going into the break v2-DEV release I'm inclined to just drop the compat.jl code. Also, deserialization will likely break again with #217 anyway. If we don't drop it for v2 are we just going to retain this compat code indefinitely?
There was a problem hiding this comment.
I agree we can't keep the serialization compat code forever but it is nice to have some compatibility with old serialized versions. I think having backwards compatible serialization with the latest previous version would be a good goal to have (1.9.0) in this case.
I'd personally probably include this compat change in this PR and then just remove it in #217 just to keep in the commit history.
|
|
||
| # TODO: Sometimes expected_xor would get mutated in this call | ||
| @test symdiff([earlier], [later]) == expected_xor != union(expected_xor) | ||
| @test symdiff([earlier], [later]) == expected_xor == union(expected_xor) |
There was a problem hiding this comment.
This minor change is generated some major internal debate. In looking over this series of tests again the intent is to show that the IntervalSet behaviour works as expected and that the vector of Interval may or may not match. It appears that a commit you added (e122bfe) introduced the additional check to see what the resulting value actually is which makes the intent less clear.
In looking over that commit is seems you just cared about having a check to see what the value actually is so by following what I original intended and your intent we should just do:
| @test symdiff([earlier], [later]) == expected_xor == union(expected_xor) | |
| @test symdiff([earlier], [later]) == union(expected_xor) |
There was a problem hiding this comment.
resulting value actually is which makes the intent less clear.
Why is it less clear? The issue with the original check is that we were testing with multiple overloaded methods. If you were to read these tests without context you might be confused about why they don't match because our implementation of union for vectors of intervals is a bit weird. It seemed prudent to add a more explicit check for when we deprecated the union method.
I suppose they could have been separate checks, but I like that the change is all on one line. Anyway, I agree that going forward we don't need to check both anymore, since union works as expected now.
There was a problem hiding this comment.
When we added the IntervalSet set methods tests we also added tests against vectors of intervals just to document any deviations in the behaviour but ultimately we didn't care what the result was.
This originally looked like:
@test symdiff([earlier], [later]) != union(expected_xor)
@test symdiff(IntervalSet(earlier), IntervalSet(later)) == union(IntervalSet(expected_xor))The vector of intervals test is just mirroring the IntervalSet test below but adjusts the comparison to the current behaviour
Anyway, I agree that going forward we don't need to check both anymore, since union works as expected now.
Sounds good.
| @test setdiff(IntervalSet(later), IntervalSet(earlier)) == IntervalSet(expected_xor[2:2]) | ||
|
|
||
| @test symdiff([earlier], [later]) == expected_xor != union(expected_xor) | ||
| @test symdiff([earlier], [later]) == expected_xor == union(expected_xor) |
There was a problem hiding this comment.
| @test symdiff([earlier], [later]) == expected_xor == union(expected_xor) | |
| @test symdiff([earlier], [later]) == union(expected_xor) |
| @test_throws MethodError symdiff(earlier, later) | ||
|
|
||
| # Using a vector of intervals as sets | ||
| @test union([earlier, later]) == [earlier, later] |
There was a problem hiding this comment.
These tests should stay as they serve to showcase why you need IntervalSet when dealing with sets of Intervals. The comment should be updated to say:
# Test using a vector of intervals as a set only for comparison purposes
Unfortunately, I'm unable to suggest these changes.
There was a problem hiding this comment.
So you want to keep the test just to test the Base behaviour... and test the negation?
There was a problem hiding this comment.
Correct. For the same reason we test vectors of intervals elsewhere. Unless we can stop end users from using vectors of intervals seeing weird behaviour it's good to document/record the behaviour of vectors of intervals with the Base set functions.
| @testset "legacy deserialization" begin | ||
| # Serialized string generated on Intervals@1.2 with: | ||
| # `julia --project -E 'using Serialization, Intervals; sprint(serialize, Interval(1, 2, true, false))'`. | ||
| buffer = IOBuffer( | ||
| SERIALIZED_HEADER * | ||
| "\x004\x10\x01\bInterval\x1f\v՞\x84\xec\xf7-`\x87\xbbS\xe1Á\x88A\xd8\x01\t" * | ||
| "IntervalsD\x01\0\0\0\0\b\xe0\xe14\x10\x01\vInclusivity\x1f\v՞\x84\xec\xf7" * | ||
| "-`\x87\xbbS\xe1Á\x88A\xd8,\x02\0DML" | ||
| ) | ||
|
|
||
| interval = deserialize(buffer) | ||
| @test interval isa Interval | ||
| @test interval == Interval{Closed,Open}(1, 2) |
There was a problem hiding this comment.
Same as other deserialization comment
rofinn
left a comment
There was a problem hiding this comment.
Okay, I've reviewed and while I agree with most of the comments I'd like to confirm that we want to:
- Do we want to maintain v1 deserialization in v2 (it'll be a lot of work/bloat for all the proposed breaking changes)?
- Do we want to include tests of Base behaviour (ie: that
union(intervalsets) != union(vectors))?
| @testset "legacy deserialization" begin | ||
| # Serialized string generated on Intervals@1.2 with: | ||
| # `julia --project -E 'using Serialization, Intervals; sprint(serialize, AnchoredInterval{-1,Int}(2, true, false))'`. | ||
| buffer = IOBuffer( | ||
| SERIALIZED_HEADER * | ||
| "\x004\x10\x01\x10AnchoredInterval\x1f\v՞\x84\xec\xf7-`\x87\xbb" * | ||
| "S\xe1Á\x88A\xd8\x01\tIntervalsD\x02\0\0\x001\xff\xff\xff\xff\0\b\xe14\x10" * | ||
| "\x01\vInclusivity\x1f\v՞\x84\xec\xf7-`\x87\xbbS\xe1Á\x88A\xd8,\x02\0DML" | ||
| ) | ||
|
|
||
| interval = deserialize(buffer) | ||
| @test interval isa AnchoredInterval | ||
| @test interval == AnchoredInterval{-1,Int,Closed,Open}(2) | ||
| end | ||
|
|
There was a problem hiding this comment.
Since this is already going into the break v2-DEV release I'm inclined to just drop the compat.jl code. Also, deserialization will likely break again with #217 anyway. If we don't drop it for v2 are we just going to retain this compat code indefinitely?
| @test_throws MethodError symdiff(earlier, later) | ||
|
|
||
| # Using a vector of intervals as sets | ||
| @test union([earlier, later]) == [earlier, later] |
There was a problem hiding this comment.
So you want to keep the test just to test the Base behaviour... and test the negation?
|
|
||
| # TODO: Sometimes expected_xor would get mutated in this call | ||
| @test symdiff([earlier], [later]) == expected_xor != union(expected_xor) | ||
| @test symdiff([earlier], [later]) == expected_xor == union(expected_xor) |
There was a problem hiding this comment.
resulting value actually is which makes the intent less clear.
Why is it less clear? The issue with the original check is that we were testing with multiple overloaded methods. If you were to read these tests without context you might be confused about why they don't match because our implementation of union for vectors of intervals is a bit weird. It seemed prudent to add a more explicit check for when we deprecated the union method.
I suppose they could have been separate checks, but I like that the change is all on one line. Anyway, I agree that going forward we don't need to check both anymore, since union works as expected now.
I'd make an issue against the v2 milestone and deal with this before we make the official v2.0.0 release. I don't think we need to keep deserialization compatibility with Intervals 1.2 as that version is quite old but being able to load Intervals 1.9.0 would be nice to have in Intervals 2.0.0. I would 100% punt this work until the internal redesign is done though as otherwise it'll be annoying to update while the internal design is being iterated on.
Yes, as long as we're testing other |
Removes all deprecations placed in src/deprecations and fixes/deletes any relevant tests. Commits are split up by types of deprecations being dropped.
@omus I can't seem to set you as a reviewer, but I'm guessing you're the primary person who should review these changes?