GothenburgBitFactory / timewarrior

Timewarrior - Commandline Time Tracking and Reporting
https://timewarrior.net
MIT License
1.25k stars 94 forks source link

Retrieval of intervals with tags containing hyphens is broken #582

Closed emorozov closed 8 months ago

emorozov commented 8 months ago

I've started and forgotten to stop a task at the end of 2023.

Today, I've started my work and tried to start tracking of another task, but got an error:

❯ t start MYTASK-0002
Datafile::deleteInterval failed to find 'inc 20231229T182928Z # MYTASK-0001'

Deleting of the started task fails with the same error. I had to manually edit timewarrior storage file to fix the error.

lauft commented 8 months ago

@emorozov I tried to reproduce your error, however my reproducer script did not succeed in this.

#!/usr/bin/env bash

export TIMEWARRIORDB=/tmp/timewarriordb
rm -rf ${TIMEWARRIORDB}
mkdir -p ${TIMEWARRIORDB}/data
:> ${TIMEWARRIORDB}/timewarrior.cfg

src/timew start 20231229T182928Z MYTASK-0001  # start time tracking at the end of previous year
src/timew start 20240114T080000Z MYTASK-0002  # start tracking of another task in this year

This makes it a bit difficult to determine the cause of your error... 🤔

You do not happen to have the original Timewarrior storage file before the manual fix at hand? Do you have any exclusions configured?

lauft commented 8 months ago

I just discovered that it is not the interval crossing the year boundary causing the problem, but the change introduced in #576. Removing strings with hyphens from the list of strings to be quoted disabled Timewarrior to find the stored entry in the database. In a similar manner this also causes #580.

I will revert this change and create a bugfix release.

lauft commented 8 months ago

Fixed with 7007e16819fc81323dc26050c8c22b95610ffd5d