-
Notifications
You must be signed in to change notification settings - Fork 18
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
Drop all v1 deprecations for v2 #214
base: v2-DEV
Are you sure you want to change the base?
Conversation
Codecov Report
@@ 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 see 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I've allocated some bandwidth to review this tomorrow |
@testset "legacy deserialization" begin | ||
# Serialized string generated on [email protected] 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
end
With this updated compat.jl
code these tests should pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -280,7 +274,7 @@ end | |||
@test setdiff(IntervalSet(later), IntervalSet(earlier)) == IntervalSet(expected_xor[2:2]) | |||
|
|||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -368,7 +360,7 @@ end | |||
@test setdiff([later], [earlier]) == expected_xor[2:2] | |||
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@test symdiff([earlier], [later]) == expected_xor == union(expected_xor) | |
@test symdiff([earlier], [later]) == union(expected_xor) |
@@ -87,8 +87,6 @@ end | |||
@test_throws MethodError setdiff(later, earlier) | |||
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests should stay as they serve to showcase why you need IntervalSet
when dealing with sets of Interval
s. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you want to keep the test just to test the Base
behaviour... and test the negation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 [email protected] 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as other deserialization comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 [email protected] 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
@@ -87,8 +87,6 @@ end | |||
@test_throws MethodError setdiff(later, earlier) | |||
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you want to keep the test just to test the Base
behaviour... and test the negation?
@@ -280,7 +274,7 @@ end | |||
@test setdiff(IntervalSet(later), IntervalSet(earlier)) == IntervalSet(expected_xor[2:2]) | |||
|
|||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?