-
Notifications
You must be signed in to change notification settings - Fork 78
Rearrange checks #1722
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
Rearrange checks #1722
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1722 +/- ##
==========================================
+ Coverage 91.82% 93.36% +1.54%
==========================================
Files 10 27 +17
Lines 12801 24250 +11449
Branches 0 1093 +1093
==========================================
+ Hits 11754 22642 +10888
- Misses 1047 1573 +526
- Partials 0 35 +35
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
I've tested this increased checking with SLiM (the treerec tests and pyslim), and nothing bad happened - do you see anything we wouldn't want to do each time we simplify, @bhaller? |
I'm quite out of my depth on this, I would say. :-> But how's this: if you make a PR for SLiM that pulls these changes in, with the appropriate changes to the places in SLiM where we do integrity checks, then I'll test it on my side with my big test suite, with crosschecks enabled, etc.? And I'll also make sure that it would catch Elissa's bug even with coalescence checking disabled, in DEBUG mode at least. Sound good? |
jeromekelleher
left a 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.
LGTM - minor nitpicks
c/tskit/tables.c
Outdated
| goto out; | ||
| } | ||
| /* Check if time is nonfinite */ | ||
| /* Check if time is nonfinite and less recent than node time */ |
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 had to read this a few times - should be or less recent, right?
c/tskit/tables.c
Outdated
|
|
||
| /* Check known/unknown times are not both present on a site */ | ||
| if (unknown_time) { | ||
| num_unknown_times += 1; |
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.
num_unknown_times++; is a bit more C idiomatic
c/tskit/tables.c
Outdated
| } | ||
| } | ||
|
|
||
| /* reset checks if needed */ |
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.
Wasn't immediately obvious what the "if needed" meant here. Maybe "Reset counters for the next site". Also, can make it a bit more concise by
if (j > 0 && mutations.site[j - 1] != mutations.site[j]) {
...
}this is guaranteed to be safe as short circuiting booleans is part of the C standard.
c/tskit/tables.c
Outdated
| } | ||
|
|
||
| /* Check time value ordering */ | ||
| /* Check time ordering, we do this after the time checks above, so |
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.
Doesn't quite parse for me. Maybe "Check time ordering. We do..."
|
Passes all checks on my side. Thumbs up. |
85871df to
1339ab8
Compare
|
Thanks - fixed up those things (and the docs). After I fix whatever github's version of clang-format tells me to do (since it differs from my local one) and push again this should be ready to go. I noticed that the checks for mixing up known and unknown mutation times within sites don't actually work if the tables aren't ordered, but I also decided we don't care. |
1339ab8 to
4449b64
Compare
benjeffery
left a 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.
LGTM!
Just needs a changelog @petrelharp
4449b64 to
f20fae8
Compare
|
Changelog added! |
|
Woop! Merging. |
check migration ordering
f20fae8 to
71b09dd
Compare
This will close #1713. Since we already have all the
TSK_CHECK_X_ORDERINGflags we needed (except X=MIGRATIONS), I just went through to make sure that the things checked under CHECK_ORDERING were all ordering-related. They were, except for mutations. So, I've moved a bunch of consistency checks out ofTSK_CHECK_MUTATION_ORDERING, i.e., checks that weren't previously done by default that now are: This turned up a few nonsensical tables in the tests. But we should make sure it's actually what we want to do? These checks are:Other notes:
TSK_CHECK_ORDERINGflag, since you get that fromTSK_CHECK_TREES, and I don't think anyone's going to want to check ordering without checking the other optional properties.TSK_CHECK_TREESalso implies runningtsk_table_collection_check_tree_integrity, which is more expensive (it builds trees; everything else is a single pass through the tables). So, maybe we do want a genericCHECK_ORDERING?sortfor it yet...)