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 incorrectly incrementing IDs before sending to server. #1026
Conversation
Started with tests, setup is usually the longest part, should be able to cover other logic tomorrow. |
I think I'm done with it for now. So glad I wrote tests, found so many sneaky things, even in the dumbest 2 line implementation of |
(LENGTH(serverId) < LENGTH(:maxId) OR LENGTH(serverId) == LENGTH(:maxId) AND serverId < :maxId) | ||
AND | ||
(LENGTH(serverId) > LENGTH(:sinceId) OR LENGTH(serverId) == LENGTH(:sinceId) AND serverId > :sinceId) | ||
""") |
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.
Maybe use parentheses to make the boolean operation precedence explicit?
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 was thinking about it but actually either works. Maybe should still do it.
|
||
// Used for stubbing Android implementation without slow & buggy Robolectric things | ||
@Suppress("unused") | ||
class SpannableString(private val text: CharSequence) : Spannable { |
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.
Maybe this should be merged with the one in SpanUtilsTest
?
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.
That's a copy of that one, it just must have exactly this name. I'm not sure yet how to merge them.
listOf( | ||
"122" to "123", | ||
"12A" to "12B", | ||
"1" to "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.
No test case for something ending with z
?
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.
or 9
?
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.
inc()
is very dumb and I just let it increase any character, really. Even if it's z it should become something bigger.
It fixes the bug and the code looks fine for me, so I think we should merge it? Got a lot of complaints about the timeline not loading on nightly. |
I hit the bug like five times. Now I'm on this branch without any problems so far. |
Fix #1022
It seems to be working but I've made so many stupid errors before and while fixing it now that I'm not sure about anything anymore. I want to write some tests for that but I'm not sure when I'll do it. I would appreciate if someone else tried it out before merging.