GothenburgBitFactory / GothenburgBitFactory/taskwarrior
calling task import from a hook does not add tags
- Dominant language
- C++
- Stars
- 6.1k
- Forks
- 423
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 11
Description
#### To report a bug...
i was testing my hook and for some reason it was modifying a task but not adding the desired tag after reading the haskell-taskwarrior library source code and my own and not finding any errors i went to debug with taskwarrior to get a better idea of the problem
* What command(s) did you run?
`task add test +next`
and then `task id done`
* What did you expect to happen?
my hook would run and then it would modify the correct task's tag via task import
* What actually happened?
my hook ran and it called task import with the correct arguments but the task wasn't modified, i was using debug =1 and debug.hooks = 2 and from the output my hook works as expected i even tried `echo json-ouput | task` import and when i did this it updated the task's tag correctly which means that it must be an error when calling task import specifically from a hook here is the command's output
```
/home/eldritch/projects/utility/taskwarrior-hook〉task 74 done 11/30/2022 11:27:23 AM
Timer Config::load (/home/eldritch/.config/task/taskrc) 0.000566 sec
Found hook script /home/eldritch/.config/task/hooks/on-modify-entangle
Parse Tree (before command-specifіc processing)
_original_args
task status:pending export
_args
word basename='task' raw='task' BINARY
op raw='(' ORIGINAL FILTER
pair canonical='status' modifier='' name='status' raw='status:pending' separator=':' value='pending' ORIGINAL FILTER
op raw=')' ORIGINAL FILTER
identifier canonical='export' raw='export' ORIGINAL CMD READONLY SHOWSID RUNSGC ALLOWSFILTER ALLOWSMISC
Filtered 73 tasks --> 69 tasks [pending only]
pending.data rw O T0073+000~000-000 L0074+000
completed.data rw O T0106+000~000-000 L0105+000
undo.data rw - T0000+000~000-000 L0000+000
backlog.data rw - T0000+000~000-000 L0000+000
Perf task 2.6.2 - 20221130T142737Z init:1859 load:8606 gc:102 filter:379 commit:72333 sort:0 render:1344 hooks:5 other:1356 total:85984
Timer Config::load (/home/eldritch/.config/task/taskrc) 0.000540 sec
Found hook script /home/eldritch/.config/task/hooks/on-modify-entangle
Parse Tree (before command-specifіc processing)
_original_args
task status:completed modified.after:-2w export
_args
word basename='task' raw='task' BINARY
op raw='(' ORIGINAL FILTER
pair canonical='status' modifier='' name='status' raw='status:completed' separator=':' value='completed' ORIGINAL FILTER
pair canonical='modified' modifier='after' name='modified' raw='modified.after:-2w' separator=':' value='-2w' ORIGINAL FILTER
op raw=')' ORIGINAL FILTER
identifier canonical='export' raw='export' ORIGINAL CMD READONLY SHOWSID RUNSGC ALLOWSFILTER ALLOWSMISC
Filtered 179 tasks --> 14 tasks [all tasks]
pending.data rw - T0073+000~000-000 L0073+000
completed.data rw - T0106+000~000-000 L0106+000
undo.data rw - T0000+000~000-000 L0000+000
backlog.data rw - T0000+000~000-000 L0000+000
Perf task 2.6.2 - 20221130T142737Z init:1847 load:3898 gc:65 filter:1152 commit:153 sort:0 render:342 hooks:1 other:1454 total:8912
Timer Config::load (/home/eldritch/.config/task/taskrc) 0.000605 sec
Found hook script /home/eldritch/.config/task/hooks/on-modify-entangle
Parse Tree (before command-specifіc processing)
_original_args
task import
_args
word basename='task' raw='task' BINARY
identifier canonical='import' raw='import' ORIGINAL CMD ALLOWSMISC
Hook: Calling /home/eldritch/.config/task/hooks/on-modify-entangle
Hook: input
{"description":"create script for getting how many commits are only 6 lines of changes","entry":"20221107T103408Z","modified":"20221107T103408Z","status":"pending","uuid":"39de8a05-e9e9-4b40-a21e-f91a5ef95f7c"}
{"description":"create script for getting how many commits are only 6 lines of changes","entry":"20221107T103408Z","modified":"20221107T103408Z","status":"pending","uuid":"39de8a05-e9e9-4b40-a21e-f91a5ef95f7c","tags":["next"]}
Hooks: args
api:2
args:task import
command:import
rc:/home/eldritch/.config/task/taskrc
data:/home/eldritch/.local/share/task
version:2.6.2
Timer Hooks::execute (/home/eldritch/.config/task/hooks/on-modify-entangle) 0.003823 sec
Hook: output
{"description":"create script for getting how many commits are only 6 lines of changes","entry":"20221107T103408Z","modified":"20221107T103408Z","status":"pending","tags":["next"],"uuid":"39de8a05-e9e9-4b40-a21e-f91a5ef95f7c"}
Hook: Completed with status 0
pending.data rw O T0073+000~001-000 L0073+000
completed.data rw - T0000+000~000-000 L0000+000
undo.data rw O T0000+000~000-000 L0004+004
backlog.data rw O T0000+000~000-000 L0001+001
Perf task 2.6.2 - 20221130T142737Z init:2126 load:2068 gc:0 filter:0 commit:66063 sort:0 render:0 hooks:4044 other:2515 total:74748
Imported 1 tasks.
Completed task b3c9907a 'test11'.
Completed 1 task.
Timer Config::load (/home/eldritch/.config/task/taskrc) 0.000600 sec
No context set
Found hook script /home/eldritch/.config/task/hooks/on-modify-entangle
Parse Tree (before command-specifіc processing)
_original_args
task 74 done
_args
word basename='task' raw='task' BINARY
op raw='(' ORIGINAL FILTER
number raw='74' ORIGINAL FILTER
op raw=')' ORIGINAL FILTER
identifier canonical='done' raw='done' ORIGINAL CMD USESCONTEXT ALLOWSFILTER ALLOWSMODIFICATIONS
Filtered 74 tasks --> 1 tasks [pending only]
Hook: Calling /home/eldritch/.config/task/hooks/on-modify-entangle
Hook: input
{"description":"test11","entry":"20221130T142723Z","modified":"20221130T142723Z","status":"pending","uuid":"b3c9907a-e641-4e74-b4fe-1a2ea29dde21","tags":["next"]}
{"description":"test11","end":"20221130T142737Z","entry":"20221130T142723Z","modified":"20221130T142723Z","status":"completed","uuid":"b3c9907a-e641-4e74-b4fe-1a2ea29dde21","tags":["next"]}
Hooks: args
api:2
args:task 74 done
command:done
rc:/home/eldritch/.config/task/taskrc
data:/home/eldritch/.local/share/task
version:2.6.2
Timer Hooks::execute (/home/eldritch/.config/task/hooks/on-modify-entangle) 0.212261 sec
Hook: output
Importing 'STDIN'
Modifying task 39de8a05 'create script for getting how many commits are only 6 lines of changes'.
mod 39de8a05-e9e9-4b40-a21e-f91a5ef95f7c create script for getting how many commits are only 6 lines of changes
{"description":"test11","end":"20221130T142737Z","entry":"20221130T142723Z","modified":"20221130T142723Z","status":"completed","tags":["next"],"uuid":"b3c9907a-e641-4e74-b4fe-1a2ea29dde21"}
Hook: Completed with status 0
pending.data rw O T0074+000~001-000 L0074+000
completed.data rw - T0000+000~000-000 L0000+000
undo.data rw O T0000+000~000-000 L0004+004
backlog.data rw O T0000+000~000-000 L0001+001
Perf task 2.6.2 - 20221130T142737Z init:2065 load:179035 gc:0 filter:195 commit:63299 sort:0 render:0 hooks:212502 other:179998 total:458059
Importing 'STDIN'
Modifying task 39de8a05 'create script for getting how many commits are only 6 lines of changes'.
mod 39de8a05-e9e9-4b40-a21e-f91a5ef95f7c create script for getting how many commits are only 6 lines of changes
You have more urgent tasks.
```
* Paste the output of the ```task diag``` command.
```
Timer Config::load (/home/eldritch/.config/task/taskrc) 0.000524 sec
Found hook script /home/eldritch/.config/task/hooks/on-modify-entangle
Parse Tree (before command-specifіc processing)
_original_args
task diag
_args
word basename='task' raw='task' BINARY
identifier canonical='diagnostics' raw='diag' ORIGINAL CMD READONLY
pending.data rw - T0072+000~000-000 L0072+000
completed.data rw - T0108+000~000-000 L0108+000
undo.data rw - T0000+000~000-000 L0000+000
backlog.data rw - T0000+000~000-000 L0000+000
Perf task 2.6.2 - 20221130T143851Z init:1932 load:5241 gc:0 filter:0 commit:180 sort:0 render:0 hooks:2 other:7007 total:9121
task 2.6.2
Platform: Linux
Compiler
Version: 11.3.0
Caps: +stdc +stdc_hosted +LP64 +c8 +i32 +l64 +vp64 +time_t64
Compliance: C++17
Build Features
CMake: 3.24.2
libuuid: libuuid + uuid_unparse_lower
libgnutls: 3.7.8
Build type: Release
Configuration
File: /home/eldritch/.config/task/taskrc (found), 1600 bytes, mode 100644
Data: /home/eldritch/.local/share/task (found), dir, mode 40755
Locking: Enabled
GC: Enabled
rc.editor: nvim
Server:
CA: -
Certificate: -
Key: -
Trust: strict
Ciphers: NORMAL
Creds:
Hooks
System: Enabled
Location: /home/eldritch/.config/task/hooks
Active: on-modify-entangle (executable)
Inactive:
Tests
Terminal: 227x50
Dups: Scanned 180 tasks for duplicate UUIDs:
Found duplicate 488049b2-6ef7-49d7-8883-4b30b829cf70
Found duplicate cb65e294-c501-4707-a13c-7824e310904b
Found duplicate 2a31c9db-8ec7-48b4-b6fb-f3d23bd0caca
Broken ref: Scanned 180 tasks for broken references:
No broken references found
```
#### Extra context
my hook is a haskell executable.
i have my Main.hs source code in a [gist](https://gist.github.com/dark-ether/864b7895e2165533e9939544a68f4329)
and my package.yaml is
```
dependencies:
- base == 4.*
- taskwarrior
- aeson
- text
- time
- containers
executables:
taskwarrior-hook:
main: Main.hs
```
Contributor guide
Assessment
This issue has not been assessed yet.