Skip to content
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

hidden tasks containing only projects/contexts gets deleted #220

Closed
dlaidig opened this issue Jul 19, 2021 · 11 comments
Closed

hidden tasks containing only projects/contexts gets deleted #220

dlaidig opened this issue Jul 19, 2021 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@dlaidig
Copy link

dlaidig commented Jul 19, 2021

Is it an actual bug?
Yes. (And I am very happy that I carefully checked the diff of my todo.txt files after testing sleek.)

Did you check if the bug has already been reported?
Yes.

Describe the bug
My todo.txt files contain a hidden entry to define projects/contexts. When Sleek modifies the file, e.g., when marking a task as completed, this entry gets deleted.

With this task, the "hidden" toggle also does not work properly and does not seem to have any effect.

To Reproduce
Create the following todo.txt file and check the test task. The hidden task gets deleted.

2019-11-19 h:1 @someday +obsolete
(A) 2021-06-22 test task

If the hidden tasks contains regular text, this does not seem to happen:

2019-11-19 foo h:1 @someday +obsolete
(A) 2021-06-22 test task

Do you see any error entries in sleeks developer tools?
No.

Expected behavior
The hidden task should not get deleted.

Desktop (please complete the following information):

  • OS: Fedora
  • Version of sleek 1.0.9
  • Source: Flathub
@dlaidig dlaidig added the bug Something isn't working label Jul 19, 2021
@ransome1
Copy link
Owner

@dlaidig can you please check if the todo is actually being deleted from the file?

Although I havn't looked into it yet, I think it's just not loaded, as sleek filters tasks with no text. It also doesn't let you create tasks with no actual text.

This is a behavior from the days before the hidden todo function got introduced. I could enhande this by letting sleek create and read todos that contain the h: attribute.

@dlaidig
Copy link
Author

dlaidig commented Jul 19, 2021

Yes, I checked the files after they were modified by sleek and the hidden line was removed.

@ransome1
Copy link
Owner

Ok I found the reason and it will be fixed in the next release. Also empty todos with h:1 attribute can now be created within sleek (led to a warning before).

Thanks for reporting it.

@ransome1
Copy link
Owner

Hi @dlaidig. Could you please check, if this behavior is still present in https://github.com/ransome1/sleek/releases/tag/v1.1.0-rc.4?

@dlaidig
Copy link
Author

dlaidig commented Jul 21, 2021

Thanks for the very fast fix! I checked this version and for the example I posted, this does not happen any more. However, with

2019-11-19 @call +dad
(A) 2021-06-22 test task

the first task is not shown in sleek and if I check the second task, the first one silently get deleted from the file. I am aware of #68 (and personally, I am not very likely to create a task like that since I do not use projects/contexts that much), but "silently deleting data" is the bug category that makes me a bit concerned about trusting sleek with important personal data, to be honest.

I will keep testing since sleek is awesome to use (and with threshold dates and the "due:+" syntax, it finally supports my use case), but I guess I will keep monitoring the changes it does to my todo.txt files with git for quite some time...

@ransome1
Copy link
Owner

ransome1 commented Jul 21, 2021

This is the behavior by design. Tasks with empty text fields are being removed from the file. Except when they are marked with h:1. I guess a less strict behavior can be implemented with which the line won't get removed but just ignored.

I understand your concern and as this application works directly with your files (and not with a database) there will always be a risk that something might happen. It didn't so far but creating backups is essential.

Edit: It's basically a one liner, that is being removed with the next released. The creation of todos in sleek with no text will still not be possible though.

@dlaidig
Copy link
Author

dlaidig commented Jul 21, 2021

I am sorry, but if a consequence of the design is that sleek silently deletes entries that are valid according to the todo.txt specification and contain information (call dad), I would say then sleek should claim that it "makes use of the todo.txt format".

Backups only help if you notice that data is missing. If some tasks get deleted, you usually do not find that out or you find it out too late due to the consequences of not dealing with the task in time.

(Sorry for the harsh reply. I just couldn't ignore the "behavior by design" explanation. I appreciate you fixing the issue so quickly and will test the next version.)

@ransome1
Copy link
Owner

I am sorry, but if a consequence of the design is that sleek silently deletes entries that are valid according to the todo.txt specification and contain information (call dad), I would say then sleek should claim that it "makes use of the todo.txt format".

I'm not sure if your example is actually valid by the todo.txt standard. As far as I understand the basic rules (https://github.com/todotxt/todo.txt/raw/master/description.svg) the only element that is not optional is the description itself. But if I'm mistaken I won't argue against it.

@dlaidig
Copy link
Author

dlaidig commented Jul 21, 2021

I'm not sure if your example is actually valid by the todo.txt standard. As far as I understand the basic rules (https://github.com/todotxt/todo.txt/raw/master/description.svg) the only element that is not optional is the description itself. But if I'm mistaken I won't argue against it.

That svg also shows that projects and contexts are part of the description, i.e. the description for my example is @call +dad and certainly non-empty. But that detail is probably more relevant for #68 and I will stop nitpicking now. :)

@dlaidig dlaidig mentioned this issue Jul 25, 2021
11 tasks
@dlaidig
Copy link
Author

dlaidig commented Jul 27, 2021

Fixed in v1.1.0-rc.6, so I'm closing this issue now. :)

@dlaidig dlaidig closed this as completed Jul 27, 2021
@ransome1
Copy link
Owner

thank you @dlaidig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants