-
Notifications
You must be signed in to change notification settings - Fork 80
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
Editing a todo changes its ID #85
Comments
I still have mixed feelings about having persistent IDs. I see one disadvantage (that in my case most IDs are guaranteed to have more than one digit), but no advantages. |
Advantages are that concurrent operations won't change the IDs, which, IMHO, adds a bit of safety:
It might be a bit uncommon, but I kinda like the determinism this adds. |
That is fair enough. |
I'm still willing to discuss it, but I honestly, I generally favour determinism. |
An easy fix that wouldn't change the nice cache validation flow we have (first expire, then reinsert) would be to directly derive the ID from the UID. |
I don't think we can derive collision-resistant IDs from UIs due to the amount of digits. Consider that we'd need a two/three digit output for every UID that does not collide (think of it as a hash function). |
We could throw in lowercase letters into the mix since those are easy to type as well. Other options would require updating the cache in-place during validation which is somewhat complicated. |
With letters + numbers (35 symbols), and 80 todos in the db, we'd have a 92% change of collision with two digits, and 7% with three digits. With both lowercase and uppercase letters, this goes down to 1% and 0.5% respectively. These number are a bit high, because a single collision would make To get a better understaning though, what causes the dislike for persistent ids? Maybe there's an alternate solution to it it. |
I dislike persistent IDs precisely because they fill up the space of possible IDs so much. I usually have a few open tasks where most tasks usually have a single-digit ID. With the new behavior, the tasks that I don't care about (done tasks) and will never address by ID again are assigned a low-digit ID. |
Ah, I understand, that's really a really valid concern. Let me think if there's another solution. I take it that |
I consider |
How would you feel about an |
I personally have no use for them after I'm done, but we shouldn't assume that the avg user feels about that the same way. |
Right, I meant, If this sounds okay to you, I'll prepare a PR, but if you actually want to keep them around, we can go back to brainstorming. |
Since flush also wipes the cache I imagine that this slows down everything a lot. |
It does. 😞 Back to the drawing board it is! |
Since an edited todo is removed from the cache and re-inserted, it's id changes (but we never have id re-use). Maybe we should avoid this (if possible).
The text was updated successfully, but these errors were encountered: