GothenburgBitFactory / taskwarrior

Taskwarrior - Command line Task Management
https://taskwarrior.org
MIT License
4.35k stars 294 forks source link

Recurrence creates duplicate instances #3550

Open jkaiser-ioki opened 3 months ago

jkaiser-ioki commented 3 months ago

All my recurrences create duplicate new instances when the next instance is required. The issued appeared when I migrated to 3.0.0, and I assumed that it was an import problem, but the same happens on freshly created recurrences. The following details are for the recurrence I just added:

[jonas@orchid ~]$ task add prio:M proj:licensing +MAC +SRE +SHORTCUT size:8 recur:yearly due:2024-07-22 'License Renewal: Shortcut' 
Created task 143 (recurrence template).

Expectation: Creation of the recurrence template (ID 143), plus one actual child instance (ID 144).

Actual: the expected, plus a duplicate of ID 144 , with ID 145

[jonas@orchid ~]$ task 143 144 145 info

Name            Value                                                                    
ID              143                                                                      
Description     License Renewal: Shortcut                                                
Status          Recurring                                                                
Project         licensing
Recurrence      yearly                                                                   
Mask            -
Recurrence type periodic                                                                 
Entered         2024-07-10 15:56:25 (1h)
Due             2024-07-22 00:00:00                                                      
Last modified   2024-07-10 15:56:25 (1h)
Tags            MAC SHORTCUT SRE                                                         
Virtual tags    MONTH PARENT PRIORITY PROJECT QUARTER TAGGED TEMPLATE UDA UNBLOCKED YEAR
UUID            6a58b17b-4735-4cfe-85b6-ad50d730c30f                                     
Urgency         9.55
Priority        M                                                                        
Size            8
[tag_MAC        x]                                                                       
[tag_SHORTCUT   x]
[tag_SRE        x]                                                                       

    project             1 *    1 =      1
    tags                1 *    1 =      1
    due             0.304 *   12 =   3.65
    UDA priority.M      1 *  3.9 =    3.9
                                   ------
                                     9.55

Name            Value                                                                                 
ID              144                                                                                   
Description     License Renewal: Shortcut                                                             
Status          Pending                                                                               
Project         licensing
Recurrence      yearly                                                                                
Parent task     6a58b17b-4735-4cfe-85b6-ad50d730c30f
Mask Index      0                                                                                     
Recurrence type periodic
Entered         2024-07-10 15:56:25 (1h)                                                              
Due             2024-07-22 00:00:00
Last modified   2024-07-10 15:56:25 (1h)                                                              
Tags            MAC SHORTCUT SRE
Virtual tags    CHILD INSTANCE MONTH PENDING PRIORITY PROJECT QUARTER READY TAGGED UDA UNBLOCKED YEAR 
UUID            648a478a-eb31-4c29-91ba-6a7bd57e4bc5
Urgency         9.55                                                                                  
Priority        M
Size            8                                                                                     
[tag_MAC        x]
[tag_SHORTCUT   x]                                                                                    
[tag_SRE        x]

    project             1 *    1 =      1
    tags                1 *    1 =      1
    due             0.304 *   12 =   3.65
    UDA priority.M      1 *  3.9 =    3.9
                                   ------
                                     9.55

Name            Value                                                                                        
ID              145                                                                                          
Description     License Renewal: Shortcut                                                                    
Status          Pending                                                                                      
Project         licensing
Recurrence      yearly                                                                                       
Parent task     6a58b17b-4735-4cfe-85b6-ad50d730c30f
Mask Index      0                                                                                            
Recurrence type periodic
Entered         2024-07-10 15:56:25 (1h)                                                                     
Due             2024-07-22 00:00:00
Last modified   2024-07-10 15:56:25 (1h)                                                                     
Tags            MAC SHORTCUT SRE
Virtual tags    CHILD INSTANCE LATEST MONTH PENDING PRIORITY PROJECT QUARTER READY TAGGED UDA UNBLOCKED YEAR 
UUID            c8551778-fc44-4fa0-bfc3-7b3de4af480a
Urgency         9.55                                                                                         
Priority        M
Size            8                                                                                            
[tag_MAC        x]
[tag_SHORTCUT   x]                                                                                           
[tag_SRE        x]

    project             1 *    1 =      1
    tags                1 *    1 =      1
    due             0.304 *   12 =   3.65
    UDA priority.M      1 *  3.9 =    3.9
                                   ------
                                     9.55

Relevant observations

Output of the task diag command

[jonas@orchid ~]$ task diag

task 3.0.2
   Platform: Linux

Compiler
    Version: 13.2.1 20230801
       Caps: +stdc +stdc_hosted +LP64 +c8 +i32 +l64 +vp64 +time_t64
 Compliance: C++17

Build Features
     Commit: bc86a1e53
      CMake: 3.29.2
    libuuid: libuuid + uuid_unparse_lower
 Build type: 

Configuration
       File: /home/jonas/.config/task/taskrc (found), 4760 bytes, mode 100600
       Data: /home/jonas/.task (found), dir, mode 40700
    Locking: Enabled
         GC: Enabled
    $EDITOR: emacs
Hooks
     System: Enabled
   Location: /home/jonas/.task/hooks
             (-none-)

Tests
   Terminal: 375x73
       Dups: Scanned 1568 tasks for duplicate UUIDs:
             No duplicates found
 Broken ref: Scanned 1568 tasks for broken references:
             No broken references found

My Configuration

(just in case that we happens is due to some misconfiguration and not an actual TW bug)

[jonas@orchid ~]$ cat ~/.config/task/taskrc
# [Created by task 2.5.3 8/31/2021 15:01:28]
# Taskwarrior program configuration file.
# For more documentation, see http://taskwarrior.org or try 'man task', 'man task-color',
# 'man task-sync' or 'man taskrc'

# Here is an example of entries that use the default, override and blank values
#   variable=foo   -- By specifying a value, this overrides the default
#   variable=      -- By specifying no value, this means no default
#   #variable=foo  -- By commenting out the line, or deleting it, this uses the default

# Use the command 'task show' to see all defaults and overrides

# Files
data.location=~/.task

# Do not propagate changes of recurrance instances to the whole recurrence (and don't ask)
# (to bypass: manually edit the template entry itself) [alt:yes|no|prompt(default)]]
recurrence.confirmation=no

# Color theme (uncomment one to use)
#include /usr/share/doc/task/rc/light-16.theme
#include /usr/share/doc/task/rc/light-256.theme
#include /usr/share/doc/task/rc/dark-16.theme
#include /usr/share/doc/task/rc/dark-256.theme
#include /usr/share/doc/task/rc/dark-red-256.theme
#include /usr/share/doc/task/rc/dark-green-256.theme
#include /usr/share/doc/task/rc/dark-blue-256.theme
#include /usr/share/doc/task/rc/dark-violets-256.theme
#include /usr/share/doc/task/rc/dark-yellow-green.theme
#include /usr/share/doc/task/rc/dark-gray-256.theme
#include /usr/share/doc/task/rc/dark-gray-blue-256.theme
#include /usr/share/doc/task/rc/solarized-dark-256.theme
#include /usr/share/doc/task/rc/solarized-light-256.theme
#include /usr/share/doc/task/rc/no-color.theme

## Customised Task Priority
uda.priority.values=C,H,M,,L

urgency.uda.priority.C.coefficient=10.0
urgency.uda.priority.H.coefficient=6.0
urgency.uda.priority.M.coefficient=3.9
urgency.uda.priority..coefficient=1.8
urgency.uda.priority.L.coefficient=0.5

## Customised Task Sizes
uda.size.type=numeric
uda.size.label=Size
uda.size.values=1,2,3,5,8,13,21

## Misc Urgency adjsutments
urgency.user.tag.ITER.coefficient=4.0
urgency.user.tag.SPRINT.coefficient=4.0

### Modfied Standard Reports

# add size to default 'next' report

### Custom reports (defaults sown as commented)

#report.next.labels=ID,Active,Age,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg
report.next.labels=ID,Active,Age,Deps,P,Project,Tag,Recur,Sched,Due,Until,Size,Description,Urg
#report.next.columns=id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency
report.next.columns=id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,size,description,urgency

# day planning
report.today.description=Tasks that should ideally be handled today i.e.  before tomorrow 10 AM
report.today.labels=Project,ID,P,Tag,Due,Description,Urg
report.today.columns=project,id,priority,tags,due.relative,description,urgency
report.today.sort=project+\/,due+
report.today.filter=status:pending due.before:tomorrow+10h

# recap of last working day (actually last day)
report.lastday.description=Tasks completed yesterday
report.lastday.labels=Project,Description,UUID
report.lastday.columns=project,description.count,uuid.short
report.lastday.sort=project+\/,end+
report.lastday.filter=status:completed end.after:yesterday

# recap of last friday (TODO: check what happens whn called on friday!!)
report.lastfri.description=Tasks completed on last friday
report.lastfri.labels=Project,Description,UUID
report.lastfri.columns=project,description.count,uuid.short
report.lastfri.sort=project+\/,end+
report.lastfri.filter=status:completed end.after:friday-8d

# recap of last week
report.lastweek.description=Tasks completed over the last 7 days
report.lastweek.labels=Project,Completed,Description,UUID
report.lastweek.columns=project,end,description.count,uuid.short
report.lastweek.sort=project+\/,end+
report.lastweek.filter=status:completed end.after:today-7d

# recap of last MAC iteration (only makes sense when run on tuesday morning ATM)
report.lastiter.description=Tasks completed during the concluding iteration
report.lastiter.labels=Project,Completed,Tag,Description,UUID
report.lastiter.columns=project,end,tags,description.count,uuid.short
report.lastiter.sort=project+\/,end+
report.lastiter.filter=status:completed end.after:today-14d +MAC

# recap of last SRE sprint (only makes sense when run immediately prior to retro)
report.lastsprint.description=Tasks completed during the concluding iteration
report.lastsprint.labels=Project,Completed,Tag,Description,UUID
report.lastsprint.columns=project,end,tags,description.count,uuid.short
report.lastsprint.sort=project+\/,end+
report.lastsprint.filter=status:completed end.after:today-14d +SRE

# other stuff
news.version=2.6.0
djmitche commented 2 months ago

I could swear I replied to this, I'm sorry.

I wasn't able to reproduce this, using the same commands you used.

Can you confirm you're not using sync? Are there any other processes running in the background (cron task, another terminal, etc.) that might be applying recurrence at the same time?

jkaiser-ioki commented 2 months ago

I never set up or enabled sync as far as I know, so if it isn't turned on automatically somehow, I am pretty sure it is not running.

The only automated thing I can think of is my status bar (i3status-rust), which has two configured blcoks that each query task every 60 seconds. From my understanding, the commands are configured to not change the task IDs, i.e. if found this in the underlying implementation:

Command::new("task")
        .args(["rc.gc=off", filter, "count"])
        .output()

I assume the rc.gc=off is the reason why the IDs do not change (which is good since I don't want the IDs to jump between one command manually viewing the task list and a another modifying one by ID), but maybe recurrence updates are still triggered despite that flag, and by some chance the two blocks fire so close to each other that that causes duplicates?

djmitche commented 2 months ago

I suspect that's the issue, or at least part of it. Try adding rc.recurrence.limit=0to that command line?

jkaiser-ioki commented 2 months ago

hmm, that code is not from me so I cannot really test your suggestion as such...

I'll disable one of the blocks for a while to see if the issue goes away, and if that is the case, I will open a ticket with the status bar application to consider incorporating your change. Is there any documentation reg. those rc.* options and their behaviour I could point their devs to? That might simplify the process of determining if that extra flag is the one that is needed, if it should always be included or whether it might be exposed through some form of configuration on their end.

djmitche commented 2 months ago

Actually juts rc.recurrence=off should do -- it's in the taskrc(5) manpage.